Submission #48154

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
481542018-05-10 10:58:11square1001Bali Sculptures (APIO15_sculpture)C++14
100 / 100
601 ms1160 KiB
#include <bitset>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
vector<int> v(N);
for (int i = 0; i < N; i++) cin >> v[i];
long long ret = 0;
for (int i = 40; i >= 0; i--) {
vector<bitset<2001> > dp(N + 1);
dp[0] = 1;
for (int j = 1; j <= N; j++) {
long long cur = 0;
for (int k = j - 1; k >= 0; k--) {
cur += v[k];
if (((cur >> (i + 1)) | ret) == ret && !((cur >> i) & 1)) {
dp[j] |= dp[k] << 1;
}
}
}
bool ok = false;
for (int j = A; j <= B; j++) {
ok = ok || dp[N][j];
}
ret <<= 1;
if (!ok) ret++;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...