提出 #75559662


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define int ll

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());

const int M = (int)4e6 + 10;

typedef bitset<M> bs;

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int>a(n+1);
    vector<int>f(M+1);
    for(int i = 1; i<=n; i++){
        cin >> a[i];
        f[a[i]] += 2;
    }
    bs b;
    b[0] = 1;
    for(int i = 1; i<=M; i++){
        while(f[i] >= 3){
            f[i] -= 2;
            f[2*i]++;
        }
        for(int j = 0; j<f[i]; j++){
            b = b | (b << i);
        }
    }
    cout << (b.count()+1)/2 << '\n';
    return 0;
}

提出情報

提出日時
問題 K - 加算と減算
ユーザ kevinyang
言語 C++23 (GCC 15.2.0)
得点 5
コード長 924 Byte
結果 AC
実行時間 306 ms
メモリ 40036 KiB

ジャッジ結果

セット名 Sample Subtask All
得点 / 配点 0 / 0 4 / 4 1 / 1
結果
AC × 2
AC × 11
AC × 41
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
Subtask 00_sample_00.txt, 00_sample_01.txt, 01_subtask_00.txt, 01_subtask_01.txt, 01_subtask_02.txt, 01_subtask_03.txt, 01_subtask_04.txt, 01_subtask_05.txt, 01_subtask_06.txt, 01_subtask_07.txt, 01_subtask_08.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_subtask_00.txt, 01_subtask_01.txt, 01_subtask_02.txt, 01_subtask_03.txt, 01_subtask_04.txt, 01_subtask_05.txt, 01_subtask_06.txt, 01_subtask_07.txt, 01_subtask_08.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 21 ms 36004 KiB
00_sample_01.txt AC 22 ms 36008 KiB
01_subtask_00.txt AC 167 ms 36112 KiB
01_subtask_01.txt AC 121 ms 36068 KiB
01_subtask_02.txt AC 87 ms 36004 KiB
01_subtask_03.txt AC 84 ms 36084 KiB
01_subtask_04.txt AC 79 ms 36080 KiB
01_subtask_05.txt AC 79 ms 36068 KiB
01_subtask_06.txt AC 65 ms 36076 KiB
01_subtask_07.txt AC 66 ms 36068 KiB
01_subtask_08.txt AC 137 ms 35996 KiB
02_random_00.txt AC 39 ms 40036 KiB
02_random_01.txt AC 40 ms 39076 KiB
02_random_02.txt AC 39 ms 38832 KiB
02_random_03.txt AC 45 ms 37088 KiB
02_random_04.txt AC 78 ms 36324 KiB
02_random_05.txt AC 140 ms 36132 KiB
02_random_06.txt AC 244 ms 36112 KiB
02_random_07.txt AC 207 ms 36004 KiB
02_random_08.txt AC 78 ms 36068 KiB
02_random_09.txt AC 198 ms 36076 KiB
02_random_10.txt AC 166 ms 36004 KiB
02_random_11.txt AC 75 ms 36020 KiB
02_random_12.txt AC 21 ms 36020 KiB
02_random_13.txt AC 21 ms 36140 KiB
02_random_14.txt AC 23 ms 36084 KiB
02_random_15.txt AC 27 ms 35984 KiB
02_random_16.txt AC 35 ms 36004 KiB
02_random_17.txt AC 306 ms 36068 KiB
02_random_18.txt AC 234 ms 36068 KiB
02_random_19.txt AC 147 ms 36060 KiB
02_random_20.txt AC 148 ms 36060 KiB
02_random_21.txt AC 128 ms 36008 KiB
02_random_22.txt AC 128 ms 36016 KiB
02_random_23.txt AC 114 ms 36004 KiB
02_random_24.txt AC 109 ms 36068 KiB
02_random_25.txt AC 229 ms 36112 KiB
02_random_26.txt AC 225 ms 36068 KiB
02_random_27.txt AC 184 ms 36008 KiB
02_random_28.txt AC 170 ms 36020 KiB
02_random_29.txt AC 243 ms 36240 KiB