답안 #205293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
205293 2020-02-28T13:02:52 Z kshitij_sodani Bali Sculptures (APIO15_sculpture) C++17
16 / 100
1000 ms 129528 KB
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl "\n"
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,a,b;
	cin>>n>>a>>b;
	int it[n];
	for(int i=0;i<n;i++){
		cin>>it[i];
	}
	int sa=n*33;
	int dp[n][n][sa];
	memset(dp,0,sizeof(dp));
/*	vector<int> mm[sa];
	vector<int> nn[sa];
	for(int mask=0;mask<sa;mask++){
		for(int submask = mask; ; submask = (submask - 1) & mask) {
	        mm[mask].pb(submask);
	        nn[submask].pb(mask);
	        if(submask == 0) break;
		}
	}*/
	

	dp[0][0][it[0]]=1;
	/*for(int i=0;i<mm[it[0]].size();i++){
		dp[0][0][mm[it[0]]][i]=1;
	}*/
	int pre[n];
	pre[0]=it[0];
	for(int i=1;i<n;i++){
		pre[i]=pre[i-1]+it[i];
	}
	
	for(int i=1;i<n;i++){

		for(int j=0;j<i+1;j++){
			if(j==0){
				dp[i][0][pre[i]]=1;
				/*if(pre[i]==0){
					//cout<<i<<" "<<j<<endl;
				}*/
				continue;
			}
			for(int k=0;k<i;k++){
				for(int l=0;l<sa;l++){
					if(dp[k][j-1][l]==1){
						int no=(pre[i]-pre[k])|l;
						/*if(no==0){
							//cout<<"NNNNNNNNNNN"<<endl;
						}*/
						dp[i][j][no]=1;
					//	//cout<<no<<endl;
						/*if(i==n-1){
							//cout<<no<<endl;
							

						}*/
					}
				}
			}
		}
	//	//cout<<dp[5][1][0]<<":::::::::::::::::"<<endl;
	}
	int ma=sa;
	for(int i=a-1;i<b;i++){
		for(int j=0;j<sa;j++){
			////cout<<n-1<<" "<<i<<" "<<j<<" "<<dp[n-1][i][j]<<endl;
			if(dp[n-1][i][j]==1){
				/*if(j<ma){
					//cout<<i<<" "<<j<<endl;
				}*/
				ma=min(ma,j);
			}
		}
	}
	cout<<ma<<endl;
	/*int nno=8|3;
	//cout<<nno<<endl;
 
 
 */
 
 
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 760 KB Output is correct
7 Correct 7 ms 936 KB Output is correct
8 Correct 7 ms 1400 KB Output is correct
9 Correct 7 ms 1404 KB Output is correct
10 Correct 7 ms 1404 KB Output is correct
11 Correct 7 ms 1400 KB Output is correct
12 Correct 7 ms 1400 KB Output is correct
13 Correct 7 ms 1400 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 380 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 504 KB Output is correct
19 Correct 5 ms 760 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 7 ms 1400 KB Output is correct
22 Correct 7 ms 1404 KB Output is correct
23 Correct 7 ms 1400 KB Output is correct
24 Correct 7 ms 1400 KB Output is correct
25 Correct 6 ms 1400 KB Output is correct
26 Correct 7 ms 1400 KB Output is correct
27 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 760 KB Output is correct
7 Correct 6 ms 1016 KB Output is correct
8 Correct 7 ms 1400 KB Output is correct
9 Correct 7 ms 1400 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 7 ms 1400 KB Output is correct
12 Correct 7 ms 1400 KB Output is correct
13 Correct 7 ms 1400 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 380 KB Output is correct
18 Correct 5 ms 504 KB Output is correct
19 Correct 6 ms 760 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 7 ms 1400 KB Output is correct
22 Correct 7 ms 1400 KB Output is correct
23 Correct 6 ms 1404 KB Output is correct
24 Correct 7 ms 1400 KB Output is correct
25 Correct 7 ms 1400 KB Output is correct
26 Correct 7 ms 1400 KB Output is correct
27 Correct 8 ms 1528 KB Output is correct
28 Correct 10 ms 2552 KB Output is correct
29 Correct 28 ms 7416 KB Output is correct
30 Correct 41 ms 9848 KB Output is correct
31 Correct 76 ms 16504 KB Output is correct
32 Correct 78 ms 16504 KB Output is correct
33 Correct 76 ms 16504 KB Output is correct
34 Correct 74 ms 16504 KB Output is correct
35 Correct 82 ms 16632 KB Output is correct
36 Correct 77 ms 16504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 6 ms 760 KB Output is correct
7 Correct 6 ms 888 KB Output is correct
8 Correct 7 ms 1400 KB Output is correct
9 Correct 6 ms 1400 KB Output is correct
10 Correct 7 ms 1400 KB Output is correct
11 Correct 7 ms 1400 KB Output is correct
12 Correct 7 ms 1404 KB Output is correct
13 Correct 7 ms 1400 KB Output is correct
14 Correct 7 ms 1528 KB Output is correct
15 Correct 9 ms 2296 KB Output is correct
16 Correct 29 ms 7416 KB Output is correct
17 Correct 42 ms 9944 KB Output is correct
18 Correct 76 ms 16504 KB Output is correct
19 Correct 75 ms 16504 KB Output is correct
20 Correct 76 ms 16504 KB Output is correct
21 Correct 74 ms 16504 KB Output is correct
22 Correct 75 ms 16504 KB Output is correct
23 Correct 75 ms 16504 KB Output is correct
24 Correct 83 ms 17400 KB Output is correct
25 Correct 205 ms 35832 KB Output is correct
26 Correct 432 ms 61560 KB Output is correct
27 Correct 786 ms 97784 KB Output is correct
28 Execution timed out 1085 ms 129528 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 760 KB Output is correct
7 Correct 6 ms 1016 KB Output is correct
8 Correct 6 ms 1400 KB Output is correct
9 Correct 7 ms 1400 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 7 ms 1400 KB Output is correct
12 Correct 7 ms 1400 KB Output is correct
13 Correct 7 ms 1400 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 6 ms 760 KB Output is correct
20 Correct 6 ms 1016 KB Output is correct
21 Correct 7 ms 1400 KB Output is correct
22 Correct 7 ms 1400 KB Output is correct
23 Correct 7 ms 1404 KB Output is correct
24 Correct 7 ms 1400 KB Output is correct
25 Correct 7 ms 1400 KB Output is correct
26 Correct 6 ms 1400 KB Output is correct
27 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 6 ms 760 KB Output is correct
7 Correct 6 ms 1016 KB Output is correct
8 Correct 6 ms 1400 KB Output is correct
9 Correct 6 ms 1400 KB Output is correct
10 Correct 7 ms 1400 KB Output is correct
11 Correct 7 ms 1400 KB Output is correct
12 Correct 6 ms 1404 KB Output is correct
13 Correct 7 ms 1400 KB Output is correct
14 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -