結果
問題 |
No.2124 Guess the Permutation
|
ユーザー |
![]() |
提出日時 | 2022-11-18 22:23:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 1,731 ms |
コンパイル使用メモリ | 194,980 KB |
最終ジャッジ日時 | 2025-02-08 21:54:29 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int query(int l, int r) { int res; cout << '?' << ' ' << l << ' ' << r << endl; cin >> res; return res; } int main() { int N; cin >> N; vector<int> S(N+1); S[1] = N*(N+1)/2-query(2, N); S[N] = N*(N+1)/2; for( int i = 2; i <= N-1; i++ ) S[i] = query(1, i); cout << '!'; for( int i = 1; i <= N; i++ ) cout << ' ' << S[i]-S[i-1]; cout << endl; }