結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-18 21:25:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 384 bytes |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 65,584 KB |
| 実行使用メモリ | 25,232 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2024-09-20 01:50:44 |
| 合計ジャッジ時間 | 1,663 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
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[1001];
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;
}