結果

問題 No.2124 Guess the Permutation
ユーザー pratonpraton
提出日時 2022-11-25 01:49:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 391 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 170,464 KB
実行使用メモリ 38,548 KB
最終ジャッジ日時 2024-04-08 22:46:04
合計ジャッジ時間 8,173 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std; 
int main(){
  int N; cin >> N;
  vector<bool> used(N,false);
  vector<int> ans(N,-1);
  for(int i=0; i<N-1; i++){
    cout << "?" << i << i << endl;
    cout << flush;
    int k; cin >> k;
    ans[i]=k;
    used[k-1]=true;
  }
  for(int i=0; i<N; i++) if(!used[i]) ans[N-1]=i+1;
  cout << "!";
  for(int i=0; i<N; i++) cout << " " << ans[i];
}
0