結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-01-23 21:07:05 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 393 bytes | 
| コンパイル時間 | 2,229 ms | 
| コンパイル使用メモリ | 61,460 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-01 10:38:48 | 
| 合計ジャッジ時間 | 3,635 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
ソースコード
import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord
let n = scan()
let A = newSeqWith(n,scan())
var ans = 0
var maxN = n
for i in countdown(A.len-1,0):
  if A[i] == maxN :
    maxN -= 1
    continue
  ans += 1
echo ans
            
            
            
        