結果
| 問題 |
No.3235 巡回減算
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2025-08-15 22:02:29 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,006 bytes |
| コンパイル時間 | 5,182 ms |
| コンパイル使用メモリ | 335,044 KB |
| 実行使用メモリ | 814,484 KB |
| 最終ジャッジ日時 | 2025-08-15 22:02:44 |
| 合計ジャッジ時間 | 7,389 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | MLE * 1 -- * 29 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
vector<int> f(int x) {
vector<int> ret;
rep(i, 0, 8) {
x = (x % 10) * 10000000 + (x / 10);
ret.push_back(x);
}
return ret;
}
void solve() {
int n;
cin >> n;
vector dp(2, vector<int>(100000000));
dp[0][n] = 1;
rep(i, 0, 7) {
int x;
cin >> x;
auto xs = f(x);
rep(j, 0, 100000000) {
if (dp[0][j] == 0) continue;
rep(k, 0, 8) {
if (j >= xs[k]) {
dp[1][j - xs[k]] = 1;
}
}
}
swap(dp[0], dp[1]);
rep(j, 0, 100000000) dp[1][j] = 0;
}
cout << (dp[0][0] ? "Yes" : "No") << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(12);
int t = 1;
while (t--) solve();
}
SnowBeenDiding