# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28748 | 2017-07-16T13:55:09 Z | rondojim | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 649 ms | 13548 KB |
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; const int MAXN = 45; typedef long long ll; ll N, K, A[MAXN], result; int main(){ #ifdef DEBUG freopen("input.txt", "r", stdin); #endif scanf("%lld %lld", &N, &K); for(int i=0; i<N; ++i) scanf("%lld", &A[i]); int middle = N / 2, remain = N - N / 2; vector<ll> sums; for(int bitm=0; bitm<(1<<middle); ++bitm){ ll sum = 0; for(int i=0; i<middle; ++i) if(bitm & (1<<i)) sum += A[i]; sums.push_back(sum); } sort(sums.begin(), sums.end()); for(int bitm=0; bitm<(1<<remain); ++bitm){ ll sum = 0; for(int i=0; i<remain; ++i) if(bitm & (1<<i)) sum += A[middle + i]; int lo = 0, hi = sums.size() - 1, res = -1, mid; while(lo <= hi){ mid = (lo + hi)>>1; if(sums[mid] + sum > K) hi = mid - 1; else res = mid, lo = mid + 1; } if(res != -1) result += res + 1; } printf("%lld\n", result); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
2 | Correct | 0 ms | 1176 KB | Output is correct |
3 | Correct | 0 ms | 1176 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 0 ms | 1176 KB | Output is correct |
6 | Correct | 0 ms | 1176 KB | Output is correct |
7 | Correct | 0 ms | 1176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
2 | Correct | 0 ms | 1176 KB | Output is correct |
3 | Correct | 0 ms | 1176 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 0 ms | 1176 KB | Output is correct |
6 | Correct | 0 ms | 1176 KB | Output is correct |
7 | Correct | 0 ms | 1176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
2 | Correct | 0 ms | 1176 KB | Output is correct |
3 | Correct | 0 ms | 1176 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 0 ms | 1176 KB | Output is correct |
6 | Correct | 0 ms | 1176 KB | Output is correct |
7 | Correct | 0 ms | 1176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 2028 KB | Output is correct |
2 | Correct | 109 ms | 4332 KB | Output is correct |
3 | Correct | 539 ms | 13548 KB | Output is correct |
4 | Correct | 129 ms | 4332 KB | Output is correct |
5 | Correct | 19 ms | 2028 KB | Output is correct |
6 | Correct | 6 ms | 1644 KB | Output is correct |
7 | Correct | 16 ms | 2028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 2796 KB | Output is correct |
2 | Correct | 36 ms | 2028 KB | Output is correct |
3 | Correct | 236 ms | 7404 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 6 ms | 1644 KB | Output is correct |
6 | Correct | 16 ms | 2028 KB | Output is correct |
7 | Correct | 13 ms | 2028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 83 ms | 2796 KB | Output is correct |
2 | Correct | 203 ms | 4332 KB | Output is correct |
3 | Correct | 199 ms | 4332 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 99 ms | 4332 KB | Output is correct |
6 | Correct | 299 ms | 13548 KB | Output is correct |
7 | Correct | 106 ms | 4332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 453 ms | 7404 KB | Output is correct |
2 | Correct | 39 ms | 2028 KB | Output is correct |
3 | Correct | 9 ms | 1644 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 6 ms | 1644 KB | Output is correct |
6 | Correct | 216 ms | 7404 KB | Output is correct |
7 | Correct | 19 ms | 2028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 2028 KB | Output is correct |
2 | Correct | 116 ms | 4332 KB | Output is correct |
3 | Correct | 9 ms | 1644 KB | Output is correct |
4 | Correct | 9 ms | 1644 KB | Output is correct |
5 | Correct | 129 ms | 4332 KB | Output is correct |
6 | Correct | 23 ms | 2028 KB | Output is correct |
7 | Correct | 299 ms | 13548 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 496 ms | 13548 KB | Output is correct |
2 | Correct | 39 ms | 2028 KB | Output is correct |
3 | Correct | 9 ms | 1644 KB | Output is correct |
4 | Correct | 649 ms | 13548 KB | Output is correct |
5 | Correct | 149 ms | 7404 KB | Output is correct |
6 | Correct | 13 ms | 2028 KB | Output is correct |
7 | Correct | 29 ms | 2796 KB | Output is correct |