Submission #950649

#TimeUsernameProblemLanguageResultExecution timeMemory
950649IrateOrchard (NOI14_orchard)C++14
13 / 25
66 ms10252 KiB
#include<bits/stdc++.h> using namespace std; const int mxN = 1; const int mxM = 1e6 + 6; int grid[mxM], pref[mxM]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for(int i = 1;i <= m;++i){ cin >> grid[i]; pref[i] = pref[i - 1] + grid[i]; } set<int>s; s.insert(0); int mn = 1e9; for(int i = 1;i <= m;++i){ auto itr = s.begin(); mn = min(mn, i - 2 * pref[i] + pref[m] + 1 + *itr); s.insert(2 * pref[i - 1] - i); } cout << mn; }
#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...