Submission #443759

# Submission time Handle Problem Language Result Execution time Memory
443759 2021-07-12T03:13:01 Z impri Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1000 ms 452 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=10;place>=0;place--){
    memset(dp,-1,sizeof(dp));
    if(!get(1,0)){
        res+=(1LL << place);
    }

}
cout << res;
}
# Verdict Execution time Memory 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 276 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 7 ms 332 KB Output is correct
8 Correct 54 ms 332 KB Output is correct
9 Correct 66 ms 352 KB Output is correct
10 Correct 62 ms 332 KB Output is correct
11 Correct 45 ms 332 KB Output is correct
12 Correct 55 ms 332 KB Output is correct
13 Correct 56 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 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 2 ms 332 KB Output is correct
20 Correct 9 ms 332 KB Output is correct
21 Correct 58 ms 332 KB Output is correct
22 Correct 46 ms 332 KB Output is correct
23 Correct 52 ms 452 KB Output is correct
24 Correct 45 ms 332 KB Output is correct
25 Correct 60 ms 332 KB Output is correct
26 Correct 51 ms 332 KB Output is correct
27 Incorrect 0 ms 332 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 2 ms 332 KB Output is correct
7 Correct 7 ms 352 KB Output is correct
8 Correct 57 ms 332 KB Output is correct
9 Correct 52 ms 332 KB Output is correct
10 Correct 48 ms 332 KB Output is correct
11 Correct 45 ms 332 KB Output is correct
12 Correct 70 ms 332 KB Output is correct
13 Correct 71 ms 364 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 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 2 ms 332 KB Output is correct
20 Correct 6 ms 332 KB Output is correct
21 Correct 51 ms 332 KB Output is correct
22 Correct 45 ms 332 KB Output is correct
23 Correct 46 ms 332 KB Output is correct
24 Correct 49 ms 340 KB Output is correct
25 Correct 58 ms 332 KB Output is correct
26 Correct 52 ms 332 KB Output is correct
27 Correct 104 ms 332 KB Output is correct
28 Execution timed out 1096 ms 332 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 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 2 ms 332 KB Output is correct
7 Correct 7 ms 332 KB Output is correct
8 Correct 54 ms 340 KB Output is correct
9 Correct 53 ms 332 KB Output is correct
10 Correct 49 ms 332 KB Output is correct
11 Correct 47 ms 332 KB Output is correct
12 Correct 57 ms 332 KB Output is correct
13 Correct 55 ms 332 KB Output is correct
14 Correct 103 ms 332 KB Output is correct
15 Execution timed out 1096 ms 332 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 2 ms 332 KB Output is correct
7 Correct 7 ms 332 KB Output is correct
8 Correct 53 ms 332 KB Output is correct
9 Correct 53 ms 332 KB Output is correct
10 Correct 57 ms 332 KB Output is correct
11 Correct 46 ms 340 KB Output is correct
12 Correct 57 ms 336 KB Output is correct
13 Correct 55 ms 452 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 0 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 2 ms 332 KB Output is correct
20 Correct 8 ms 332 KB Output is correct
21 Correct 55 ms 332 KB Output is correct
22 Correct 45 ms 332 KB Output is correct
23 Correct 48 ms 332 KB Output is correct
24 Correct 47 ms 332 KB Output is correct
25 Correct 60 ms 332 KB Output is correct
26 Correct 53 ms 332 KB Output is correct
27 Incorrect 0 ms 332 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 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 2 ms 332 KB Output is correct
7 Correct 7 ms 332 KB Output is correct
8 Correct 58 ms 340 KB Output is correct
9 Correct 60 ms 332 KB Output is correct
10 Correct 48 ms 332 KB Output is correct
11 Correct 46 ms 332 KB Output is correct
12 Correct 57 ms 332 KB Output is correct
13 Correct 61 ms 332 KB Output is correct
14 Incorrect 0 ms 332 KB Output isn't correct
15 Halted 0 ms 0 KB -