Submission #00360
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include <bits/stdc++.h> using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define all(r) begin(r),end(r) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "<<x<<endl #define fcout(n) cout<<fixed<<setprecision((n)) #define scout(n) cout<<setw(n) #define vary(type,name,size,init) vector< type> name(size,init) #define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init)) #define mp(a,b) make_pair(a,b) #define rep(i,n) for(int i = 0; i < (int)(n);++i) #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) #define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it) #define repa(n,array) for(auto &n :(array)) using ll = long long ; using pii = pair< int , int > ; using pll = pair<ll,ll> ; ll p,n; ll v[200001]; int main(){ cin.tie(0); ios::sync_with_stdio( false ); cin >> n >> p; /* p += 1e15; */ ll ans = 0; rep(i,n){ cin >> v[i]; /* v[i] += 1e15; */ } ll sum = 0,r = 0,l = 0; while (r < n){ sum += v[r]; debug(l); ++r; /* if(l < r && sum - v[l] <= p){ */ /* sum -= v[l]; */ /* ++l; */ /* } */ if (sum >= p){ ans = max(ans,r-l); } } std::cout << ans << std::endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - photography |
ユーザー名 | Halksel |
投稿日時 | 2017-07-07 22:59:20 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 1401 Byte |
最大実行時間 | 181 ms |
最大メモリ使用量 | 8448 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01_sample_01.in | WA | 13 ms | 352 KB |
1
|
01_sample_02.in | WA | 11 ms | 436 KB |
1
|
01_sample_03.in | WA | 12 ms | 388 KB |
1
|
01_sample_04.in | WA | 13 ms | 472 KB |
1
|
02_handmake_01.in | WA | 12 ms | 552 KB |
1
|
02_handmake_02.in | WA | 11 ms | 512 KB |
1
|
02_handmake_03.in | WA | 13 ms | 464 KB |
1
|
02_handmake_04.in | WA | 14 ms | 540 KB |
1
|
02_handmake_05.in | WA | 20 ms | 492 KB |
1
|
02_handmake_06.in | WA | 13 ms | 572 KB |
1
|
03_random_01.in | WA | 175 ms | 2572 KB |
1
|
03_random_02.in | WA | 133 ms | 2984 KB |
1
|
03_random_03.in | WA | 147 ms | 3732 KB |
1
|
03_random_04.in | WA | 119 ms | 4136 KB |
1
|
03_random_05.in | WA | 118 ms | 4596 KB |
1
|
03_random_06.in | WA | 132 ms | 5332 KB |
1
|
03_random_07.in | WA | 181 ms | 6588 KB |
1
|
03_random_08.in | WA | 115 ms | 6576 KB |
1
|
03_random_09.in | WA | 180 ms | 7872 KB |
1
|
03_random_10.in | WA | 147 ms | 8448 KB |
1
|