Submission #41410

#TimeUsernameProblemLanguageResultExecution timeMemory
41410NurlykhanBali Sculptures (APIO15_sculpture)C++14
21 / 100
25 ms1504 KiB
#include <bits/stdc++.h> #define pii pair<int, int> #define f first #define s second #define pb push_back #define mp make_pair #define ll long long #define ld long double #define sz(v) int(v.size()) #define all(v) v.begin(), v.end() #define vec vector<int> #define dead not_bad #define bad gooood #define left not_right #define y1 what using namespace std; const int N = (int) 100 + 10; const int M = (int) 2000 + 100; const ll LINF = (ll) 2e18; const int INF = (int) 1e9 + 7; const int ALPHA = 26; const int mod = INF; const double PI = 3.14159265359; const ld EPS = (ld) 1e-12; const int nx[4] = {0, 0, -1, 1}; const int ny[4] = {1, -1, 0, 0}; int n, l, r; int a[N]; int dp[N][M]; int get_sum(int l, int r) { return a[r] - a[l - 1]; } void upd(int &x, int y) { x = min(x, y); } int main() { #define fn "teams" #ifdef witch freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else //freopen(fn".in", "r", stdin); //freopen(fn".out", "w", stdout); #endif cin >> n >> l >> r; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } for (int i = 0; i <= n; i++) { for (int val_or = 0; val_or < M; val_or++) { dp[i][val_or] = r + 1; } } dp[0][0] = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { for (int val_or = 0; val_or < M; val_or++) { upd(dp[i][val_or | get_sum(j, i)], dp[j - 1][val_or] + 1); } } } for (int val_or = 0; val_or < M; val_or++) { if (dp[n][val_or] <= r) { cout << val_or; return 0; } } return 0; }
#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...