結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
kokatsu
|
| 提出日時 | 2022-11-18 21:29:41 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 496 bytes |
| コンパイル時間 | 2,808 ms |
| コンパイル使用メモリ | 211,024 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2024-06-22 16:42:48 |
| 合計ジャッジ時間 | 4,460 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
import std;
void main() {
int N;
readf("%d\n", N);
auto res = new int[](N);
int ttl= N * (N + 1) / 2, rem = ttl;
foreach (i; 0 .. N-2) {
writefln("? %d %d", i+2, N);
stdout.flush;
int S;
readf("%d\n", S);
res[i] = rem - S;
rem -= res[i];
}
writefln("? %d %d", 1, N-1);
stdout.flush;
int S;
readf("%d\n", S);
res[N-2] = S - res.sum;
res[N-1] = ttl - res.sum;
writefln("! %(%s %)", res);
}
kokatsu