# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
21955 | 2017-04-27T19:25:10 Z | mohammad_kilani | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 3236 KB |
#include<bits/stdc++.h> using namespace std; const int N = 111; int n , a , b , arr[N]; bool dp[N][N][50]; bool vis[N][N][50]; bool cantake[N][N]; void printbinary(long long num){ for(int i=32;i>=0;i--){ cout << ((num>>i)&1); } cout << endl; } bool solve(int i,int j,int bit){ if(cantake[i][j] == false) return false; if(j > b) return 0; if(i == n){ if(j >= a) return 1; return 0; } if(vis[i][j][bit]) return dp[i][j][bit]; vis[i][j][bit] = true; long long sum = 0; bool can = false; vector<int> v; for(int k=i;k<n;k++){ sum+=(long long)arr[k]; if(((sum >> (long long)bit)&1) == 0 && solve(k+1,j+1,bit)){ can = true; } else v.push_back(k+1); } if(can){ int si = v.size(); for(int k=0;k<si;k++){ cantake[v[k]][j+1] = false; } } return dp[i][j][bit] = can; } int main(){ //freopen("in.txt","r",stdin); memset(dp,-1,sizeof(dp)); memset(cantake,1,sizeof(cantake)); scanf("%d%d%d",&n,&a,&b); for(int i=0;i<n;i++){ scanf("%d",&arr[i]); } long long ans = 0 ; for(int i=46;i>=0;i--){ if(!solve(0,0,i)){ ans += ((long long)1 << (long long)i); } } cout << ans << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3236 KB | Output is correct |
2 | Correct | 0 ms | 3236 KB | Output is correct |
3 | Correct | 0 ms | 3236 KB | Output is correct |
4 | Correct | 0 ms | 3236 KB | Output is correct |
5 | Correct | 0 ms | 3236 KB | Output is correct |
6 | Incorrect | 0 ms | 3236 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3236 KB | Output is correct |
2 | Correct | 0 ms | 3236 KB | Output is correct |
3 | Correct | 0 ms | 3236 KB | Output is correct |
4 | Correct | 0 ms | 3236 KB | Output is correct |
5 | Correct | 0 ms | 3236 KB | Output is correct |
6 | Incorrect | 0 ms | 3236 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3236 KB | Output is correct |
2 | Correct | 0 ms | 3236 KB | Output is correct |
3 | Correct | 0 ms | 3236 KB | Output is correct |
4 | Correct | 0 ms | 3236 KB | Output is correct |
5 | Correct | 0 ms | 3236 KB | Output is correct |
6 | Incorrect | 0 ms | 3236 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3236 KB | Output is correct |
2 | Correct | 0 ms | 3236 KB | Output is correct |
3 | Correct | 0 ms | 3236 KB | Output is correct |
4 | Correct | 0 ms | 3236 KB | Output is correct |
5 | Correct | 0 ms | 3236 KB | Output is correct |
6 | Incorrect | 0 ms | 3236 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3236 KB | Output is correct |
2 | Correct | 0 ms | 3236 KB | Output is correct |
3 | Correct | 0 ms | 3236 KB | Output is correct |
4 | Correct | 0 ms | 3236 KB | Output is correct |
5 | Correct | 0 ms | 3236 KB | Output is correct |
6 | Incorrect | 0 ms | 3236 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |