답안 #484481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484481 2021-11-03T16:21:33 Z Sho10 Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
509 ms 8648 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define aint(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 998244353
#define PI 3.14159265359
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,m,a[45];
vector<ll>v;
int32_t main(){
CODE_START;
cin>>n>>m;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
}
ll ans=0;
ll x=(n)/2;
ll y=n-x;
for(ll i=0;i<(1ll<<y);i++)
{
    ll sum=0;
    for(ll j=x;j<n;j++)
    {
        if(((1ll<<((j-x))&i))){
sum+=a[j];
        }
    }
v.pb(sum);
}
sort(v.begin(),v.end());
for(ll i=0;i<(1ll<<x);i++)
{
    ll sum=0;
    for(ll j=0;j<x;j++)
    {
        if((1ll<<j)&i){
                sum+=a[j];
        }
    }
    if(sum>m){
        continue;
    }
   ll pos=upper_bound(v.begin(),v.end(),m-sum)-v.begin();
   if(pos>=1){
    ans+=pos;
   }
}
cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 308 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
# 결과 실행 시간 메모리 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 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1356 KB Output is correct
2 Correct 113 ms 2472 KB Output is correct
3 Correct 509 ms 8628 KB Output is correct
4 Correct 92 ms 2504 KB Output is correct
5 Correct 15 ms 848 KB Output is correct
6 Correct 6 ms 592 KB Output is correct
7 Correct 12 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 1484 KB Output is correct
2 Correct 28 ms 1484 KB Output is correct
3 Correct 179 ms 4572 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 7 ms 592 KB Output is correct
6 Correct 13 ms 880 KB Output is correct
7 Correct 13 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 2504 KB Output is correct
2 Correct 161 ms 4508 KB Output is correct
3 Correct 163 ms 4504 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 109 ms 4536 KB Output is correct
6 Correct 250 ms 8648 KB Output is correct
7 Correct 96 ms 4440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 333 ms 8628 KB Output is correct
2 Correct 32 ms 1484 KB Output is correct
3 Correct 11 ms 700 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 8 ms 700 KB Output is correct
6 Correct 199 ms 8612 KB Output is correct
7 Correct 12 ms 976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 1484 KB Output is correct
2 Correct 108 ms 2524 KB Output is correct
3 Correct 10 ms 592 KB Output is correct
4 Correct 9 ms 692 KB Output is correct
5 Correct 103 ms 4528 KB Output is correct
6 Correct 27 ms 1484 KB Output is correct
7 Correct 204 ms 8560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 352 ms 8612 KB Output is correct
2 Correct 33 ms 1484 KB Output is correct
3 Correct 11 ms 608 KB Output is correct
4 Correct 473 ms 8628 KB Output is correct
5 Correct 152 ms 4548 KB Output is correct
6 Correct 14 ms 976 KB Output is correct
7 Correct 23 ms 1392 KB Output is correct