Submission #50799

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
507992018-06-13 10:50:42waynetuinforBali Sculptures (APIO15_sculpture)C++17
100 / 100
477 ms16932 KiB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 5;
long long s[maxn], y[maxn];
int dp[maxn][maxn], qu[maxn], dt[maxn];
vector<int> gr[maxn];
int main() {
int n, a, b; scanf("%d %d %d", &n, &a, &b);
for (int i = 1; i <= n; ++i) {
scanf("%lld", &y[i]);
s[i] = s[i - 1] + y[i];
}
if (a == 1) {
long long ans = 0, mask = 0;
for (int t = 44; t >= 0; --t) {
for (int i = 0; i < maxn; ++i) gr[i].clear();
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < i; ++j) {
if (mask & (s[i] - s[j])) continue;
int bit = (s[i] - s[j]) >> t & 1;
if (bit == 0) gr[j].push_back(i);
}
}
memset(dt, -1, sizeof(dt));
dt[0] = 0;
int l = 0, r = 0;
qu[r++] = 0;
while (l < r) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, a, b; scanf("%d %d %d", &n, &a, &b);
                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &y[i]);
         ~~~~~^~~~~~~~~~~~~~~
#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...