# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
108376 | 2019-04-28T19:32:14 Z | luciocf | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 527 ms | 8796 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 40; typedef long long ll; ll a[maxn]; int main(void) { int n; ll m; scanf("%d %lld", &n, &m); for (int i = 0; i < n; i++) scanf("%lld", &a[i]); int mid = n/2; ll ans = 0; vector<ll> V; for (int mask = 1; mask < (1<<mid); mask++) { ll sum = 0; for (int i = 0; i < mid; i++) if (mask&(1<<i)) sum += a[i]; if (sum <= m) { ans++; V.push_back(sum); } } sort(V.begin(), V.end()); int k = n-mid; for (int mask = 1; mask < (1<<k); mask++) { ll sum = 0; for (int i = mid; i < n; i++) if (mask&(1<<(i-mid))) sum += a[i]; if (sum <= m) { vector<ll>::iterator it = upper_bound(V.begin(), V.end(), m-sum); ans += 1ll*(it-V.begin())+1; } } printf("%lld\n", ans+1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 128 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 1020 KB | Output is correct |
2 | Correct | 106 ms | 2548 KB | Output is correct |
3 | Correct | 497 ms | 8668 KB | Output is correct |
4 | Correct | 105 ms | 2556 KB | Output is correct |
5 | Correct | 17 ms | 1020 KB | Output is correct |
6 | Correct | 9 ms | 640 KB | Output is correct |
7 | Correct | 9 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 1560 KB | Output is correct |
2 | Correct | 35 ms | 1020 KB | Output is correct |
3 | Correct | 211 ms | 4572 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 10 ms | 808 KB | Output is correct |
6 | Correct | 20 ms | 1020 KB | Output is correct |
7 | Correct | 10 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 74 ms | 1528 KB | Output is correct |
2 | Correct | 171 ms | 2548 KB | Output is correct |
3 | Correct | 167 ms | 2456 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 89 ms | 2548 KB | Output is correct |
6 | Correct | 270 ms | 8652 KB | Output is correct |
7 | Correct | 51 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 387 ms | 4580 KB | Output is correct |
2 | Correct | 31 ms | 1020 KB | Output is correct |
3 | Correct | 11 ms | 768 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 10 ms | 768 KB | Output is correct |
6 | Correct | 199 ms | 4584 KB | Output is correct |
7 | Correct | 10 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1020 KB | Output is correct |
2 | Correct | 116 ms | 2548 KB | Output is correct |
3 | Correct | 11 ms | 640 KB | Output is correct |
4 | Correct | 11 ms | 768 KB | Output is correct |
5 | Correct | 132 ms | 2548 KB | Output is correct |
6 | Correct | 23 ms | 1020 KB | Output is correct |
7 | Correct | 138 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 411 ms | 8796 KB | Output is correct |
2 | Correct | 41 ms | 1004 KB | Output is correct |
3 | Correct | 11 ms | 640 KB | Output is correct |
4 | Correct | 527 ms | 8784 KB | Output is correct |
5 | Correct | 140 ms | 4648 KB | Output is correct |
6 | Correct | 16 ms | 1020 KB | Output is correct |
7 | Correct | 17 ms | 384 KB | Output is correct |