# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148083 | 2019-08-31T13:44:17 Z | WhipppedCream | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 547 ms | 8784 KB |
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; int n; ll S; const int maxn = 45; ll arr[maxn]; vector< ll > half; ll ways; int main() { scanf("%d %lld", &n, &S); for(int i = 1; i<= n; i++) scanf("%lld", &arr[i]); int m = n/2; for(int bit = 0; bit< (1<<m); bit++) { ll loc = 0; for(int i = 0; i< m; i++) { if((1<<i) & bit) loc += arr[i+1]; } half.pb(loc); } sort(half.begin(), half.end()); m = n-n/2; for(int bit = 0; bit< (1<<m); bit++) { ll loc = 0; for(int i = 0; i< m; i++) { if((1<<i)&bit) loc += arr[n/2+1+i]; } ways += upper_bound(half.begin(), half.end(), S-loc)-half.begin(); } printf("%lld\n", ways); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 256 KB | Output is correct |
6 | Correct | 2 ms | 356 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1012 KB | Output is correct |
2 | Correct | 118 ms | 2540 KB | Output is correct |
3 | Correct | 525 ms | 8784 KB | Output is correct |
4 | Correct | 117 ms | 2540 KB | Output is correct |
5 | Correct | 19 ms | 1016 KB | Output is correct |
6 | Correct | 10 ms | 780 KB | Output is correct |
7 | Correct | 18 ms | 1012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 1516 KB | Output is correct |
2 | Correct | 39 ms | 1012 KB | Output is correct |
3 | Correct | 230 ms | 4552 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 9 ms | 760 KB | Output is correct |
6 | Correct | 19 ms | 1012 KB | Output is correct |
7 | Correct | 18 ms | 984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 84 ms | 1516 KB | Output is correct |
2 | Correct | 191 ms | 2552 KB | Output is correct |
3 | Correct | 182 ms | 2488 KB | Output is correct |
4 | Correct | 2 ms | 392 KB | Output is correct |
5 | Correct | 100 ms | 2536 KB | Output is correct |
6 | Correct | 297 ms | 8668 KB | Output is correct |
7 | Correct | 94 ms | 2536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 403 ms | 4580 KB | Output is correct |
2 | Correct | 36 ms | 1016 KB | Output is correct |
3 | Correct | 14 ms | 744 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 10 ms | 760 KB | Output is correct |
6 | Correct | 218 ms | 4584 KB | Output is correct |
7 | Correct | 17 ms | 1028 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 1012 KB | Output is correct |
2 | Correct | 113 ms | 2528 KB | Output is correct |
3 | Correct | 11 ms | 760 KB | Output is correct |
4 | Correct | 12 ms | 776 KB | Output is correct |
5 | Correct | 133 ms | 2540 KB | Output is correct |
6 | Correct | 26 ms | 1012 KB | Output is correct |
7 | Correct | 290 ms | 8668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 462 ms | 8728 KB | Output is correct |
2 | Correct | 40 ms | 1008 KB | Output is correct |
3 | Correct | 12 ms | 632 KB | Output is correct |
4 | Correct | 547 ms | 8744 KB | Output is correct |
5 | Correct | 156 ms | 4580 KB | Output is correct |
6 | Correct | 19 ms | 1016 KB | Output is correct |
7 | Correct | 34 ms | 1520 KB | Output is correct |