답안 #928585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928585 2024-02-16T17:21:29 Z sleepntsheep Ice Hockey World Championship (CEOI15_bobek) C++17
20 / 100
207 ms 10716 KB
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
#include <complex>

using u32 = unsigned;
using i32 = int;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

using namespace std;
using pt = complex<f80>;
#define ALL(x) begin(x), end(x)
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
#define N 400005

int n;
u64 z, a, b[44];
vector<u64> v;

int main()
{
    ShinLena;
    cin >> n >> a;
    for (int i = 0; i < n; ++i) cin >> b[i];

    for (int i = 0; i < (1 << min(20, n)); ++i)
    {
        u64 z = 0;
        for (int j = 0; j < min(20, n); ++j)
            if ((i >> j) & 1) z += b[j];
        if (z > a) continue;
        ++::z;
        v.emplace_back(z);
    }

    sort(ALL(v));

    if (n >= 20)
    {
        for (int i = 0; i < (1 << (n - 20)); ++i)
        {
            u64 z = {};
            for (int j = 20; j < n; ++j)
                if ((i >> j) & 1) z += b[j];
            if (z > a) continue;
            ++::z;

            auto it = upper_bound(ALL(v), a - z);
            ::z += it - begin(v);
        }
    }
    cout << z;

    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1496 KB Output is correct
2 Correct 5 ms 736 KB Output is correct
3 Correct 11 ms 992 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 992 KB Output is correct
6 Incorrect 142 ms 10096 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 116 ms 8796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 126 ms 9564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 127 ms 9928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 138 ms 8892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 162 ms 9416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 142 ms 10716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 207 ms 10596 KB Output isn't correct
2 Halted 0 ms 0 KB -