結果

問題 No.3041 非対称じゃんけん
ユーザー makichan
提出日時 2025-02-28 22:16:07
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 969 bytes
コンパイル時間 6,213 ms
コンパイル使用メモリ 332,476 KB
実行使用メモリ 12,072 KB
最終ジャッジ日時 2025-02-28 22:16:32
合計ジャッジ時間 16,486 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 TLE * 2 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = atcoder::static_modint<998244353>;
// using mint = atcoder::static_modint<1000000007>;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<(int)n; i++)
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};

int main(){
    int n,f;cin >> n >> f;
    vector<vector<int>> a(n,vector<int>(3));
    rep(i,0,3)rep(j,0,n)cin >> a[j][i];
    int m=0;
    rep(i,0,n){
        sort(a[i].begin(),a[i].end());
        auto P={a[i][1]-a[i][0],a[i][2]-a[i][0]};
        m+=a[i][2]-a[i][0];
        a[i]=P;
    }
    vector<bool> dp(m+1);
    dp[0]=true;
    int ans=1;
    rep(i,0,n){
        int x=a[i][0],y=a[i][1];
        for(int j=m; j>=0; j--)if(!dp[j]){
            if(j-x>=0 && dp[j-x])dp[j]=true;
            if(j-y>=0 && dp[j-y])dp[j]=true;
            if(dp[j])ans++;
        }
        cout << ans << "\n";
    }
}
0