Submission #2067977
Source Code Expand
#include <bits/stdc++.h> #define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME #define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) #define pr1(a) (#a)<<"="<<(a) #define pr2(a,b) pr1(a)<<", "<<pr1(b) #define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c) #define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d) #define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e) #define int long long #define double long double using namespace std; const int N = 100010; const int INF = 1LL<<55; const int mod = (1e9)+7; const double EPS = 1e-8; const double PI = 6.0 * asin(0.5); typedef pair<int,int> P; typedef long long ll; template<class T> T Max(T &a,T b){return a=max(a,b);} template<class T> T Min(T &a,T b){return a=min(a,b);} ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";} istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;} ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;} istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;} void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;} signed main(){ int n,L; cin>>n>>L; vector<int> X(n); cin>>X; L *= 100; for(int i=0;i<n;i++) X[i] *= 100; vector<P> bar; for(int i=0;i<n;i++){ int l = X[i], r = X[i]; while(i + 1 < n && X[i+1] - X[i] <= L) r = X[++i]; bar.push_back(P(l,r)); } bar.push_back(P(INF,INF)); int ans = 1; for(auto b:bar) if(b.second-b.first+1+1 >= L) ans = 0; if(ans == 0) {cout<<"NO"<<endl;return 0;} auto must = [&](int pos){ auto b = *lower_bound(bar.begin(),bar.end(),P(pos,0)); int l = b.first, r = b.second; if(pos < l && r < pos+L) return 1; return 0; }; auto canJump=[&](int pos){ auto b = *lower_bound(bar.begin(),bar.end(),P(pos,0)); int l = b.first, r = b.second; if(l<=pos + L + 1) return 0; return 1; }; auto move =[&](int pos){ auto b = *lower_bound(bar.begin(),bar.end(),P(pos,0)); int l = b.first, r = b.second; return r + 1 - L; }; int pos = 0; while(ans){ if(pos > bar[bar.size()-2].second) break; if(must(pos)) ans &= canJump(pos+L),pos = pos+L+L; else pos = move(pos); } cout<<(ans? "YES":"NO")<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - ハードル走 |
User | haji |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 2346 Byte |
Status | AC |
Exec Time | 55 ms |
Memory | 3188 KB |
Judge Result
Set Name | Sample | Small | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_06, 00_sample_part_00, 00_sample_part_01, 00_sample_part_02, 00_sample_part_03, 00_sample_part_04, 00_sample_part_05 |
Small | 00_sample_part_00, 00_sample_part_01, 00_sample_part_02, 00_sample_part_03, 00_sample_part_04, 00_sample_part_05, 50_random_NLsmall_part_00, 50_random_NLsmall_part_01, 50_random_NLsmall_part_02, 50_random_NLsmall_part_03, 50_random_NLsmall_part_04, 50_random_NLsmall_part_05, 50_random_NLsmall_part_06, 50_random_NLsmall_part_07, 50_random_NLsmall_part_08, 50_random_NLsmall_part_09, 50_random_XiNsmall_narrow_part_00, 50_random_XiNsmall_narrow_part_01, 50_random_XiNsmall_narrow_part_02, 50_random_XiNsmall_narrow_part_03, 50_random_XiNsmall_narrow_part_04, 50_random_XiNsmall_narrow_part_05, 50_random_XiNsmall_narrow_part_06, 50_random_XiNsmall_narrow_part_07, 50_random_XiNsmall_narrow_part_08, 50_random_XiNsmall_narrow_part_09, 50_random_XiNsmall_part_00, 50_random_XiNsmall_part_01, 50_random_XiNsmall_part_02, 50_random_XiNsmall_part_03, 50_random_XiNsmall_part_04, 50_random_XiNsmall_part_05, 50_random_XiNsmall_part_06, 50_random_XiNsmall_part_07, 50_random_XiNsmall_part_08, 50_random_XiNsmall_part_09, 50_random_x1small_part_00, 50_random_x1small_part_01, 50_random_x1small_part_02, 50_random_x1small_part_03, 50_random_x1small_part_04, 50_random_x1small_part_05, 50_random_x1small_part_06, 50_random_x1small_part_07, 50_random_x1small_part_08, 50_random_x1small_part_09, 80_hand_part_01, 80_hand_part_02, 80_hand_part_03, 80_hand_part_04, 80_hand_part_05, 80_hand_part_06, 80_hand_part_07, 80_hand_part_08, 80_hand_part_11, 80_hand_part_12, 98_challenge_part_00, 98_challenge_part_01, 98_challenge_part_02, 98_challenge_part_03, 98_challenge_part_04, 98_challenge_part_05 |
All | 00_sample_06, 00_sample_part_00, 00_sample_part_01, 00_sample_part_02, 00_sample_part_03, 00_sample_part_04, 00_sample_part_05, 50_random_NLsmall_part_00, 50_random_NLsmall_part_01, 50_random_NLsmall_part_02, 50_random_NLsmall_part_03, 50_random_NLsmall_part_04, 50_random_NLsmall_part_05, 50_random_NLsmall_part_06, 50_random_NLsmall_part_07, 50_random_NLsmall_part_08, 50_random_NLsmall_part_09, 50_random_XiNsmall_00, 50_random_XiNsmall_01, 50_random_XiNsmall_02, 50_random_XiNsmall_03, 50_random_XiNsmall_04, 50_random_XiNsmall_05, 50_random_XiNsmall_06, 50_random_XiNsmall_07, 50_random_XiNsmall_08, 50_random_XiNsmall_09, 50_random_XiNsmall_narrow_part_00, 50_random_XiNsmall_narrow_part_01, 50_random_XiNsmall_narrow_part_02, 50_random_XiNsmall_narrow_part_03, 50_random_XiNsmall_narrow_part_04, 50_random_XiNsmall_narrow_part_05, 50_random_XiNsmall_narrow_part_06, 50_random_XiNsmall_narrow_part_07, 50_random_XiNsmall_narrow_part_08, 50_random_XiNsmall_narrow_part_09, 50_random_XiNsmall_part_00, 50_random_XiNsmall_part_01, 50_random_XiNsmall_part_02, 50_random_XiNsmall_part_03, 50_random_XiNsmall_part_04, 50_random_XiNsmall_part_05, 50_random_XiNsmall_part_06, 50_random_XiNsmall_part_07, 50_random_XiNsmall_part_08, 50_random_XiNsmall_part_09, 50_random_Xilarge_00, 50_random_Xilarge_01, 50_random_Xilarge_02, 50_random_Xilarge_03, 50_random_Xilarge_04, 50_random_Xilarge_05, 50_random_Xilarge_06, 50_random_Xilarge_07, 50_random_Xilarge_08, 50_random_Xilarge_09, 50_random_Xilarge_narrow_00, 50_random_Xilarge_narrow_01, 50_random_Xilarge_narrow_02, 50_random_Xilarge_narrow_03, 50_random_Xilarge_narrow_04, 50_random_Xilarge_narrow_05, 50_random_Xilarge_narrow_06, 50_random_Xilarge_narrow_07, 50_random_Xilarge_narrow_08, 50_random_Xilarge_narrow_09, 50_random_x0small_00, 50_random_x0small_01, 50_random_x0small_02, 50_random_x0small_03, 50_random_x0small_04, 50_random_x0small_05, 50_random_x0small_06, 50_random_x0small_07, 50_random_x0small_08, 50_random_x0small_09, 50_random_x1small_part_00, 50_random_x1small_part_01, 50_random_x1small_part_02, 50_random_x1small_part_03, 50_random_x1small_part_04, 50_random_x1small_part_05, 50_random_x1small_part_06, 50_random_x1small_part_07, 50_random_x1small_part_08, 50_random_x1small_part_09, 80_hand_09, 80_hand_10, 80_hand_part_01, 80_hand_part_02, 80_hand_part_03, 80_hand_part_04, 80_hand_part_05, 80_hand_part_06, 80_hand_part_07, 80_hand_part_08, 80_hand_part_11, 80_hand_part_12, 90_max_no_00, 90_max_no_01, 90_max_yes_00, 90_max_yes_01, 98_challenge_part_00, 98_challenge_part_01, 98_challenge_part_02, 98_challenge_part_03, 98_challenge_part_04, 98_challenge_part_05 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_06 | AC | 2 ms | 256 KB |
00_sample_part_00 | AC | 1 ms | 256 KB |
00_sample_part_01 | AC | 1 ms | 256 KB |
00_sample_part_02 | AC | 1 ms | 256 KB |
00_sample_part_03 | AC | 1 ms | 256 KB |
00_sample_part_04 | AC | 1 ms | 256 KB |
00_sample_part_05 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_00 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_01 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_02 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_03 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_04 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_05 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_06 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_07 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_08 | AC | 1 ms | 256 KB |
50_random_NLsmall_part_09 | AC | 1 ms | 256 KB |
50_random_XiNsmall_00 | AC | 1 ms | 256 KB |
50_random_XiNsmall_01 | AC | 1 ms | 256 KB |
50_random_XiNsmall_02 | AC | 1 ms | 256 KB |
50_random_XiNsmall_03 | AC | 1 ms | 256 KB |
50_random_XiNsmall_04 | AC | 1 ms | 256 KB |
50_random_XiNsmall_05 | AC | 1 ms | 256 KB |
50_random_XiNsmall_06 | AC | 1 ms | 256 KB |
50_random_XiNsmall_07 | AC | 1 ms | 256 KB |
50_random_XiNsmall_08 | AC | 1 ms | 256 KB |
50_random_XiNsmall_09 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_00 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_01 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_02 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_03 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_04 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_05 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_06 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_07 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_08 | AC | 1 ms | 256 KB |
50_random_XiNsmall_narrow_part_09 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_00 | AC | 2 ms | 256 KB |
50_random_XiNsmall_part_01 | AC | 2 ms | 256 KB |
50_random_XiNsmall_part_02 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_03 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_04 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_05 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_06 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_07 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_08 | AC | 1 ms | 256 KB |
50_random_XiNsmall_part_09 | AC | 2 ms | 256 KB |
50_random_Xilarge_00 | AC | 13 ms | 512 KB |
50_random_Xilarge_01 | AC | 7 ms | 384 KB |
50_random_Xilarge_02 | AC | 35 ms | 896 KB |
50_random_Xilarge_03 | AC | 16 ms | 512 KB |
50_random_Xilarge_04 | AC | 7 ms | 384 KB |
50_random_Xilarge_05 | AC | 38 ms | 1024 KB |
50_random_Xilarge_06 | AC | 9 ms | 384 KB |
50_random_Xilarge_07 | AC | 37 ms | 896 KB |
50_random_Xilarge_08 | AC | 24 ms | 768 KB |
50_random_Xilarge_09 | AC | 22 ms | 640 KB |
50_random_Xilarge_narrow_00 | AC | 36 ms | 896 KB |
50_random_Xilarge_narrow_01 | AC | 33 ms | 896 KB |
50_random_Xilarge_narrow_02 | AC | 10 ms | 384 KB |
50_random_Xilarge_narrow_03 | AC | 12 ms | 512 KB |
50_random_Xilarge_narrow_04 | AC | 10 ms | 384 KB |
50_random_Xilarge_narrow_05 | AC | 32 ms | 896 KB |
50_random_Xilarge_narrow_06 | AC | 16 ms | 512 KB |
50_random_Xilarge_narrow_07 | AC | 10 ms | 384 KB |
50_random_Xilarge_narrow_08 | AC | 25 ms | 768 KB |
50_random_Xilarge_narrow_09 | AC | 16 ms | 512 KB |
50_random_x0small_00 | AC | 24 ms | 768 KB |
50_random_x0small_01 | AC | 13 ms | 512 KB |
50_random_x0small_02 | AC | 29 ms | 768 KB |
50_random_x0small_03 | AC | 32 ms | 896 KB |
50_random_x0small_04 | AC | 18 ms | 512 KB |
50_random_x0small_05 | AC | 35 ms | 896 KB |
50_random_x0small_06 | AC | 8 ms | 384 KB |
50_random_x0small_07 | AC | 31 ms | 896 KB |
50_random_x0small_08 | AC | 36 ms | 896 KB |
50_random_x0small_09 | AC | 24 ms | 640 KB |
50_random_x1small_part_00 | AC | 2 ms | 256 KB |
50_random_x1small_part_01 | AC | 2 ms | 256 KB |
50_random_x1small_part_02 | AC | 1 ms | 256 KB |
50_random_x1small_part_03 | AC | 1 ms | 256 KB |
50_random_x1small_part_04 | AC | 1 ms | 256 KB |
50_random_x1small_part_05 | AC | 1 ms | 256 KB |
50_random_x1small_part_06 | AC | 1 ms | 256 KB |
50_random_x1small_part_07 | AC | 2 ms | 256 KB |
50_random_x1small_part_08 | AC | 1 ms | 256 KB |
50_random_x1small_part_09 | AC | 1 ms | 256 KB |
80_hand_09 | AC | 3 ms | 384 KB |
80_hand_10 | AC | 3 ms | 384 KB |
80_hand_part_01 | AC | 1 ms | 256 KB |
80_hand_part_02 | AC | 1 ms | 256 KB |
80_hand_part_03 | AC | 1 ms | 256 KB |
80_hand_part_04 | AC | 1 ms | 256 KB |
80_hand_part_05 | AC | 1 ms | 256 KB |
80_hand_part_06 | AC | 1 ms | 256 KB |
80_hand_part_07 | AC | 1 ms | 256 KB |
80_hand_part_08 | AC | 1 ms | 256 KB |
80_hand_part_11 | AC | 1 ms | 256 KB |
80_hand_part_12 | AC | 1 ms | 256 KB |
90_max_no_00 | AC | 40 ms | 1024 KB |
90_max_no_01 | AC | 40 ms | 1024 KB |
90_max_yes_00 | AC | 55 ms | 3188 KB |
90_max_yes_01 | AC | 55 ms | 3188 KB |
98_challenge_part_00 | AC | 1 ms | 256 KB |
98_challenge_part_01 | AC | 1 ms | 256 KB |
98_challenge_part_02 | AC | 1 ms | 256 KB |
98_challenge_part_03 | AC | 1 ms | 256 KB |
98_challenge_part_04 | AC | 1 ms | 256 KB |
98_challenge_part_05 | AC | 1 ms | 256 KB |