# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
967721 | 2024-04-22T17:03:33 Z | jadai007 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 293 ms | 22432 KB |
#include<bits/stdc++.h> #define int long long using namespace std; vector<int> lefts, rights; int arr[50], n, k, idx, ans; void solve(int l, int r){ for(int i = 0; i < (1<<(r - l + 1)); ++i){ int sum = 0; for(int j = l; j <= r; ++j) if(i&(1<<(j - l + 1))) sum += arr[j]; if(l == 1) lefts.push_back(sum); else rights.push_back(sum); } } signed main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> k; for(int i = 1; i <= n; ++i) cin >> arr[i]; if(n == 1){ if(arr[1] <= k) cout << 1; else cout << 0; return 0; } solve(1, n / 2); solve(n / 2 + 1, n); sort(lefts.begin(), lefts.end()); sort(rights.begin(), rights.end()); reverse(lefts.begin(), lefts.end()); for(auto x:lefts){ while(idx < rights.size() && rights[idx] + x <= k) idx++; ans+=idx; } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 2144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 3032 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 3672 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 209 ms | 14140 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1888 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 293 ms | 22432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |