結果

問題 No.54 Happy Hallowe'en
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2024-01-01 22:23:17
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 932 bytes
コンパイル時間 5,283 ms
コンパイル使用メモリ 316,184 KB
実行使用メモリ 52,292 KB
最終ジャッジ日時 2024-01-01 22:23:25
合計ジャッジ時間 6,937 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,212 KB
testcase_01 AC 33 ms
52,212 KB
testcase_02 AC 32 ms
52,212 KB
testcase_03 AC 32 ms
52,212 KB
testcase_04 AC 37 ms
52,236 KB
testcase_05 AC 39 ms
52,244 KB
testcase_06 AC 42 ms
52,256 KB
testcase_07 AC 45 ms
52,268 KB
testcase_08 AC 46 ms
52,280 KB
testcase_09 AC 50 ms
52,292 KB
testcase_10 AC 33 ms
52,212 KB
testcase_11 AC 31 ms
52,212 KB
testcase_12 AC 50 ms
52,292 KB
testcase_13 AC 50 ms
52,292 KB
testcase_14 AC 33 ms
52,212 KB
testcase_15 AC 32 ms
52,212 KB
testcase_16 WA -
testcase_17 AC 34 ms
52,212 KB
testcase_18 AC 32 ms
52,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k))
#define rrep(i,m,n,k) for (int i = (int)(m); i > (int)(n); i += (int)(k))
#define ll long long
#define list(T,A,N) vector<T> A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];}


int main(){
    
    int N;
    cin >> N;
    vector<pair<int,int>> VT(N);
    int v,t;
    rep(i,0,N,1){
        cin >> v >> t;
        VT[i] = {v,t};
    }
    sort(VT.begin(),VT.end());
    bitset<20000> S;
    bitset<20000> I;
    I.set(0,1);
    vector<bitset<20000>> msk(20000);
    msk[0].set(0,1);
    rep(i,0,19999,1){
        msk[i+1] = I|(msk[i]<<1);
    }
    S.set(0,1);
    for(auto [vv,tt]:VT){
        S |= (msk[tt-1]&S)<<vv;
    }
    int ans = 0;
    rep(i,0,20000,1){
        if (S.test(i)){
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;

}
0