# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
21962 | 2017-04-27T20:37:01 Z | mohammad_kilani | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 162344 KB |
#include<bits/stdc++.h> using namespace std; const int N = 2001; int n , a , b , arr[N]; bool dp[N][N][41]; bool canbit[41]; vector<vector<int> > v; bool check(long long num,int curbit){ for(int i=46;i>=curbit;i--){ if(canbit[i] == 1) continue; if(((num >> i)&1) == 1) return false; } return true; } int main(){ //freopen("in.txt","r",stdin); 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=40;i>=0;i--){ v.clear(); v.resize(n+2); for(int j=0;j<n;j++){ long long sum =0 ; for(int k=j;k<n;k++){ sum+=(long long)arr[k]; if(check(sum,i)) v[k].push_back(j); } } for(int j=b;j>=0;j--){ int si = v[n-1].size(); for(int k=0;k<si;k++){ dp[v[n-1][k]][j][i] = true; } } for(int j=b;j>=0;j--){ for(int k=0;k<n;k++){ if(dp[k][j][i] == true && k > 0 && j > 0){ int si = v[k-1].size(); for(int l=0;l<si;l++){ dp[v[k-1][l]][j-1][i] = true; } } } } if(dp[0][0][i] == false){ ans += ((long long)1 << (long long)i); canbit[i] = 1; } } cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 162344 KB | Output is correct |
2 | Correct | 0 ms | 162344 KB | Output is correct |
3 | Correct | 0 ms | 162344 KB | Output is correct |
4 | Correct | 0 ms | 162344 KB | Output is correct |
5 | Incorrect | 0 ms | 162344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 162344 KB | Output is correct |
2 | Correct | 0 ms | 162344 KB | Output is correct |
3 | Correct | 0 ms | 162344 KB | Output is correct |
4 | Correct | 0 ms | 162344 KB | Output is correct |
5 | Incorrect | 0 ms | 162344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 162344 KB | Output is correct |
2 | Correct | 0 ms | 162344 KB | Output is correct |
3 | Correct | 0 ms | 162344 KB | Output is correct |
4 | Correct | 0 ms | 162344 KB | Output is correct |
5 | Incorrect | 0 ms | 162344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 162344 KB | Output is correct |
2 | Correct | 0 ms | 162344 KB | Output is correct |
3 | Correct | 0 ms | 162344 KB | Output is correct |
4 | Correct | 0 ms | 162344 KB | Output is correct |
5 | Incorrect | 0 ms | 162344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 162344 KB | Output is correct |
2 | Correct | 0 ms | 162344 KB | Output is correct |
3 | Correct | 0 ms | 162344 KB | Output is correct |
4 | Correct | 0 ms | 162344 KB | Output is correct |
5 | Incorrect | 0 ms | 162344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |