Submission #2874311


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MAX=300000;
const ll INF=0x3f3f3f3f3f3f3f;
ll p,q,tmp[MAX],ans[MAX],d[MAX],dtot[MAX],near[MAX],N,D,Q;
int main(){
    scanf("%lld%lld",&N,&D);
    for(ll i=0;i<N;i++) scanf("%lld",&d[i]);
    dtot[0]=D;
    for(ll i=1;i<=N;i++) dtot[i]=min(dtot[i-1],abs(d[i-1]-dtot[i-1]));
    near[N]=0;
    for(ll i=N-1;i>=1;i--) {
        if(near[i+1]>=d[i]/2) near[i]=max(d[i]+near[i+1],near[i+1]);
        else near[i]=near[i+1];
    }
    for(ll i=0;i<N;i++) {
        if(near[i+1]>=dtot[i]) ans[i]=1;
        //printf("%lld %lld %lld\n",i,dtot[i],near[i+1]);
    }

    scanf("%lld",&Q);
    for(ll i=0;i<Q;i++){
        ll t1;
        scanf("%lld",&t1);
        if(ans[t1-1]) printf("NO\n");
        else printf("YES\n");
    }
    return 0;
}

Submission Info

Submission Time
Task E - Alice in linear land
User x0000ai
Language C++14 (GCC 5.4.1)
Score 0
Code Size 901 Byte
Status WA
Exec Time 119 ms
Memory 12800 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:12:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&N,&D);
                            ^
./Main.cpp:13:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     for(ll i=0;i<N;i++) scanf("%lld",&d[i]);
                                            ^
./Main.cpp:26:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&Q);
                     ^
./Main.cpp:29:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&t1);
                          ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 900
Status
AC × 3
AC × 7
WA × 7
Set Name Test Cases
Sample 00-00.txt, 00-01.txt, 00-02.txt
All 00-00.txt, 00-01.txt, 00-02.txt, 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt
Case Name Status Exec Time Memory
00-00.txt AC 2 ms 6400 KB
00-01.txt AC 2 ms 4352 KB
00-02.txt AC 2 ms 6400 KB
01-00.txt AC 2 ms 6400 KB
01-01.txt AC 2 ms 6400 KB
01-02.txt WA 118 ms 12800 KB
01-03.txt WA 117 ms 12672 KB
01-04.txt WA 118 ms 12800 KB
01-05.txt WA 116 ms 12800 KB
01-06.txt WA 118 ms 12800 KB
01-07.txt WA 119 ms 12800 KB
01-08.txt AC 114 ms 12672 KB
01-09.txt AC 116 ms 12672 KB
01-10.txt WA 116 ms 12672 KB