結果
問題 | No.2124 Guess the Permutation |
ユーザー |
|
提出日時 | 2022-11-18 21:24:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 384 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 64,128 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 374.60 |
最終ジャッジ日時 | 2024-09-20 01:49:26 |
合計ジャッジ時間 | 1,570 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 2 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; int P[1000]; main() { cin>>N; int prv=N*(N+1)/2; for(int i=2;i<N;i++) { cout<<"? "<<i<<" "<<N<<endl; int t;cin>>t; P[i-1]=prv-t; prv=t; } cout<<"? "<<N-2<<" "<<N-1<<endl; int t;cin>>t; P[N-1]=t-P[N-2]; t=N*(N+1)/2; for(int i=1;i<N;i++)t-=P[i]; P[N]=t; cout<<"!"; for(int i=1;i<=N;i++)cout<<" "<<P[i]; cout<<endl; }