Submission #535790

#TimeUsernameProblemLanguageResultExecution timeMemory
535790MDSProBigger segments (IZhO19_segments)C++14
0 / 100
1 ms300 KiB
#include <iostream> #include <deque> using namespace std; int main() { int n; cin >> n; int x = 0, ss = 0; long long ls = 0, ns = 0; deque<int> deq; for(int i = 0; i < n; i++){ cin >> x, ns += x, deq.push_front(x); if(ns >= ls){ ++ss; while(ns-2*deq.back() >= ls){ ns -= deq.back(); ls += deq.back(); deq.pop_back(); } ls = ns, ns = 0; deq.erase(deq.begin(),deq.end()); } } cout << ss; }
#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...