답안 #443760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
443760 2021-07-12T03:13:35 Z impri Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 456 KB
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
int arr[101];
int dp[102][111];
int place;
long long res=0;
int get(int cur,int r){
    if(cur==n+1){
        if(a<=r && r<=b)return 1;
        return 0;
    }
if(dp[cur][r]!=-1)return dp[a][b];
long long sum=0;
int ok=0;
for(int i=cur;i<=n;i++){
    sum+=arr[i];
    if((res >> (place+1))==((res|sum) >> (place+1))){
        if((sum & (1LL << place))==0)
        ok=max(ok,get(i+1,r+1));
    }

}
return dp[a][b]=ok;
}
int main(void){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
cin >>n >> a >> b;
for(int i=1;i<=n;i++)
    cin >> arr[i];
for(place=40;place>=0;place--){
    memset(dp,-1,sizeof(dp));
    if(!get(1,0)){
        res+=(1LL << place);
    }

}
cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 332 KB Output is correct
7 Correct 39 ms 336 KB Output is correct
8 Correct 327 ms 336 KB Output is correct
9 Correct 334 ms 332 KB Output is correct
10 Correct 352 ms 332 KB Output is correct
11 Correct 332 ms 332 KB Output is correct
12 Correct 334 ms 332 KB Output is correct
13 Correct 351 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 10 ms 332 KB Output is correct
20 Correct 41 ms 332 KB Output is correct
21 Correct 335 ms 336 KB Output is correct
22 Correct 338 ms 336 KB Output is correct
23 Correct 386 ms 332 KB Output is correct
24 Correct 343 ms 332 KB Output is correct
25 Correct 321 ms 348 KB Output is correct
26 Correct 339 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 41 ms 336 KB Output is correct
31 Correct 78 ms 332 KB Output is correct
32 Correct 75 ms 348 KB Output is correct
33 Correct 137 ms 332 KB Output is correct
34 Correct 111 ms 332 KB Output is correct
35 Correct 205 ms 336 KB Output is correct
36 Correct 208 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 332 KB Output is correct
7 Correct 39 ms 332 KB Output is correct
8 Correct 322 ms 336 KB Output is correct
9 Correct 326 ms 332 KB Output is correct
10 Correct 338 ms 332 KB Output is correct
11 Correct 311 ms 336 KB Output is correct
12 Correct 322 ms 344 KB Output is correct
13 Correct 329 ms 336 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 11 ms 332 KB Output is correct
20 Correct 39 ms 332 KB Output is correct
21 Correct 327 ms 336 KB Output is correct
22 Correct 314 ms 332 KB Output is correct
23 Correct 323 ms 344 KB Output is correct
24 Correct 310 ms 332 KB Output is correct
25 Correct 335 ms 340 KB Output is correct
26 Correct 304 ms 332 KB Output is correct
27 Correct 636 ms 332 KB Output is correct
28 Execution timed out 1089 ms 332 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 356 KB Output is correct
7 Correct 41 ms 344 KB Output is correct
8 Correct 321 ms 332 KB Output is correct
9 Correct 321 ms 332 KB Output is correct
10 Correct 316 ms 336 KB Output is correct
11 Correct 311 ms 332 KB Output is correct
12 Correct 327 ms 344 KB Output is correct
13 Correct 324 ms 332 KB Output is correct
14 Correct 642 ms 344 KB Output is correct
15 Execution timed out 1091 ms 332 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 356 KB Output is correct
7 Correct 40 ms 332 KB Output is correct
8 Correct 321 ms 332 KB Output is correct
9 Correct 319 ms 336 KB Output is correct
10 Correct 317 ms 456 KB Output is correct
11 Correct 316 ms 452 KB Output is correct
12 Correct 318 ms 332 KB Output is correct
13 Correct 335 ms 336 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 10 ms 356 KB Output is correct
20 Correct 39 ms 332 KB Output is correct
21 Correct 306 ms 332 KB Output is correct
22 Correct 308 ms 332 KB Output is correct
23 Correct 305 ms 452 KB Output is correct
24 Correct 315 ms 332 KB Output is correct
25 Correct 330 ms 332 KB Output is correct
26 Correct 318 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 316 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 41 ms 332 KB Output is correct
31 Correct 75 ms 332 KB Output is correct
32 Correct 74 ms 336 KB Output is correct
33 Correct 128 ms 348 KB Output is correct
34 Correct 111 ms 336 KB Output is correct
35 Correct 202 ms 336 KB Output is correct
36 Correct 204 ms 332 KB Output is correct
37 Correct 635 ms 344 KB Output is correct
38 Execution timed out 1089 ms 332 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 12 ms 348 KB Output is correct
7 Correct 41 ms 332 KB Output is correct
8 Correct 330 ms 332 KB Output is correct
9 Correct 317 ms 332 KB Output is correct
10 Correct 313 ms 332 KB Output is correct
11 Correct 317 ms 332 KB Output is correct
12 Correct 329 ms 340 KB Output is correct
13 Correct 330 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 1 ms 240 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 43 ms 332 KB Output is correct
18 Correct 76 ms 332 KB Output is correct
19 Correct 76 ms 332 KB Output is correct
20 Correct 127 ms 332 KB Output is correct
21 Correct 112 ms 332 KB Output is correct
22 Correct 202 ms 332 KB Output is correct
23 Correct 202 ms 332 KB Output is correct
24 Correct 629 ms 352 KB Output is correct
25 Execution timed out 1097 ms 332 KB Time limit exceeded
26 Halted 0 ms 0 KB -