답안 #106821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106821 2019-04-20T15:44:27 Z LamoreauxAJ Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
617 ms 8716 KB
#include <bits/stdc++.h>
using namespace std;

int N, M;
vector<int> nums;
vector<long long> half;

int main() {
    ios_base::sync_with_stdio(false);
    // freopen("1.in", "r", stdin);

    cin >> N >> M;
    nums.assign(N, 0);
    for (int i = 0; i < N; i++)
        cin >> nums[i];

    for (int i = 0; i < (1 << (N / 2)); i++) {
        long long sum = 0;
        for (int j = 0; j < N / 2; j++)
            if (i & (1 << j))
                sum += nums[j];
        half.push_back(sum);
    }
    sort(half.begin(), half.end());

    long long res = 0;
    for (int i = 0; i < (1 << (N - N / 2)); i++) {
        long long sum = 0;
        for (int j = N / 2; j < N; j++)
            if (i & (1 << (j - N / 2)))
                sum += nums[j];

        int lo = 0, hi = half.size() - 1, ans = -1;
        while (lo <= hi) {
            int m = (lo + hi) / 2;
            if (half[m] > M - sum)
                hi = m - 1;
            else
                lo = m + 1, ans = m;
        }

        res += ans + 1;
    }

    cout << res << "\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 428 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 996 KB Output is correct
2 Correct 113 ms 2552 KB Output is correct
3 Correct 617 ms 8716 KB Output is correct
4 Correct 116 ms 2552 KB Output is correct
5 Correct 17 ms 996 KB Output is correct
6 Correct 9 ms 768 KB Output is correct
7 Correct 17 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 1532 KB Output is correct
2 Correct 39 ms 1024 KB Output is correct
3 Correct 247 ms 4708 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 7 ms 768 KB Output is correct
6 Correct 17 ms 1044 KB Output is correct
7 Correct 16 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 1532 KB Output is correct
2 Correct 195 ms 2552 KB Output is correct
3 Correct 164 ms 2552 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 84 ms 2552 KB Output is correct
6 Correct 267 ms 8672 KB Output is correct
7 Correct 96 ms 2552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 148 ms 4596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 1024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 242 ms 8692 KB Output isn't correct
2 Halted 0 ms 0 KB -