結果
| 問題 | No.2124 Guess the Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-18 21:48:23 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 500 bytes |
| 記録 | |
| コンパイル時間 | 1,176 ms |
| コンパイル使用メモリ | 214,228 KB |
| 実行使用メモリ | 29,776 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2026-06-28 13:51:26 |
| 合計ジャッジ時間 | 2,563 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<bool>u(N+1);
vector<int>ans(N);
cout<<"? 2 "<<N<<endl;
int S;
cin>>S;
ans[0]=(N+1)*(N)/2-S;
u[ans[0]]=true;
for(int i=1;i<N-1;i++){
cout<<"? "<<i<<' '<<i+1<<endl;
int s;
cin>>s;
ans[i]=s-ans[i-1];
u[ans[i]]=true;
}
for(int i=1;i<=N;i++){
if(!u[i])ans[N-1]=i;
}
cout<<'!';
for(int i:ans)cout<<' '<<i;
cout<<endl;
}