답안 #928589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928589 2024-02-16T17:25:56 Z sleepntsheep Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
411 ms 18888 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
#define A 21

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 = 1; i < (1 << min(A, n)); ++i)
    {
        u64 z = 0;
        for (int j = 0; j < min(A, n); ++j)
            if ((i >> j) & 1) z += b[j];
        if (z > a) continue;
        ++::z;
        v.emplace_back(z);
    }

    sort(ALL(v));

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

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

    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1400 KB Output is correct
2 Correct 5 ms 736 KB Output is correct
3 Correct 15 ms 988 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 8 ms 992 KB Output is correct
6 Correct 144 ms 10552 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 9664 KB Output is correct
2 Correct 18 ms 1028 KB Output is correct
3 Correct 7 ms 992 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
5 Correct 76 ms 6604 KB Output is correct
6 Correct 16 ms 1496 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 255 ms 17748 KB Output is correct
2 Correct 292 ms 17040 KB Output is correct
3 Correct 410 ms 18068 KB Output is correct
4 Correct 290 ms 18480 KB Output is correct
5 Correct 205 ms 17456 KB Output is correct
6 Correct 248 ms 17556 KB Output is correct
7 Correct 129 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 264 ms 18888 KB Output is correct
2 Correct 270 ms 17072 KB Output is correct
3 Correct 289 ms 18460 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 189 ms 17848 KB Output is correct
6 Correct 265 ms 17588 KB Output is correct
7 Correct 128 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 282 ms 18616 KB Output is correct
2 Correct 305 ms 18832 KB Output is correct
3 Correct 292 ms 18056 KB Output is correct
4 Correct 27 ms 2516 KB Output is correct
5 Correct 201 ms 18876 KB Output is correct
6 Correct 289 ms 18148 KB Output is correct
7 Correct 132 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 360 ms 18072 KB Output is correct
2 Correct 290 ms 18104 KB Output is correct
3 Correct 270 ms 17076 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 203 ms 18220 KB Output is correct
6 Correct 316 ms 16824 KB Output is correct
7 Correct 129 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 17528 KB Output is correct
2 Correct 297 ms 17340 KB Output is correct
3 Correct 290 ms 18468 KB Output is correct
4 Correct 232 ms 17072 KB Output is correct
5 Correct 216 ms 17724 KB Output is correct
6 Correct 296 ms 18616 KB Output is correct
7 Correct 150 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 409 ms 18568 KB Output is correct
2 Correct 282 ms 18792 KB Output is correct
3 Correct 283 ms 18292 KB Output is correct
4 Correct 411 ms 18356 KB Output is correct
5 Correct 216 ms 18612 KB Output is correct
6 Correct 286 ms 18660 KB Output is correct
7 Correct 130 ms 344 KB Output is correct