Submission #886802

#TimeUsernameProblemLanguageResultExecution timeMemory
886802anha3k25cvpBali Sculptures (APIO15_sculpture)C++14
37 / 100
4 ms712 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define dl double #define st first #define nd second #define II pair <int, int> using namespace std; const int N = 1 + 2e3; const int inf = 7 + 1e9; int main() { #define TASKNAME "" ios_base :: sync_with_stdio (0); cin.tie (0); if ( fopen( TASKNAME".inp", "r" ) ) { freopen (TASKNAME".inp", "r", stdin); freopen (TASKNAME".out", "w", stdout); } int n, L, R; cin >> n >> L >> R; vector <ll> a(n + 1, 0); for (int i = 1; i <= n; i ++) { cin >> a[i]; a[i] += a[i - 1]; } int ans = 0; vector <int> ok(60, 0); while (1) { for (int bit = -1; bit < 60; bit ++) { vector <bitset <N>> f(n + 1); f[0][0] = 1; for (int i = 1; i <= n; i ++) for (int j = 0; j < i; j ++) { ll val = a[i] - a[j], check = 1; for (ll si = val; si > 0; si ^= si & -si) { int i = __builtin_ctz(si & -si); if (i > bit && !ok[i]) { check = 0; break; } } if (!check) continue; f[i] |= f[j] << 1; } int check = 0; for (int i = L; i <= R; i ++) if (f[n][i]) { check = 1; break; } if (check) { if (bit < 0) { cout << ans; return 0; } ok[bit] = 1; ans += (ll)1 << bit; break; } } } return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:19:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen (TASKNAME".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:20:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen (TASKNAME".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...