답안 #1085488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085488 2024-09-08T10:34:15 Z mingga Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 1752 KB
#include "bits/stdc++.h"

using namespace std;

#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define inf 2e18
#define fast_cin()                  \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define out(file) freopen(file, "w", stdout)
#define in(file) freopen(file, "r", stdin)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define int long long
int MOD = 1e9 + 7;
const int N = 2001;
int y[N], a, b, n;
int ps[N], dp[N][N];

void sub1() {
  int ans = inf;
  for(int mask = 0; mask < (1 << n); mask++) {
    if(((mask >> (n-1)) & 1) == 0) continue; 
    int cnt = __builtin_popcount(mask);
    if(cnt < a or cnt > b) continue;
    int s = 0;
    int cur = 0;
    cerr << "CNT " << cnt << ln;
    for(int i = 0; i < n; i++) {
      s += y[i+1];
      if((mask >> i) & 1) {
        cur |= s;
        cerr << s << ' ';
        s = 0;
      }
    }
    cerr << ln;
    ans = min(ans, cur);
  }
  cout << ans;
}

signed main() {
    fast_cin();
    cin >> n >> a >> b;
    for(int i = 1; i <= n; i++) cin >> y[i], ps[i] = ps[i-1] + y[i];
    if(n <= 20) sub1();
    cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 335 ms 772 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 5 ms 476 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 464 KB Output is correct
13 Execution timed out 1018 ms 1616 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 328 ms 884 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 476 KB Output is correct
12 Correct 4 ms 728 KB Output is correct
13 Execution timed out 1097 ms 1752 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 324 ms 792 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 472 KB Output is correct
13 Execution timed out 1060 ms 1716 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 323 ms 756 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 476 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
13 Execution timed out 1099 ms 1720 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 336 ms 760 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 5 ms 612 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Execution timed out 1072 ms 1620 KB Time limit exceeded
14 Halted 0 ms 0 KB -