結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
![]() |
提出日時 | 2024-11-27 13:08:24 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 3,815 ms |
コンパイル使用メモリ | 70,272 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 13:08:31 |
合計ジャッジ時間 | 4,723 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 |
ソースコード
import sequtils, strutils, tableslet t = parseInt readLine stdinproc fn(): bool =letn = parseInt readLine stdina = stdin.readLine.split.map parseIntcntT = a.toCountTableif a[0] != 1: return falseif a[^1] != n: return falseif cntT.largest.val != 2: return falseif cntT.smallest.val != 2: return falsefor i in 1 .. a.high:let x = abs a[i] - a[pred i]if x notin [1, pred n]: return falsereturn truefor _ in 0 ..< t:echo if fn(): "Yes" else: "No"