Submission #1031342

#TimeUsernameProblemLanguageResultExecution timeMemory
1031342_8_8_Bali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e3 + 21, MOD = (int)1e9+7; int n,a,b,x[N],dp[N]; void test() { cin >> n >> a >> b; for(int i = 1;i <= n;i++) { cin >> x[i]; } ll cur = 0,res = 0; for(ll c = 41;c >= 0;c--){ for(int i = 1;i <= n;i++){ dp[i] = 1e9; } cur += (1ll << c); for(int i = 1;i <= n;i++){ ll s = 0; for(int j = i;j >= 1;j--){ s += x[j]; if((s & cur) == 0) { dp[i] = min(dp[i],dp[j - 1] + 1); } } } if(dp[n] == (int)1e9){ cur -= (1ll << c); res += (1ll << c); } } cout << res; } int main() { ios_base::sync_with_stdio(false);cin.tie(0); int t = 1; // cin >> t; while(t--) { test(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...