Submission #406792

#TimeUsernameProblemLanguageResultExecution timeMemory
4067922qbingxuanBali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms332 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #ifdef local #define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n" #define pary(a...) danb(#a, a) #define debug(a...) qqbx(#a, a) template <typename ...T> void qqbx(const char *s, T ...a) { int cnt = sizeof...(T); ((std::cerr << "\033[1;32m(" << s << ") = (") , ... , (std::cerr << a << (--cnt ? ", " : ")\033[0m\n"))); } template <typename T> void danb(const char *s, T L, T R) { std::cerr << "\033[1;32m[ " << s << " ] = [ "; for (int f = 0; L != R; ++L) std::cerr << (f++ ? ", " : "") << *L; std::cerr << " ]\033[0m\n"; } #else #define debug(...) ((void)0) #define safe ((void)0) #define pary(...) ((void)0) #endif // local #define all(v) begin(v),end(v) #define pb emplace_back using namespace std; using ll = int_fast64_t; const int inf = 1e9; const int mod = 1000000007; const int maxn = 100025; ll pre[maxn], a[maxn]; bool dp[maxn]; int n, A, B; bool ok(ll mask) { dp[0] = true; for (int i = 1; i <= n; i++) { dp[i] = false; for (int j = 0; j < i; j++) if (A <= i-j && i-j <= B && !(mask & (pre[i] - pre[j]))) dp[i] |= dp[j]; } return dp[n]; } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> A >> B; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) pre[i+1] = pre[i] + a[i]; ll ans = 0, U = (1LL << 51) - 1; for (ll s = 1LL << 50; s; s >>= 1) if (ok(ans + s)) ans += s; cout << (U ^ ans) << '\n'; }
#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...