답안 #1002820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1002820 2024-06-19T20:07:36 Z Lalic Cigle (COI21_cigle) C++17
9 / 100
531 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mp make_pair
#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> cd;

const int MAXN = 1e5+10;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);

void solve(){
	int n; cin >> n;
	
	vector<int> arr(n);
	for(auto& u : arr) cin >> u;
	
	int ans=0;
	for(int i=0;i<(1<<(n-1));i++){
		int curr=0, last=-1, res=0;
		for(int j=0;j<n-1;j++){
			curr+=arr[j];
			
			if(!((1<<j)&i)){
				int cnt=last, aux=0;
				while(cnt>0 && (!((1<<cnt)&i) || cnt==last) && aux<curr){
					aux+=arr[cnt--];
				}
				
				if(aux==curr && !((1<<cnt)&i)) res++;
			}
			else{
				last=j;
				curr=0;
			}
		}
		
		ans=max(ans, res);
	}
	
	cout << ans << "\n";
}
	

int32_t main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	int tt=1;
	//~ cin >> tt;
	while(tt--) solve();
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 348 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 40 ms 348 KB Output is correct
4 Correct 38 ms 348 KB Output is correct
5 Correct 42 ms 348 KB Output is correct
6 Correct 38 ms 348 KB Output is correct
7 Correct 37 ms 348 KB Output is correct
8 Correct 38 ms 344 KB Output is correct
9 Correct 38 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 348 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 40 ms 348 KB Output is correct
4 Correct 38 ms 348 KB Output is correct
5 Correct 42 ms 348 KB Output is correct
6 Correct 38 ms 348 KB Output is correct
7 Correct 37 ms 348 KB Output is correct
8 Correct 38 ms 344 KB Output is correct
9 Correct 38 ms 348 KB Output is correct
10 Incorrect 9 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 531 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 348 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 40 ms 348 KB Output is correct
4 Correct 38 ms 348 KB Output is correct
5 Correct 42 ms 348 KB Output is correct
6 Correct 38 ms 348 KB Output is correct
7 Correct 37 ms 348 KB Output is correct
8 Correct 38 ms 344 KB Output is correct
9 Correct 38 ms 348 KB Output is correct
10 Incorrect 9 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 348 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 40 ms 348 KB Output is correct
4 Correct 38 ms 348 KB Output is correct
5 Correct 42 ms 348 KB Output is correct
6 Correct 38 ms 348 KB Output is correct
7 Correct 37 ms 348 KB Output is correct
8 Correct 38 ms 344 KB Output is correct
9 Correct 38 ms 348 KB Output is correct
10 Incorrect 9 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -