#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, mx = 0;
cin >> n;
vector<int>v(n);
for(int i = 0;i < n;++i)cin >> v[i];
for(int i = 1;i < (1 << n);i += 2){
int temp = 0;
vector<int>S;
for(int j = 0;j < n;++j){
if(i & (1 << j)){
temp += v[j];
}
else{
S.push_back(temp);
temp = v[j];
}
}
S.push_back(temp);
bool check = 1;
int sz = S.size();
for(int j = 1;j < sz && check;++j){
if(S[j - 1] > S[j])check = 0;
}
if(check){
mx = max(mx, sz);
}
}
cout << mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
104 ms |
280 KB |
Output is correct |
5 |
Correct |
115 ms |
276 KB |
Output is correct |
6 |
Correct |
118 ms |
284 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
104 ms |
212 KB |
Output is correct |
10 |
Correct |
117 ms |
288 KB |
Output is correct |
11 |
Correct |
106 ms |
212 KB |
Output is correct |
12 |
Correct |
103 ms |
276 KB |
Output is correct |
13 |
Correct |
106 ms |
212 KB |
Output is correct |
14 |
Correct |
113 ms |
280 KB |
Output is correct |
15 |
Correct |
108 ms |
284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
104 ms |
280 KB |
Output is correct |
5 |
Correct |
115 ms |
276 KB |
Output is correct |
6 |
Correct |
118 ms |
284 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
104 ms |
212 KB |
Output is correct |
10 |
Correct |
117 ms |
288 KB |
Output is correct |
11 |
Correct |
106 ms |
212 KB |
Output is correct |
12 |
Correct |
103 ms |
276 KB |
Output is correct |
13 |
Correct |
106 ms |
212 KB |
Output is correct |
14 |
Correct |
113 ms |
280 KB |
Output is correct |
15 |
Correct |
108 ms |
284 KB |
Output is correct |
16 |
Incorrect |
635 ms |
284 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
104 ms |
280 KB |
Output is correct |
5 |
Correct |
115 ms |
276 KB |
Output is correct |
6 |
Correct |
118 ms |
284 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
104 ms |
212 KB |
Output is correct |
10 |
Correct |
117 ms |
288 KB |
Output is correct |
11 |
Correct |
106 ms |
212 KB |
Output is correct |
12 |
Correct |
103 ms |
276 KB |
Output is correct |
13 |
Correct |
106 ms |
212 KB |
Output is correct |
14 |
Correct |
113 ms |
280 KB |
Output is correct |
15 |
Correct |
108 ms |
284 KB |
Output is correct |
16 |
Incorrect |
635 ms |
284 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
104 ms |
280 KB |
Output is correct |
5 |
Correct |
115 ms |
276 KB |
Output is correct |
6 |
Correct |
118 ms |
284 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
104 ms |
212 KB |
Output is correct |
10 |
Correct |
117 ms |
288 KB |
Output is correct |
11 |
Correct |
106 ms |
212 KB |
Output is correct |
12 |
Correct |
103 ms |
276 KB |
Output is correct |
13 |
Correct |
106 ms |
212 KB |
Output is correct |
14 |
Correct |
113 ms |
280 KB |
Output is correct |
15 |
Correct |
108 ms |
284 KB |
Output is correct |
16 |
Incorrect |
635 ms |
284 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
104 ms |
280 KB |
Output is correct |
5 |
Correct |
115 ms |
276 KB |
Output is correct |
6 |
Correct |
118 ms |
284 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
104 ms |
212 KB |
Output is correct |
10 |
Correct |
117 ms |
288 KB |
Output is correct |
11 |
Correct |
106 ms |
212 KB |
Output is correct |
12 |
Correct |
103 ms |
276 KB |
Output is correct |
13 |
Correct |
106 ms |
212 KB |
Output is correct |
14 |
Correct |
113 ms |
280 KB |
Output is correct |
15 |
Correct |
108 ms |
284 KB |
Output is correct |
16 |
Incorrect |
635 ms |
284 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |