답안 #49552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49552 2018-05-31T07:37:07 Z hamzqq9 Bali Sculptures (APIO15_sculpture) C++14
37 / 100
40 ms 5028 KB
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define cc pair<char,char>
#define ull unsigned ll
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define iiii2 pair<int,iii>
#define lii pair<ll,ii>
#define lolo pair<ll,ll>
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 1000000005
#define M 10000002
#define N 2005
#define LOG 59
#define magic 100
#define KOK 250
#define EPS 0.0025
#define pw(x) ((1ll)<<(x))
#define PI 3.1415926535
using namespace std;

int n,a,b;
int ar[N];
bool dp[N][N];
vector<int> v[N];

bool ok(int val) {

	for(int i=1;i<=n;i++) {

		v[i-1].clear();

		ll sum=0;

		for(int j=i-1;j>=0;j--) {

			sum+=ar[j+1];

			if((sum|val)==val) v[j].pb(i);

		}

	}

	memset(dp,0,sizeof(dp));

	dp[0][0]=1;

	for(int l=1;l<=n;l++) {

		for(int i=0;i<=n;i++) {

			if(dp[l-1][i]) {

				for(int ind:v[i]) {

					dp[l][ind]=1;

				}

			}

		}

	}

	for(int i=a;i<=b;i++) if(dp[i][n]) return true;

	return false;

}

int main() {
 
 	#if 0
	freopen("input.txt","r",stdin);
 	#endif

	scanf("%d %d %d",&n,&a,&b);

	for(int i=1;i<=n;i++) {

		scanf("%d",&ar[i]);

	}

	ll full=pw(60)-1;

	for(int i=LOG;i>=0;i--) {

		full-=pw(i);

		if(!ok(full)) full+=pw(i);

	}

	printf("%lld",full);

}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:100:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&a,&b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:104:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&ar[i]);
   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 4344 KB Output is correct
