# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
170881 | 2019-12-26T16:16:35 Z | socho | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 418 ms | 21000 KB |
#include "bits/stdc++.h" using namespace std; int main() { long long n, m; cin >> n >> m; vector<long long> vc(n); for (long long i=0; i<n; i++) cin >> vc[i]; vector<long long> le, ri; for (long long i=0; i<n/2; i++) { le.push_back(vc[i]); // cout << "L " << i << endl; } for (long long i=n/2; i<n; i++) { ri.push_back(vc[i]); // cout << "R " << i << endl; } long long ls = le.size(), rs = ri.size(); vector<long long> les, ris; for (long long i=0; i<(1<<ls); i++) { long long sm = 0; for (long long j=0; j<ls; j++) { if (i & (1 << j)) sm += le[j]; } les.push_back(sm); } for (long long i=0; i<(1<<rs); i++) { long long sm = 0; for (long long j=0; j<rs; j++) { if (i & (1 << j)) sm += ri[j]; } ris.push_back(sm); } sort(les.begin(), les.end()); sort(ris.begin(), ris.end()); reverse(ris.begin(), ris.end()); long long valid = 0; long long pt = 0; for (int i=0; i<les.size(); i++) { long long mx = m - les[i]; while (pt < ris.size() && ris[pt] > mx) pt++; valid += (ris.size() - pt); } cout << valid << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 360 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 0 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2032 KB | Output is correct |
2 | Correct | 94 ms | 5476 KB | Output is correct |
3 | Correct | 418 ms | 20816 KB | Output is correct |
4 | Correct | 94 ms | 5476 KB | Output is correct |
5 | Correct | 18 ms | 1648 KB | Output is correct |
6 | Correct | 12 ms | 1012 KB | Output is correct |
7 | Correct | 23 ms | 1648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 2920 KB | Output is correct |
2 | Correct | 34 ms | 2156 KB | Output is correct |
3 | Correct | 168 ms | 10588 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 10 ms | 1012 KB | Output is correct |
6 | Correct | 23 ms | 1604 KB | Output is correct |
7 | Correct | 23 ms | 1648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 3624 KB | Output is correct |
2 | Correct | 142 ms | 6664 KB | Output is correct |
3 | Correct | 142 ms | 6668 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 99 ms | 6724 KB | Output is correct |
6 | Correct | 350 ms | 20908 KB | Output is correct |
7 | Correct | 141 ms | 6760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 292 ms | 12916 KB | Output is correct |
2 | Correct | 34 ms | 2152 KB | Output is correct |
3 | Correct | 12 ms | 1012 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 10 ms | 1012 KB | Output is correct |
6 | Correct | 280 ms | 12888 KB | Output is correct |
7 | Correct | 22 ms | 1648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2028 KB | Output is correct |
2 | Correct | 93 ms | 5480 KB | Output is correct |
3 | Correct | 12 ms | 1012 KB | Output is correct |
4 | Correct | 12 ms | 1012 KB | Output is correct |
5 | Correct | 107 ms | 6624 KB | Output is correct |
6 | Correct | 33 ms | 2032 KB | Output is correct |
7 | Correct | 387 ms | 21000 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 393 ms | 20820 KB | Output is correct |
2 | Correct | 35 ms | 2032 KB | Output is correct |
3 | Correct | 12 ms | 1012 KB | Output is correct |
4 | Correct | 402 ms | 20884 KB | Output is correct |
5 | Correct | 139 ms | 10592 KB | Output is correct |
6 | Correct | 22 ms | 1648 KB | Output is correct |
7 | Correct | 45 ms | 2928 KB | Output is correct |