# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928910 | 2024-02-17T07:56:26 Z | Warinchai | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 300 ms | 21700 KB |
#include<bits/stdc++.h> #define int long long using namespace std; int ar[45]; vector<int>first; vector<int>second; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,m;cin>>n>>m; int md=n/2; int m2=n-md; for(int i=1;i<=n;i++){ cin>>ar[i]; } for(int i=0;i<(1<<md);i++){ int sum=0; for(int j=0;j<md;j++){ if((i>>j)&1)sum+=ar[j+1]; } //cerr<<i<<" "<<sum<<"\n"; if(sum<=m)first.push_back(sum); } for(int i=0;i<(1<<m2);i++){ int sum=0; for(int j=0;j<m2;j++){ if((i>>j)&1)sum+=ar[md+j+1]; } if(sum<=m)second.push_back(sum); } sort(first.begin(),first.end()); sort(second.begin(),second.end(),greater<int>()); /*for(auto x:first)cerr<<x<<" "; cerr<<"\n"; for(auto x:second)cerr<<x<<" "; cerr<<"\n";*/ int cur=0; int ans=0; for(auto x:first){ while(cur<second.size()&&x+second[cur]>m){ cur++; } ans+=second.size()-cur; } cout<<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 | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 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 | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | 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 | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 464 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 2144 KB | Output is correct |
2 | Correct | 71 ms | 5580 KB | Output is correct |
3 | Correct | 300 ms | 20968 KB | Output is correct |
4 | Correct | 75 ms | 5576 KB | Output is correct |
5 | Correct | 13 ms | 1756 KB | Output is correct |
6 | Correct | 8 ms | 1112 KB | Output is correct |
7 | Correct | 8 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 2868 KB | Output is correct |
2 | Correct | 25 ms | 2140 KB | Output is correct |
3 | Correct | 124 ms | 11356 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 6 ms | 1116 KB | Output is correct |
6 | Correct | 16 ms | 1500 KB | Output is correct |
7 | Correct | 8 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 3676 KB | Output is correct |
2 | Correct | 107 ms | 7244 KB | Output is correct |
3 | Correct | 106 ms | 6724 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 74 ms | 7232 KB | Output is correct |
6 | Correct | 264 ms | 21316 KB | Output is correct |
7 | Correct | 48 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 224 ms | 13120 KB | Output is correct |
2 | Correct | 24 ms | 2140 KB | Output is correct |
3 | Correct | 8 ms | 992 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 6 ms | 1244 KB | Output is correct |
6 | Correct | 215 ms | 14148 KB | Output is correct |
7 | Correct | 8 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 2144 KB | Output is correct |
2 | Correct | 72 ms | 5548 KB | Output is correct |
3 | Correct | 8 ms | 1116 KB | Output is correct |
4 | Correct | 8 ms | 992 KB | Output is correct |
5 | Correct | 77 ms | 7748 KB | Output is correct |
6 | Correct | 25 ms | 2144 KB | Output is correct |
7 | Correct | 132 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 297 ms | 21700 KB | Output is correct |
2 | Correct | 25 ms | 2144 KB | Output is correct |
3 | Correct | 8 ms | 992 KB | Output is correct |
4 | Correct | 295 ms | 21104 KB | Output is correct |
5 | Correct | 115 ms | 12428 KB | Output is correct |
6 | Correct | 16 ms | 1500 KB | Output is correct |
7 | Correct | 15 ms | 452 KB | Output is correct |