Submission #467138

#TimeUsernameProblemLanguageResultExecution timeMemory
467138SirCovidThe19thBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms292 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b; long long ans, A[2005]; bool test(long long bad){ int lst[b + 1]; fill(lst, lst + b + 1, -1); lst[0] = 0; for (int i = 1; i <= n; i++) for (int j = min(b, i); j >= 1; j--){ if (~lst[j - 1] and !((A[i] - A[lst[j - 1]]) & bad)) lst[j] = i; if (i == n and j >= a and j <= b and lst[j] == n) return 1; } return 0; } int main(){ cin >> n >> a >> b; for (int i = 1; i <= n; i++) cin >> A[i], A[i] += A[i - 1]; for (long long i = (1LL << 40), bad = 0; i > 0; i /= 2) if (!test(bad += i)) bad -= i, ans += i; cout<<ans<<endl; }
#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...