結果
| 問題 | No.3501 Digit Products 2 |
| コンテスト | |
| ユーザー |
Tehom
|
| 提出日時 | 2026-04-17 22:49:10 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,445 bytes |
| 記録 | |
| コンパイル時間 | 2,990 ms |
| コンパイル使用メモリ | 274,124 KB |
| 実行使用メモリ | 30,320 KB |
| 平均クエリ数 | 2.85 |
| 最終ジャッジ日時 | 2026-04-17 22:50:16 |
| 合計ジャッジ時間 | 24,311 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | WA * 11 RE * 61 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;}
template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;}
void solve(){
int n; cin >> n;
int l=-1,lx=-1;
int r=-1,rx=-1;
vector<int> ans(n,-1);
int now=n-2;
bool can=true;
while(1){
cout << "? " << n-1 << " " << now << endl;
int x; cin >> x;
if(x == 0){
ans[now]=0;
now--;
}
else{
if(l == -1){
l=now;
lx=x;
now--;
}
else if(r == -1){
r=now;
rx=x;
cout << "? " << l << " " << r << endl;
int y; cin >> y;
ans[n-1]=sqrt(lx*rx/y);
ans[l]=lx/ans[n-1];
ans[r]=rx/ans[n-1];
now--;
}
else{
ans[now]=x/ans[n-1];
now--;
}
}
if(now == -1){
if(ans[n-1] == -1){
cout << "! -1" << endl;
}
else{
for(int i=n-1;i>=0;i--){
cout << ans[i];
}
cout << endl;
}
return;
}
}
return;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T=1;
// cin >> T;
while(T--) solve();
}
Tehom