# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
592824 | 2022-07-09T16:22:44 Z | andrei_boaca | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 306 ms | 20880 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,v[45],m; vector<ll> v1,v2; vector<ll> s1,s2; int main() { cin>>n>>m; for(int i=1;i<=n;i++) { cin>>v[i]; if(i<=n/2) v1.push_back(v[i]); else v2.push_back(v[i]); } if(n==1) { ll ans=1; if(v[1]<=m) ans++; cout<<ans; return 0; } ll lg1=v1.size(); for(int mask=0;mask<(1<<lg1);mask++) { ll suma=0; for(int i=0;i<v1.size();i++) if((mask>>i)&1) suma+=v1[i]; if(suma<=m) s1.push_back(suma); } ll lg2=v2.size(); for(int mask=0;mask<(1<<lg2);mask++) { ll suma=0; for(int i=0;i<v2.size();i++) if((mask>>i)&1) suma+=v2[i]; if(suma<=m) s2.push_back(suma); } sort(s1.begin(),s1.end()); reverse(s1.begin(),s1.end()); sort(s2.begin(),s2.end()); ll poz=0; ll ans=0; for(ll a:s1) { while(poz<s2.size()&&s2[poz]+a<=m) poz++; poz--; ans+=poz+1; } cout<<ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 300 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1924 KB | Output is correct |
2 | Correct | 69 ms | 5328 KB | Output is correct |
3 | Correct | 306 ms | 20832 KB | Output is correct |
4 | Correct | 73 ms | 5308 KB | Output is correct |
5 | Correct | 12 ms | 1484 KB | Output is correct |
6 | Correct | 8 ms | 944 KB | Output is correct |
7 | Correct | 7 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2812 KB | Output is correct |
2 | Correct | 25 ms | 1940 KB | Output is correct |
3 | Correct | 122 ms | 10472 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 944 KB | Output is correct |
6 | Correct | 17 ms | 1484 KB | Output is correct |
7 | Correct | 9 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 3496 KB | Output is correct |
2 | Correct | 105 ms | 6556 KB | Output is correct |
3 | Correct | 110 ms | 6564 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 76 ms | 6472 KB | Output is correct |
6 | Correct | 266 ms | 20720 KB | Output is correct |
7 | Correct | 42 ms | 276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 217 ms | 12776 KB | Output is correct |
2 | Correct | 25 ms | 1924 KB | Output is correct |
3 | Correct | 9 ms | 940 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 6 ms | 852 KB | Output is correct |
6 | Correct | 212 ms | 12720 KB | Output is correct |
7 | Correct | 7 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 1888 KB | Output is correct |
2 | Correct | 83 ms | 5304 KB | Output is correct |
3 | Correct | 9 ms | 852 KB | Output is correct |
4 | Correct | 8 ms | 852 KB | Output is correct |
5 | Correct | 78 ms | 6544 KB | Output is correct |
6 | Correct | 24 ms | 1872 KB | Output is correct |
7 | Correct | 112 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 289 ms | 20748 KB | Output is correct |
2 | Correct | 29 ms | 1960 KB | Output is correct |
3 | Correct | 9 ms | 852 KB | Output is correct |
4 | Correct | 296 ms | 20880 KB | Output is correct |
5 | Correct | 96 ms | 10500 KB | Output is correct |
6 | Correct | 18 ms | 1484 KB | Output is correct |
7 | Correct | 15 ms | 296 KB | Output is correct |