結果
問題 |
No.3041 非対称じゃんけん
|
ユーザー |
|
提出日時 | 2025-02-28 23:18:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,290 bytes |
コンパイル時間 | 2,898 ms |
コンパイル使用メモリ | 279,068 KB |
実行使用メモリ | 10,144 KB |
最終ジャッジ日時 | 2025-02-28 23:18:56 |
合計ジャッジ時間 | 7,182 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 16 TLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int N, F; cin >> N >> F; vector<int> A(N), B(N), C(N); for(auto&x: A) cin >> x; for(auto&x: B) cin >> x; for(auto&x: C) cin >> x; vector<bool> dp(N * F + 1); int M = F; int ans = 0; auto Push = [&](vector<bool>& DP, int k, int SZ) { if(!DP[k]) { DP[k] = 1; ans++; } }; Push(dp, A[0], F); Push(dp, B[0], F); Push(dp, C[0], F); cout << ans << "\n"; for(int i = 1; i < N; i++) { for(int j = M; j >= 0; j--) if(dp[j]){ Push(dp, j + A[i], M + F); Push(dp, j + B[i], M + F); Push(dp, j + C[i], M + F); } M += F; cout << ans << "\n"; } /* int M = 60; vector<bool> dp(F * N + 1); int ans = 0; auto Push = [&](vector<bool>& DP, int k) { if() return; if(!DP[k]) { DP[k] = 1; ans++; } }; Push(dp, A[0]), Push(dp, B[0]), Push(dp, C[0]); cout << ans << "\n"; for(int i = 1; i < N; i++) { M += 61; vector<bool> ndp = dp; ndp.resize(M); for(int j = 0; j < ndp.size(); j++) cout << ndp[j] << " "; cout << endl; for(int j = 0, sz = dp.size(); j < sz; j++) if(dp[j]) { Push(ndp, A[i] + j), Push(ndp, B[i] + j), Push(ndp, C[i] + j); } cout << ans << "\n"; dp = ndp; } */ }