# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968530 | 2024-04-23T14:44:31 Z | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 289 ms | 22192 KB |
#include <iostream> #include <vector> #include <algorithm> using namespace std; using ll = long long; const int N = 44; ll n, m; vector<ll> lv, rv; vector<ll> la, ra; void calc(vector<ll> &v, vector<ll> &res){ for (int i = 0;i < (1<<v.size());i++){ ll sm = 0; for (int j = 0;j < v.size();j++){ if (i&(1<<j)) sm += v[j]; } res.push_back(sm); } sort(res.begin(), res.end()); } int main() { int n; ll k; scanf("%d %lld", &n, &k);; for (int i = 0;i < n/2;i++){ ll v; scanf("%lld", &v); la.push_back(v); } for (int i = n/2;i < n;i++){ ll v; scanf("%lld", &v); ra.push_back(v); } calc(la, lv); calc(ra, rv); ll p = 0ll, ans = 0ll; reverse(lv.begin(), lv.end()); for (auto e:lv){ while (p < rv.size() && rv[p]+e <= k) p++; ans += p; } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 1992 KB | Output is correct |
2 | Correct | 68 ms | 5432 KB | Output is correct |
3 | Correct | 289 ms | 21676 KB | Output is correct |
4 | Correct | 67 ms | 5340 KB | Output is correct |
5 | Correct | 12 ms | 1488 KB | Output is correct |
6 | Correct | 7 ms | 984 KB | Output is correct |
7 | Correct | 15 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 2944 KB | Output is correct |
2 | Correct | 24 ms | 2132 KB | Output is correct |
3 | Correct | 117 ms | 11704 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 6 ms | 980 KB | Output is correct |
6 | Correct | 15 ms | 1488 KB | Output is correct |
7 | Correct | 15 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 3652 KB | Output is correct |
2 | Correct | 108 ms | 8048 KB | Output is correct |
3 | Correct | 100 ms | 7744 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 69 ms | 6980 KB | Output is correct |
6 | Correct | 254 ms | 21004 KB | Output is correct |
7 | Correct | 101 ms | 8520 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 208 ms | 13628 KB | Output is correct |
2 | Correct | 24 ms | 2132 KB | Output is correct |
3 | Correct | 8 ms | 1112 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 7 ms | 984 KB | Output is correct |
6 | Correct | 205 ms | 14360 KB | Output is correct |
7 | Correct | 15 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1876 KB | Output is correct |
2 | Correct | 66 ms | 5316 KB | Output is correct |
3 | Correct | 8 ms | 984 KB | Output is correct |
4 | Correct | 8 ms | 980 KB | Output is correct |
5 | Correct | 74 ms | 7748 KB | Output is correct |
6 | Correct | 23 ms | 1880 KB | Output is correct |
7 | Correct | 271 ms | 22192 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 282 ms | 21164 KB | Output is correct |
2 | Correct | 24 ms | 1880 KB | Output is correct |
3 | Correct | 8 ms | 1108 KB | Output is correct |
4 | Correct | 289 ms | 22192 KB | Output is correct |
5 | Correct | 98 ms | 11756 KB | Output is correct |
6 | Correct | 15 ms | 1488 KB | Output is correct |
7 | Correct | 33 ms | 3024 KB | Output is correct |