Submission #41410

# Submission time Handle Problem Language Result Execution time Memory
41410 2018-02-17T07:39:38 Z Nurlykhan Bali Sculptures (APIO15_sculpture) C++14
21 / 100
25 ms 1504 KB
#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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 532 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 612 KB Output is correct
7 Correct 2 ms 616 KB Output is correct
8 Correct 2 ms 728 KB Output is correct
9 Correct 2 ms 728 KB Output is correct
10 Correct 3 ms 728 KB Output is correct
11 Correct 2 ms 816 KB Output is correct
12 Correct 3 ms 816 KB Output is correct
13 Correct 2 ms 816 KB Output is correct
14 Correct 2 ms 816 KB Output is correct
15 Incorrect 2 ms 816 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Output is correct
2 Correct 2 ms 816 KB Output is correct
3 Correct 2 ms 816 KB Output is correct
4 Correct 2 ms 816 KB Output is correct
5 Correct 2 ms 816 KB Output is correct
6 Correct 2 ms 816 KB Output is correct
7 Correct 2 ms 816 KB Output is correct
8 Correct 2 ms 816 KB Output is correct
9 Correct 2 ms 816 KB Output is correct
10 Correct 3 ms 816 KB Output is correct
11 Correct 2 ms 816 KB Output is correct
12 Correct 2 ms 816 KB Output is correct
13 Correct 2 ms 816 KB Output is correct
14 Correct 2 ms 816 KB Output is correct
15 Incorrect 2 ms 816 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Output is correct
2 Correct 2 ms 816 KB Output is correct
3 Correct 2 ms 816 KB Output is correct
4 Correct 3 ms 816 KB Output is correct
5 Correct 2 ms 816 KB Output is correct
6 Correct 2 ms 816 KB Output is correct
7 Correct 2 ms 816 KB Output is correct
8 Correct 3 ms 816 KB Output is correct
9 Correct 2 ms 816 KB Output is correct
10 Correct 2 ms 816 KB Output is correct
11 Correct 2 ms 816 KB Output is correct
12 Correct 3 ms 816 KB Output is correct
13 Correct 2 ms 816 KB Output is correct
14 Correct 2 ms 816 KB Output is correct
15 Correct 3 ms 816 KB Output is correct
16 Correct 5 ms 876 KB Output is correct
17 Correct 8 ms 876 KB Output is correct
18 Correct 7 ms 1004 KB Output is correct
19 Correct 6 ms 1004 KB Output is correct
20 Correct 7 ms 1004 KB Output is correct
21 Correct 11 ms 1004 KB Output is correct
22 Correct 7 ms 1136 KB Output is correct
23 Correct 7 ms 1136 KB Output is correct
24 Correct 7 ms 1136 KB Output is correct
25 Correct 10 ms 1136 KB Output is correct
26 Correct 14 ms 1260 KB Output is correct
27 Correct 18 ms 1388 KB Output is correct
28 Correct 21 ms 1504 KB Output is correct
29 Correct 23 ms 1504 KB Output is correct
30 Correct 20 ms 1504 KB Output is correct
31 Correct 25 ms 1504 KB Output is correct
32 Correct 21 ms 1504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1504 KB Output is correct
2 Correct 2 ms 1504 KB Output is correct
3 Correct 2 ms 1504 KB Output is correct
4 Correct 2 ms 1504 KB Output is correct
5 Correct 2 ms 1504 KB Output is correct
6 Correct 2 ms 1504 KB Output is correct
7 Correct 2 ms 1504 KB Output is correct
8 Correct 2 ms 1504 KB Output is correct
9 Correct 2 ms 1504 KB Output is correct
10 Correct 2 ms 1504 KB Output is correct
11 Correct 3 ms 1504 KB Output is correct
12 Correct 2 ms 1504 KB Output is correct
13 Correct 2 ms 1504 KB Output is correct
14 Correct 2 ms 1504 KB Output is correct
15 Incorrect 2 ms 1504 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1504 KB Output is correct
2 Correct 2 ms 1504 KB Output is correct
3 Correct 2 ms 1504 KB Output is correct
4 Correct 2 ms 1504 KB Output is correct
5 Correct 2 ms 1504 KB Output is correct
6 Correct 2 ms 1504 KB Output is correct
7 Correct 2 ms 1504 KB Output is correct
8 Correct 2 ms 1504 KB Output is correct
9 Correct 2 ms 1504 KB Output is correct
10 Correct 2 ms 1504 KB Output is correct
11 Correct 2 ms 1504 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 3 ms 1504 KB Output is correct
14 Runtime error 2 ms 1504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -