답안 #101756

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101756 2019-03-20T00:29:36 Z shenxy Ice Hockey World Championship (CEOI15_bobek) C++11
100 / 100
571 ms 8672 KB
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N;
    long long int M;
    scanf("%d %lld", &N, &M);
    long long int mycosts[N];
    for (int i = 0; i < N; i++) scanf("%lld", &mycosts[i]);
    vector<long long int> thecosts;
    for (long long int mask = 0; mask < (1 << (N / 2)); mask++) {
        long long int ans = 0;
        for (int i = 0; i < N / 2; i++) {
            if (mask & (1 << i)) ans += mycosts[i];
        }
        thecosts.push_back(ans);
    }
    sort(thecosts.begin(), thecosts.end());
    long long int trueans = 0;
    for (long long int mask = 0; mask < (1 << (N - N / 2)); mask++) {
        long long int ans = 0;
        for (int i = 0; i < N - N / 2; i++) {
            if (mask & (1 << i)) ans += mycosts[N / 2 + i];
        }
        trueans += upper_bound(thecosts.begin(), thecosts.end(), M - ans) - thecosts.begin();
    }
    printf("%lld", trueans);
    return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %lld", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~~~~
bobek.cpp:10:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i = 0; i < N; i++) scanf("%lld", &mycosts[i]);
                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 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 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 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 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 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 Correct 36 ms 1020 KB Output is correct
2 Correct 106 ms 2548 KB Output is correct
3 Correct 564 ms 8668 KB Output is correct
4 Correct 105 ms 2548 KB Output is correct
5 Correct 17 ms 892 KB Output is correct
6 Correct 9 ms 640 KB Output is correct
7 Correct 16 ms 1020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 1528 KB Output is correct
2 Correct 42 ms 1020 KB Output is correct
3 Correct 215 ms 4620 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 10 ms 768 KB Output is correct
6 Correct 21 ms 1020 KB Output is correct
7 Correct 16 ms 892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 1400 KB Output is correct
2 Correct 182 ms 2540 KB Output is correct
3 Correct 166 ms 2548 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 104 ms 2548 KB Output is correct
6 Correct 283 ms 8668 KB Output is correct
7 Correct 83 ms 2548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 425 ms 4500 KB Output is correct
2 Correct 33 ms 892 KB Output is correct
3 Correct 12 ms 640 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 11 ms 768 KB Output is correct
6 Correct 207 ms 4584 KB Output is correct
7 Correct 16 ms 892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1020 KB Output is correct
2 Correct 106 ms 2548 KB Output is correct
3 Correct 10 ms 768 KB Output is correct
4 Correct 12 ms 768 KB Output is correct
5 Correct 121 ms 2548 KB Output is correct
6 Correct 24 ms 1020 KB Output is correct
7 Correct 272 ms 8672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 445 ms 8656 KB Output is correct
2 Correct 43 ms 892 KB Output is correct
3 Correct 12 ms 640 KB Output is correct
4 Correct 571 ms 8672 KB Output is correct
5 Correct 144 ms 4580 KB Output is correct
6 Correct 17 ms 1020 KB Output is correct
7 Correct 32 ms 1528 KB Output is correct