Submission #10078067
Source Code Expand
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
int main(void){
lint N,D;
cin >> N >> D;
lint d[N];
rep(i,N) cin >> d[i];
lint dis[N+1]={};
dis[0]=D;
for(int i=1;i<=N;i++) dis[i]=min(dis[i-1],llabs(dis[i-1]-d[i-1]));
lint able[N+1]={};
able[N]=1;
for(int i=N-1;i>=0;i--){
if(able[i+1]<=d[i]/2) able[i]=able[i+1];
else able[i]=able[i+1]+d[i];
}
int Q;
cin >> Q;
rep(i,Q){
int q;
cin >> q;
if(able[q]<=dis[q-1]) cout << "YES" << endl;
else cout << "NO" << endl;
}
}
Submission Info
Submission Time |
|
Task |
E - Alice in linear land |
User |
bayashiko |
Language |
C++14 (GCC 5.4.1) |
Score |
900 |
Code Size |
1291 Byte |
Status |
AC |
Exec Time |
118 ms |
Memory |
13696 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
900 / 900 |
Status |
|
|
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 |
1 ms |
256 KB |
00-01.txt |
AC |
1 ms |
256 KB |
00-02.txt |
AC |
1 ms |
256 KB |
01-00.txt |
AC |
1 ms |
256 KB |
01-01.txt |
AC |
1 ms |
256 KB |
01-02.txt |
AC |
116 ms |
13568 KB |
01-03.txt |
AC |
116 ms |
13568 KB |
01-04.txt |
AC |
117 ms |
13696 KB |
01-05.txt |
AC |
114 ms |
13696 KB |
01-06.txt |
AC |
117 ms |
13696 KB |
01-07.txt |
AC |
118 ms |
13696 KB |
01-08.txt |
AC |
111 ms |
13440 KB |
01-09.txt |
AC |
113 ms |
13440 KB |
01-10.txt |
AC |
114 ms |
13440 KB |