#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a)
cin >> i;
int mx = 1;
for (int mk = 0; mk < 1 << n; mk++) {
int cnt = 0;
ll pre_sm = -1, sm = 0;
for (int i = 0; i < n; i++) {
if (!i || (((mk >> i) & 1) != ((mk >> (i - 1)) & 1))) {
if (pre_sm > sm) {
cnt = 0; break;
}
cnt++;
pre_sm = sm; sm = 0;
}
sm += a[i];
}
if (pre_sm <= sm) mx = max(mx, cnt);
}
cout << mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
452 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
452 KB |
Output is correct |
9 |
Correct |
11 ms |
452 KB |
Output is correct |
10 |
Correct |
10 ms |
464 KB |
Output is correct |
11 |
Correct |
15 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
13 ms |
348 KB |
Output is correct |
14 |
Correct |
21 ms |
344 KB |
Output is correct |
15 |
Correct |
13 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
452 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
452 KB |
Output is correct |
9 |
Correct |
11 ms |
452 KB |
Output is correct |
10 |
Correct |
10 ms |
464 KB |
Output is correct |
11 |
Correct |
15 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
13 ms |
348 KB |
Output is correct |
14 |
Correct |
21 ms |
344 KB |
Output is correct |
15 |
Correct |
13 ms |
348 KB |
Output is correct |
16 |
Correct |
8 ms |
344 KB |
Output is correct |
17 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
452 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
452 KB |
Output is correct |
9 |
Correct |
11 ms |
452 KB |
Output is correct |
10 |
Correct |
10 ms |
464 KB |
Output is correct |
11 |
Correct |
15 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
13 ms |
348 KB |
Output is correct |
14 |
Correct |
21 ms |
344 KB |
Output is correct |
15 |
Correct |
13 ms |
348 KB |
Output is correct |
16 |
Correct |
8 ms |
344 KB |
Output is correct |
17 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
452 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
452 KB |
Output is correct |
9 |
Correct |
11 ms |
452 KB |
Output is correct |
10 |
Correct |
10 ms |
464 KB |
Output is correct |
11 |
Correct |
15 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
13 ms |
348 KB |
Output is correct |
14 |
Correct |
21 ms |
344 KB |
Output is correct |
15 |
Correct |
13 ms |
348 KB |
Output is correct |
16 |
Correct |
8 ms |
344 KB |
Output is correct |
17 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
452 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
452 KB |
Output is correct |
9 |
Correct |
11 ms |
452 KB |
Output is correct |
10 |
Correct |
10 ms |
464 KB |
Output is correct |
11 |
Correct |
15 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
13 ms |
348 KB |
Output is correct |
14 |
Correct |
21 ms |
344 KB |
Output is correct |
15 |
Correct |
13 ms |
348 KB |
Output is correct |
16 |
Correct |
8 ms |
344 KB |
Output is correct |
17 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |