# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
241667 | 2020-06-25T07:53:58 Z | anonymous | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 1000 ms | 72380 KB |
#include <iostream> #include <unordered_map> #include <vector> #include <algorithm> #define LL long long using namespace std; LL N, M, Wt[45], Ways; unordered_map <LL, LL> Freq; vector <pair<LL,LL> > Freq2; int main() { //freopen("bobekin.txt","r",stdin); scanf("%lld %lld",&N,&M); for (int i=0; i < N; i++) { scanf("%lld", &Wt[i]); } for (int i=0; i < 1<<(N/2); i++) { LL wt = 0; for (int j=0; j < N/2; j++) { if (i & (1<<j)) {wt += Wt[j];} } if (wt <= M) { Freq[wt]++; } } for (auto p: Freq) { Freq2.push_back(p); } sort(Freq2.begin(), Freq2.end()); for (int i=1; i<Freq2.size(); i++) { Freq2[i].second += Freq2[i-1].second; } for (int i=0; i < 1<< (N - N/2); i++) { LL wt = 0; for (int j=0; j < N - N/2; j++) { if (i & (1<<j)) {wt += Wt[j + N/2];} } if (wt <= M) { auto it = upper_bound(Freq2.begin(), Freq2.end(), pair <LL,LL> {M - wt + 1, 0}); Ways += Freq2[it - Freq2.begin() - 1].second; } } printf("%lld",Ways); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 432 KB | Output is correct |
7 | Correct | 5 ms | 128 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 1152 KB | Output is correct |
2 | Correct | 147 ms | 12468 KB | Output is correct |
3 | Correct | 631 ms | 34156 KB | Output is correct |
4 | Correct | 143 ms | 12852 KB | Output is correct |
5 | Correct | 15 ms | 384 KB | Output is correct |
6 | Correct | 10 ms | 768 KB | Output is correct |
7 | Correct | 12 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 1788 KB | Output is correct |
2 | Correct | 48 ms | 3628 KB | Output is correct |
3 | Correct | 121 ms | 1144 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 10 ms | 384 KB | Output is correct |
6 | Correct | 20 ms | 2352 KB | Output is correct |
7 | Correct | 13 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 7044 KB | Output is correct |
2 | Correct | 170 ms | 9020 KB | Output is correct |
3 | Correct | 202 ms | 9020 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 68 ms | 256 KB | Output is correct |
6 | Correct | 167 ms | 1780 KB | Output is correct |
7 | Correct | 55 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 668 ms | 36220 KB | Output is correct |
2 | Correct | 52 ms | 4752 KB | Output is correct |
3 | Correct | 20 ms | 2480 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 10 ms | 384 KB | Output is correct |
6 | Correct | 436 ms | 36076 KB | Output is correct |
7 | Correct | 15 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 4752 KB | Output is correct |
2 | Correct | 188 ms | 18184 KB | Output is correct |
3 | Correct | 19 ms | 2480 KB | Output is correct |
4 | Correct | 20 ms | 2480 KB | Output is correct |
5 | Correct | 75 ms | 384 KB | Output is correct |
6 | Correct | 35 ms | 4752 KB | Output is correct |
7 | Correct | 138 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1028 ms | 72380 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |