結果
| 問題 |
No.2784 繰り上がりなし十進和
|
| コンテスト | |
| ユーザー |
rgnerdplayer
|
| 提出日時 | 2025-05-01 15:19:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 739 ms / 2,000 ms |
| コード長 | 1,060 bytes |
| コンパイル時間 | 4,275 ms |
| コンパイル使用メモリ | 286,324 KB |
| 実行使用メモリ | 9,088 KB |
| 最終ジャッジ日時 | 2025-05-01 15:20:11 |
| 合計ジャッジ時間 | 14,492 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
vector<string> a(6);
queue<string> q;
constexpr int V = 1e6;
vector<int> vis(V);
for (int i = 0; i < 6; i++) {
cin >> a[i];
q.push(a[i]);
vis[stoi(a[i])] = true;
}
auto add = [&](string x, string y) {
string res;
for (int i = 0; i < 6; i++) {
res += '0' + (x[i] - '0' + y[i] - '0') % 10;
}
return res;
};
while (!q.empty()) {
auto x = q.front();
q.pop();
for (auto y : a) {
auto z = add(x, y);
if (!vis[stoi(z)]) {
vis[stoi(z)] = true;
q.push(z);
}
}
}
int ans = count(vis.begin(), vis.end(), true);
cout << ans << '\n';
};
solve();
return 0;
}
rgnerdplayer