# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
436172 | 2021-06-24T09:53:27 Z | cpp219 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 447 ms | 20852 KB |
#pragma GCC optimization O2 #pragma GCC optimization "unroll-loop" #pragma target ("avx2") #include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; typedef pair<ll,ll> LL; const ll N = 40 + 9; const ll inf = 1e9 + 7; vector<ll> v1,v2; ll n,k,now,ans,a[N]; void f1(ll i){ if (i > n/2){ if (now <= k) v1.push_back(now); return; } f1(i + 1); now += a[i]; f1(i + 1); now -= a[i]; } void f2(ll i){ if (i > n){ if (now <= k) v2.push_back(now); return; } f2(i + 1); now += a[i]; f2(i + 1); now -= a[i]; } int main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "test" if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); //freopen(task".OUT","w",stdout); } cin>>n>>k; for (ll i = 1;i <= n;i++) cin>>a[i]; f1(1); now = 0; f2(n/2 + 1); //for (auto i : v2) cout<<i<<" "; return 0; sort(v2.begin(),v2.end()); for (auto i : v1){ ll inc = prev(upper_bound(v2.begin(),v2.end(),k - i)) - v2.begin() + 1; //cout<<inc<<"x\n"; ans += inc; } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 252 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 2000 KB | Output is correct |
2 | Correct | 80 ms | 5444 KB | Output is correct |
3 | Correct | 447 ms | 20808 KB | Output is correct |
4 | Correct | 72 ms | 5444 KB | Output is correct |
5 | Correct | 9 ms | 1484 KB | Output is correct |
6 | Correct | 5 ms | 976 KB | Output is correct |
7 | Correct | 2 ms | 312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 2888 KB | Output is correct |
2 | Correct | 23 ms | 2000 KB | Output is correct |
3 | Correct | 169 ms | 10560 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 4 ms | 976 KB | Output is correct |
6 | Correct | 8 ms | 1612 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 3532 KB | Output is correct |
2 | Correct | 105 ms | 6600 KB | Output is correct |
3 | Correct | 124 ms | 6600 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 40 ms | 6600 KB | Output is correct |
6 | Correct | 145 ms | 20768 KB | Output is correct |
7 | Correct | 6 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 297 ms | 12788 KB | Output is correct |
2 | Correct | 22 ms | 2000 KB | Output is correct |
3 | Correct | 8 ms | 976 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 4 ms | 976 KB | Output is correct |
6 | Correct | 139 ms | 12748 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 2000 KB | Output is correct |
2 | Correct | 78 ms | 5360 KB | Output is correct |
3 | Correct | 7 ms | 976 KB | Output is correct |
4 | Correct | 7 ms | 976 KB | Output is correct |
5 | Correct | 57 ms | 6600 KB | Output is correct |
6 | Correct | 16 ms | 2000 KB | Output is correct |
7 | Correct | 14 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 315 ms | 20836 KB | Output is correct |
2 | Correct | 23 ms | 2000 KB | Output is correct |
3 | Correct | 9 ms | 848 KB | Output is correct |
4 | Correct | 427 ms | 20852 KB | Output is correct |
5 | Correct | 62 ms | 10560 KB | Output is correct |
6 | Correct | 9 ms | 1612 KB | Output is correct |
7 | Correct | 2 ms | 304 KB | Output is correct |