#include<bits/stdc++.h>
#define ll long long
using namespace std ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
ll n, ans = 0 ;
cin >> n ;
ll a[n + 1] ;
for(ll i = 0 ; i < n ; i++)
cin >> a[i] ;
if(n <= 20)
{
for(ll i = 0 ; i < (1 << n) ; i++)
{
bool flag = 0 ;
ll kol = 0, sum = 0, ls = 0 ;
for(ll j = 0 ; j < n ; j++)
{
sum += a[j] ;
if((1 << j) & i)
{
if(ls > sum)
{
flag = 1 ;
break ;
}
kol++ ;
ls = sum ;
sum = 0 ;
}
}
if(!flag)ans = max(ans, kol) ;
}
}
cout << ans ;
return 0 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
7 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
320 KB |
Output is correct |
6 |
Correct |
16 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
10 ms |
320 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
16 ms |
324 KB |
Output is correct |
12 |
Correct |
12 ms |
212 KB |
Output is correct |
13 |
Correct |
11 ms |
320 KB |
Output is correct |
14 |
Correct |
20 ms |
212 KB |
Output is correct |
15 |
Correct |
12 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
7 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
320 KB |
Output is correct |
6 |
Correct |
16 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
10 ms |
320 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
16 ms |
324 KB |
Output is correct |
12 |
Correct |
12 ms |
212 KB |
Output is correct |
13 |
Correct |
11 ms |
320 KB |
Output is correct |
14 |
Correct |
20 ms |
212 KB |
Output is correct |
15 |
Correct |
12 ms |
320 KB |
Output is correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
7 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
320 KB |
Output is correct |
6 |
Correct |
16 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
10 ms |
320 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
16 ms |
324 KB |
Output is correct |
12 |
Correct |
12 ms |
212 KB |
Output is correct |
13 |
Correct |
11 ms |
320 KB |
Output is correct |
14 |
Correct |
20 ms |
212 KB |
Output is correct |
15 |
Correct |
12 ms |
320 KB |
Output is correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
7 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
320 KB |
Output is correct |
6 |
Correct |
16 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
10 ms |
320 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
16 ms |
324 KB |
Output is correct |
12 |
Correct |
12 ms |
212 KB |
Output is correct |
13 |
Correct |
11 ms |
320 KB |
Output is correct |
14 |
Correct |
20 ms |
212 KB |
Output is correct |
15 |
Correct |
12 ms |
320 KB |
Output is correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
7 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
320 KB |
Output is correct |
6 |
Correct |
16 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
10 ms |
320 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
16 ms |
324 KB |
Output is correct |
12 |
Correct |
12 ms |
212 KB |
Output is correct |
13 |
Correct |
11 ms |
320 KB |
Output is correct |
14 |
Correct |
20 ms |
212 KB |
Output is correct |
15 |
Correct |
12 ms |
320 KB |
Output is correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |