Submission #124578

#TimeUsernameProblemLanguageResultExecution timeMemory
124578streifiOrchard (NOI14_orchard)C++14
0 / 25
1069 ms6228 KiB
#include <iostream> #include <vector> using namespace std; const int INF = 0x3f3f3f3f; signed main() { int N, M; cin >> N >> M; vector<int> cum(M+2, 0); for (int m = 0; m < M; ++m) { int X; cin >> X; cum[m+1] = cum[m]+X; } cum[M+1] = cum[M]; int fee = INF; for (int i = 0; i <= M; ++i) { for (int j = i+1; j <= M+1; ++j) { int a = cum[i]; int b = (j-i)-(cum[j]-cum[i]); cout << b << endl; int c = cum[M+1]-cum[j]; fee = min(fee, a+b+c); } } cout << fee << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...