結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2024-01-11 01:12:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 684 bytes |
| コンパイル時間 | 2,138 ms |
| コンパイル使用メモリ | 194,888 KB |
| 最終ジャッジ日時 | 2025-02-18 17:06:00 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 5 RE * 4 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
cout<<"? "<<1<<" "<<n<<endl;
int sum;
cin>>sum;
vector<int> ANS(n+1);
vector<int> A(n+1,1);
A[0]=0;
for(int i=n-1;i>=2;i--){
cout<<"? "<<1<<" "<<i<<endl;
int a;
cin>>a;
ANS[i+1]=sum-a;
A[sum-a]=0;
}
cout<<"? "<<2<<" "<<n<<endl;
int a;
cin>>a;
ANS[1]=sum-a;
A[sum-a]=0;
rep(i,n+1){
if(A[i]) ANS[2]=i;
}
cout<<'!';
for(int i=1;i<=n;i++) cout<<" "<<ANS[i];
cout<<endl;
return 0;
}
umezo