結果

問題 No.3041 非対称じゃんけん
ユーザー GOTKAKO
提出日時 2025-02-28 21:51:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,833 ms / 2,200 ms
コード長 640 bytes
コンパイル時間 2,216 ms
コンパイル使用メモリ 197,076 KB
実行使用メモリ 8,232 KB
最終ジャッジ日時 2025-02-28 21:51:47
合計ジャッジ時間 16,575 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    bitset<900001> dp;
    dp.set(0);
    int N,F; cin >> N >> F;
    vector<int> A(N),B(N),C(N);
    for(auto &a : A) cin >> a;
    for(auto &a : B) cin >> a;
    for(auto &a : C) cin >> a;


    for(int i=0; i<N; i++){
        int a = A.at(i),b = B.at(i),c = C.at(i);
        if(a < b) swap(a,b);
        if(b < c) swap(b,c);
        if(a < b) swap(a,b);
        a -= c; b -= c; c -= c;

        if(a > 0 && b > 0) dp |= (dp<<a)|(dp<<b);
        else if(a > 0) dp |= dp<<a;
        cout << dp.count() << "\n";
    }
}
0