結果
| 問題 | No.3501 Digit Products 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-17 22:35:04 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,094 bytes |
| 記録 | |
| コンパイル時間 | 2,521 ms |
| コンパイル使用メモリ | 336,024 KB |
| 実行使用メモリ | 30,332 KB |
| 平均クエリ数 | 10.44 |
| 最終ジャッジ日時 | 2026-04-17 22:35:20 |
| 合計ジャッジ時間 | 12,851 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 43 WA * 29 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr) -> sync_with_stdio(false);
int n;
cin >> n;
vector<int> p(n, -1);
for (int i = 1; i < n; ++i) {
cout << "? 0 " << i << endl;
if (!(cin >> p[i])) return 0;
}
vector<int> cands;
vector<int> ans(n, -1);
for (int d = 1; d <= 9; ++d) {
bool ok = true;
vector<int> a(n, -1);
a[0] = d;
for (int i = 1; i < n; ++i) {
if (p[i]%d) {
ok = false;
break;
}
int x = p[i]/d;
if (x < 0 or x > 9) {
ok = false;
break;
}
a[i] = x;
}
if (ok) {
cands.push_back(d);
ans = a;
}
}
if (cands.size() != 1) {
cout << "! -1" << endl;
return 0;
}
cout << "! ";
rep(i, n) cout << ans[i];
cout << endl;
return 0;
}