結果
問題 |
No.3041 非対称じゃんけん
|
ユーザー |
|
提出日時 | 2025-02-28 22:23:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,175 bytes |
コンパイル時間 | 5,987 ms |
コンパイル使用メモリ | 334,084 KB |
実行使用メモリ | 16,720 KB |
最終ジャッジ日時 | 2025-02-28 22:23:52 |
合計ジャッジ時間 | 10,428 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 TLE * 1 -- * 1 |
ソースコード
#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 maxsize=0; rep(i,0,n){ sort(a[i].begin(),a[i].end()); maxsize+=a[i][2]-a[i][0]; } vector<bool> dp(maxsize+1); dp[0]=true; deque<int> Q; int ans=1; int m=0; rep(i,0,n){ int x=a[i][1]-a[i][0],y=a[i][2]-a[i][0]; rep(j,m+1,m+y+1)Q.push_back(j); deque<int> R; m+=y; while(Q.size()){ auto j=Q.back();Q.pop_back(); 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++; else R.push_front(j); } } swap(Q,R); cout << ans << "\n"; } }