# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51212 | 2018-06-17T08:46:03 Z | robert | Orchard (NOI14_orchard) | C++14 | 203 ms | 740 KB |
#include <iostream> using namespace std; int main(){ int N, M; cin>>N>>M; int f[160][5100]; int cur = 0, toto = 0, maxs = 0, len = 0, curl=0, curo = 0; int o =0; int a; for(int x=0; x<M; x++){ cin>>a; curl++; if(a==1){ curo++; cur++; toto++; } else { cur--; } if(cur<0) cur = curl = curo = 0; if(cur>maxs){ maxs = cur; o=curo; len = curl; } } // cout << toto << " " << o << endl; cout << toto-o + (len-o) << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 452 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 516 KB | Output is correct |
2 | Correct | 5 ms | 536 KB | Output is correct |
3 | Correct | 5 ms | 536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 187 ms | 596 KB | Output is correct |
2 | Correct | 187 ms | 740 KB | Output is correct |
3 | Correct | 203 ms | 740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |