結果

問題 No.2124 Guess the Permutation
ユーザー mino_yellowmino_yellow
提出日時 2022-11-22 03:06:09
言語 PHP
(8.3.4)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 7,376 ms
コンパイル使用メモリ 32,304 KB
実行使用メモリ 49,116 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-23 21:14:26
合計ジャッジ時間 11,188 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
49,112 KB
testcase_01 AC 63 ms
49,112 KB
testcase_02 AC 63 ms
49,112 KB
testcase_03 AC 64 ms
49,112 KB
testcase_04 AC 65 ms
49,112 KB
testcase_05 AC 66 ms
49,112 KB
testcase_06 AC 81 ms
49,112 KB
testcase_07 AC 95 ms
49,116 KB
testcase_08 AC 95 ms
49,116 KB
testcase_09 AC 96 ms
49,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
fscanf(STDIN,"%d",$N);
$tot = 0;
$memo = array_fill(1,$N,false);
for($i=1;$i<=$N;++$i) $tot += $i;
$tot_ = $tot;

for($i=2;$i<$N;++$i){
    echo implode(" ",["?",$i,$N]) . PHP_EOL;
    fscanf(STDIN,"%d",$x);
    $ans[] = $tot - $x;
    $tot -= end($ans);
}

echo implode(" ",["?",1,$N-1]) . PHP_EOL;
fscanf(STDIN,"%d",$x);
$last = $tot_ - $x;
$ans[] = $tot_ - array_sum($ans) - $last;
$ans[] = $last;
echo "! " . implode(" ",$ans) . PHP_EOL;



?>
0