Submission #770643

#TimeUsernameProblemLanguageResultExecution timeMemory
770643petezaBigger segments (IZhO19_segments)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; int n; vector<int> vec; int main() { cin.tie(0) -> sync_with_stdio(0); cin >> n; vec.resize(n); for(int &e:vec) cin >> e; int cans = 1; for(int i=1;i<min(50, n);i++) { long long cur = 0; long long sum; int idx = i; for(int j=0;j<i;j++) cur += vec[j]; int curcnt = 1; while(idx < n) { sum = 0; while(idx < n && sum < cur) sum += vec[idx++]; if(sum >= cur) curcnt++; cur = sum; } cans = max(cans, curcnt); } cout << cans; }
#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...