# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
24704 | 2017-06-12T01:50:21 Z | kdh9949 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 366 ms | 18404 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, p, q; ll m, x[20], y[20], a[1048576], b[1048576], ans; int main(){ scanf("%d%lld", &n, &m); p = n / 2; q = n - p; if(n == 1){ ll x; scanf("%lld", &x); printf("%lld\n", x <= m ? 1 : 0); return 0; } for(int i = 0; i < p; i++){ scanf("%lld", x + i); } for(int i = 0; i < q; i++){ scanf("%lld", y + i); } for(int i = 0; i < (1 << p); i++){ for(int j = 0; j < p; j++) if((1 << j) & i) a[i] += x[j]; } for(int i = 0; i < (1 << q); i++){ for(int j = 0; j < q; j++) if((1 << j) & i) b[i] += y[j]; } sort(a, a + (1 << p)); sort(b, b + (1 << q)); for(int i = 0, j = (1 << q) - 1; i < (1 << p); i++){ for(; j >= 0; j--){ if(a[i] + b[j] <= m) break; } ans += (j + 1); } printf("%lld\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 18404 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 18404 KB | Output is correct |
2 | Correct | 0 ms | 18404 KB | Output is correct |
3 | Correct | 0 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 0 ms | 18404 KB | Output is correct |
6 | Correct | 0 ms | 18404 KB | Output is correct |
7 | Correct | 0 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 18404 KB | Output is correct |
2 | Correct | 0 ms | 18404 KB | Output is correct |
3 | Correct | 0 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 0 ms | 18404 KB | Output is correct |
6 | Correct | 0 ms | 18404 KB | Output is correct |
7 | Correct | 0 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 18404 KB | Output is correct |
2 | Correct | 0 ms | 18404 KB | Output is correct |
3 | Correct | 0 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 0 ms | 18404 KB | Output is correct |
6 | Correct | 0 ms | 18404 KB | Output is correct |
7 | Correct | 0 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 18404 KB | Output is correct |
2 | Correct | 79 ms | 18404 KB | Output is correct |
3 | Correct | 359 ms | 18404 KB | Output is correct |
4 | Correct | 86 ms | 18404 KB | Output is correct |
5 | Correct | 16 ms | 18404 KB | Output is correct |
6 | Correct | 6 ms | 18404 KB | Output is correct |
7 | Correct | 19 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 18404 KB | Output is correct |
2 | Correct | 33 ms | 18404 KB | Output is correct |
3 | Correct | 153 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 6 ms | 18404 KB | Output is correct |
6 | Correct | 19 ms | 18404 KB | Output is correct |
7 | Correct | 23 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 73 ms | 18404 KB | Output is correct |
2 | Correct | 133 ms | 18404 KB | Output is correct |
3 | Correct | 129 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 86 ms | 18404 KB | Output is correct |
6 | Correct | 309 ms | 18404 KB | Output is correct |
7 | Correct | 129 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 256 ms | 18404 KB | Output is correct |
2 | Correct | 29 ms | 18404 KB | Output is correct |
3 | Correct | 9 ms | 18404 KB | Output is correct |
4 | Correct | 0 ms | 18404 KB | Output is correct |
5 | Correct | 6 ms | 18404 KB | Output is correct |
6 | Correct | 273 ms | 18404 KB | Output is correct |
7 | Correct | 16 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 18404 KB | Output is correct |
2 | Correct | 73 ms | 18404 KB | Output is correct |
3 | Correct | 9 ms | 18404 KB | Output is correct |
4 | Correct | 9 ms | 18404 KB | Output is correct |
5 | Correct | 93 ms | 18404 KB | Output is correct |
6 | Correct | 29 ms | 18404 KB | Output is correct |
7 | Correct | 363 ms | 18404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 366 ms | 18404 KB | Output is correct |
2 | Correct | 29 ms | 18404 KB | Output is correct |
3 | Correct | 9 ms | 18404 KB | Output is correct |
4 | Correct | 363 ms | 18404 KB | Output is correct |
5 | Correct | 123 ms | 18404 KB | Output is correct |
6 | Correct | 19 ms | 18404 KB | Output is correct |
7 | Correct | 39 ms | 18404 KB | Output is correct |