답안 #44358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44358 2018-03-31T17:51:00 Z iletavcioski Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
579 ms 9384 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    ll k;
    cin>>k;
    vector<ll> v;
    int p=n/2;
    int p1=n-p;
    vector<ll> vc;
    for(int i=0;i<n;i++)
    {
        ll a;
        cin>>a;
        v.push_back(a);
    }
    ll res=0;
    for(int i=1;i<(1<<p);i++)
    {
        ll brojac=0;
        for(int j=0;j<p;j++)
        {
            if(i&(1<<j))
            {
                brojac+=v[j];
            }
        }
        if(brojac<=k)
        {
            vc.push_back(brojac);
            res++;
        }
    }
    sort(vc.begin(),vc.end());
    for(int i=1;i<(1<<p1);i++)
    {
        ll brojac=0;
        for(int j=0;j<p1;j++)
        {
            if(i&(1<<j))
            {
                brojac+=v[j+p];
            }
        }
        if(brojac<=k)
        {
            res++;
            res+=(upper_bound(vc.begin(),vc.end(),k-brojac)-vc.begin());
        }
    }
    res++;
    cout<<res<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 360 KB Output is correct
2 Correct 2 ms 400 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 424 KB Output is correct
5 Correct 2 ms 432 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 572 KB Output is correct
2 Correct 2 ms 660 KB Output is correct
3 Correct 2 ms 660 KB Output is correct
4 Correct 2 ms 660 KB Output is correct
5 Correct 2 ms 660 KB Output is correct
6 Correct 2 ms 660 KB Output is correct
7 Correct 2 ms 660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 660 KB Output is correct
2 Correct 2 ms 752 KB Output is correct
3 Correct 2 ms 756 KB Output is correct
4 Correct 2 ms 756 KB Output is correct
5 Correct 2 ms 756 KB Output is correct
6 Correct 2 ms 756 KB Output is correct
7 Correct 2 ms 756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1336 KB Output is correct
2 Correct 130 ms 2856 KB Output is correct
3 Correct 558 ms 9128 KB Output is correct
4 Correct 125 ms 9128 KB Output is correct
5 Correct 19 ms 9128 KB Output is correct
6 Correct 10 ms 9128 KB Output is correct
7 Correct 11 ms 9128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 9128 KB Output is correct
2 Correct 46 ms 9128 KB Output is correct
3 Correct 243 ms 9128 KB Output is correct
4 Correct 2 ms 9128 KB Output is correct
5 Correct 9 ms 9128 KB Output is correct
6 Correct 20 ms 9128 KB Output is correct
7 Correct 10 ms 9128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 9128 KB Output is correct
2 Correct 201 ms 9128 KB Output is correct
3 Correct 196 ms 9128 KB Output is correct
4 Correct 2 ms 9128 KB Output is correct
5 Correct 103 ms 9128 KB Output is correct
6 Correct 327 ms 9176 KB Output is correct
7 Correct 57 ms 9176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 394 ms 9176 KB Output is correct
2 Correct 35 ms 9176 KB Output is correct
3 Correct 14 ms 9176 KB Output is correct
4 Correct 2 ms 9176 KB Output is correct
5 Correct 10 ms 9176 KB Output is correct
6 Correct 226 ms 9176 KB Output is correct
7 Correct 10 ms 9176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 9176 KB Output is correct
2 Correct 125 ms 9176 KB Output is correct
3 Correct 12 ms 9176 KB Output is correct
4 Correct 12 ms 9176 KB Output is correct
5 Correct 135 ms 9176 KB Output is correct
6 Correct 27 ms 9176 KB Output is correct
7 Correct 155 ms 9176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 499 ms 9312 KB Output is correct
2 Correct 47 ms 9312 KB Output is correct
3 Correct 15 ms 9312 KB Output is correct
4 Correct 579 ms 9384 KB Output is correct
5 Correct 153 ms 9384 KB Output is correct
6 Correct 20 ms 9384 KB Output is correct
7 Correct 19 ms 9384 KB Output is correct