結果
| 問題 | No.3501 Digit Products 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 22:35:05 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,263 bytes |
| 記録 | |
| コンパイル時間 | 1,749 ms |
| コンパイル使用メモリ | 177,196 KB |
| 実行使用メモリ | 30,320 KB |
| 平均クエリ数 | 4.26 |
| 最終ジャッジ日時 | 2026-04-18 22:35:49 |
| 合計ジャッジ時間 | 9,857 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 39 WA * 33 |
コンパイルメッセージ
main.cpp: In function 'int sqrt(ll)':
main.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
12 | }
| ^
ソースコード
#include <string>
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<n; ++i)
int sqrt(ll x) {
for(int i=1; i<10; i++) if(x == i * i) return i;
}
int main() {
ll n;
cin >> n;
if(n == 2) {
cout << "? 0 1" << endl;
ll ret;
cin >> ret;
if(ret == 1) {
cout << "! 11" << endl;
} else if(ret == 25) {
cout << "! 55" << endl;
} else if(ret == 49) {
cout << "! 77" << endl;
} else if(ret == 64) {
cout << "! 88" << endl;
} else if(ret == 81) {
cout << "! 99" << endl;
} else {
cout << "! -1" << endl;
}
} else {
vector<ll> res(n);
rep(i, n-1){
cout << "? 0 " << i+1 << endl;
cin >> res[i+1];
if(res[i+1] == 0) {
cout << "! -1" << endl;
return 0;
}
}
cout << "? 1 2" << endl;
ll res12;
cin >> res12;
res[0] = res[1] * res[2] / res12;
ll a0 = sqrt(res[0]);
cout << "! ";
rep(i, n) {
cout << res[n-1-i] / a0;
}
cout << endl;
}
}