답안 #101693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101693 2019-03-19T13:30:29 Z lyc Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
676 ms 8704 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; ll m; cin >> n >> m;
    ll a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<ll> v;
    int s = n/2;
    for (int i = 0; i < (1<<s); ++i) {
        ll cur = 0;
        for (int j = 0; j < s; ++j) if (i & (1<<j)) cur += a[j];
        v.push_back(cur);
    }
    sort(v.begin(), v.end());

    ll ans = 0;
    for (int i = 0; i < (1<<(n-s)); ++i) {
        ll cur = 0;
        for (int j = s; j < n; ++j) if (i & (1<<(j-s))) cur += a[j];

        ll maxi = m - cur;
        ans += upper_bound(v.begin(), v.end(), maxi) - v.begin();
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 424 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 988 KB Output is correct
2 Correct 118 ms 2552 KB Output is correct
3 Correct 544 ms 8676 KB Output is correct
4 Correct 116 ms 2552 KB Output is correct
5 Correct 21 ms 1024 KB Output is correct
6 Correct 11 ms 768 KB Output is correct
7 Correct 16 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 1532 KB Output is correct
2 Correct 40 ms 896 KB Output is correct
3 Correct 226 ms 4588 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 10 ms 768 KB Output is correct
6 Correct 20 ms 1024 KB Output is correct
7 Correct 17 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 1532 KB Output is correct
2 Correct 196 ms 2604 KB Output is correct
3 Correct 205 ms 2544 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 104 ms 2552 KB Output is correct
6 Correct 275 ms 8672 KB Output is correct
7 Correct 102 ms 2552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 426 ms 4588 KB Output is correct
2 Correct 29 ms 1036 KB Output is correct
3 Correct 12 ms 768 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 10 ms 768 KB Output is correct
6 Correct 229 ms 4596 KB Output is correct
7 Correct 15 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1024 KB Output is correct
2 Correct 106 ms 2552 KB Output is correct
3 Correct 12 ms 768 KB Output is correct
4 Correct 12 ms 768 KB Output is correct
5 Correct 122 ms 2552 KB Output is correct
6 Correct 25 ms 1024 KB Output is correct
7 Correct 262 ms 8676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 477 ms 8704 KB Output is correct
2 Correct 41 ms 1024 KB Output is correct
3 Correct 12 ms 768 KB Output is correct
4 Correct 676 ms 8672 KB Output is correct
5 Correct 143 ms 4720 KB Output is correct
6 Correct 21 ms 1024 KB Output is correct
7 Correct 32 ms 1532 KB Output is correct