2 Correct 16 ms 4424 KB Output is correct
3 Correct 19 ms 4424 KB Output is correct
4 Correct 18 ms 4436 KB Output is correct
5 Correct 18 ms 4480 KB Output is correct
6 Correct 18 ms 4480 KB Output is correct
7 Correct 17 ms 4480 KB Output is correct
8 Correct 18 ms 4480 KB Output is correct
9 Correct 17 ms 4596 KB Output is correct
10 Correct 17 ms 4608 KB Output is correct
11 Correct 16 ms 4608 KB Output is correct
12 Correct 16 ms 4608 KB Output is correct
13 Correct 18 ms 4608 KB Output is correct
14 Correct 17 ms 4608 KB Output is correct
15 Correct 16 ms 4608 KB Output is correct
16 Correct 18 ms 4684 KB Output is correct
17 Correct 18 ms 4684 KB Output is correct
18 Correct 21 ms 4684 KB Output is correct
19 Correct 19 ms 4684 KB Output is correct
20 Correct 20 ms 4684 KB Output is correct
21 Correct 18 ms 4684 KB Output is correct
22 Correct 18 ms 4684 KB Output is correct
23 Correct 21 ms 4712 KB Output is correct
24 Correct 19 ms 4716 KB Output is correct
25 Correct 18 ms 4720 KB Output is correct
26 Correct 20 ms 4724 KB Output is correct
27 Correct 18 ms 4728 KB Output is correct
28 Correct 18 ms 4732 KB Output is correct
29 Correct 18 ms 4736 KB Output is correct
30 Incorrect 19 ms 4740 KB Output isn't correct
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 4744 KB Output is correct
2 Correct 18 ms 4744 KB Output is correct
3 Correct 19 ms 4744 KB Output is correct
4 Correct 18 ms 4764 KB Output is correct
5 Correct 19 ms 4764 KB Output is correct
6 Correct 18 ms 4764 KB Output is correct
7 Correct 18 ms 4764 KB Output is correct
8 Correct 18 ms 4764 KB Output is correct
9 Correct 19 ms 4764 KB Output is correct
10 Correct 18 ms 4764 KB Output is correct
11 Correct 18 ms 4764 KB Output is correct
12 Correct 21 ms 4764 KB Output is correct
13 Correct 18 ms 4764 KB Output is correct
14 Correct 18 ms 4880 KB Output is correct
15 Correct 18 ms 4880 KB Output is correct
16 Correct 17 ms 4880 KB Output is correct
17 Correct 18 ms 4880 KB Output is correct
18 Correct 18 ms 4880 KB Output is correct
19 Correct 18 ms 4880 KB Output is correct
20 Correct 19 ms 5028 KB Output is correct
21 Correct 19 ms 5028 KB Output is correct
22 Correct 18 ms 5028 KB Output is correct
23 Correct 18 ms 5028 KB Output is correct
24 Correct 20 ms 5028 KB Output is correct
25 Correct 17 ms 5028 KB Output is correct
26 Correct 17 ms 5028 KB Output is correct
27 Correct 18 ms 5028 KB Output is correct
28 Correct 19 ms 5028 KB Output is correct
29 Correct 20 ms 5028 KB Output is correct
30 Correct 20 ms 5028 KB Output is correct
31 Correct 21 ms 5028 KB Output is correct
32 Correct 24 ms 5028 KB Output is correct
33 Correct 20 ms 5028 KB Output is correct
34 Correct 23 ms 5028 KB Output is correct
35 Correct 19 ms 5028 KB Output is correct
36 Correct 23 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 5028 KB Output is correct
2 Correct 20 ms 5028 KB Output is correct
3 Correct 18 ms 5028 KB Output is correct
4 Correct 18 ms 5028 KB Output is correct
5 Correct 19 ms 5028 KB Output is correct
6 Correct 17 ms 5028 KB Output is correct
7 Correct 18 ms 5028 KB Output is correct
8 Correct 17 ms 5028 KB Output is correct
9 Correct 20 ms 5028 KB Output is correct
10 Correct 19 ms 5028 KB Output is correct
11 Correct 18 ms 5028 KB Output is correct
12 Correct 17 ms 5028 KB Output is correct
13 Correct 18 ms 5028 KB Output is correct
14 Correct 18 ms 5028 KB Output is correct
15 Correct 20 ms 5028 KB Output is correct
16 Correct 18 ms 5028 KB Output is correct
17 Correct 19 ms 5028 KB Output is correct
18 Correct 18 ms 5028 KB Output is correct
19 Correct 24 ms 5028 KB Output is correct
20 Correct 21 ms 5028 KB Output is correct
21 Correct 19 ms 5028 KB Output is correct
22 Correct 21 ms 5028 KB Output is correct
23 Correct 20 ms 5028 KB Output is correct
24 Correct 21 ms 5028 KB Output is correct
25 Correct 22 ms 5028 KB Output is correct
26 Correct 23 ms 5028 KB Output is correct
27 Correct 25 ms 5028 KB Output is correct
28 Correct 28 ms 5028 KB Output is correct
29 Correct 26 ms 5028 KB Output is correct
30 Correct 27 ms 5028 KB Output is correct
31 Correct 29 ms 5028 KB Output is correct
32 Correct 28 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 5028 KB Output is correct
2 Correct 17 ms 5028 KB Output is correct
3 Correct 17 ms 5028 KB Output is correct
4 Correct 18 ms 5028 KB Output is correct
5 Correct 19 ms 5028 KB Output is correct
6 Correct 40 ms 5028 KB Output is correct
7 Correct 17 ms 5028 KB Output is correct
8 Correct 18 ms 5028 KB Output is correct
9 Correct 16 ms 5028 KB Output is correct
10 Correct 17 ms 5028 KB Output is correct
11 Correct 18 ms 5028 KB Output is correct
12 Correct 18 ms 5028 KB Output is correct
13 Correct 18 ms 5028 KB Output is correct
14 Correct 19 ms 5028 KB Output is correct
15 Correct 18 ms 5028 KB Output is correct
16 Correct 18 ms 5028 KB Output is correct
17 Correct 18 ms 5028 KB Output is correct
18 Correct 19 ms 5028 KB Output is correct
19 Correct 18 ms 5028 KB Output is correct
20 Correct 19 ms 5028 KB Output is correct
21 Correct 21 ms 5028 KB Output is correct
22 Correct 20 ms 5028 KB Output is correct
23 Correct 18 ms 5028 KB Output is correct
24 Correct 19 ms 5028 KB Output is correct
25 Correct 19 ms 5028 KB Output is correct
26 Correct 18 ms 5028 KB Output is correct
27 Correct 18 ms 5028 KB Output is correct
28 Correct 18 ms 5028 KB Output is correct
29 Correct 18 ms 5028 KB Output is correct
30 Incorrect 20 ms 5028 KB Output isn't correct
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 5028 KB Output is correct
2 Correct 19 ms 5028 KB Output is correct
3 Correct 19 ms 5028 KB Output is correct
4 Correct 19 ms 5028 KB Output is correct
5 Correct 18 ms 5028 KB Output is correct
6 Correct 18 ms 5028 KB Output is correct
7 Correct 18 ms 5028 KB Output is correct
8 Correct 21 ms 5028 KB Output is correct
9 Correct 18 ms 5028 KB Output is correct
10 Correct 18 ms 5028 KB Output is correct
11 Correct 18 ms 5028 KB Output is correct
12 Correct 18 ms 5028 KB Output is correct
13 Correct 18 ms 5028 KB Output is correct
14 Correct 19 ms 5028 KB Output is correct
15 Correct 19 ms 5028 KB Output is correct
16 Correct 18 ms 5028 KB Output is correct
17 Incorrect 18 ms 5028 KB Output isn't correct
18 Halted 0 ms 0 KB -