結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | むらため |
提出日時 | 2019-01-19 15:19:48 |
言語 | Nim (2.0.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 3,181 ms |
コンパイル使用メモリ | 70,564 KB |
実行使用メモリ | 24,324 KB |
平均クエリ数 | 119.11 |
最終ジャッジ日時 | 2023-09-24 02:05:39 |
合計ジャッジ時間 | 4,812 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
23,328 KB |
testcase_01 | AC | 25 ms
23,568 KB |
testcase_02 | AC | 23 ms
23,724 KB |
testcase_03 | AC | 23 ms
23,484 KB |
testcase_04 | AC | 23 ms
23,844 KB |
testcase_05 | AC | 22 ms
23,748 KB |
testcase_06 | AC | 23 ms
24,312 KB |
testcase_07 | AC | 24 ms
24,312 KB |
testcase_08 | AC | 22 ms
23,568 KB |
testcase_09 | AC | 22 ms
23,904 KB |
testcase_10 | AC | 21 ms
24,024 KB |
testcase_11 | AC | 22 ms
23,604 KB |
testcase_12 | AC | 28 ms
24,228 KB |
testcase_13 | AC | 22 ms
23,664 KB |
testcase_14 | AC | 22 ms
23,868 KB |
testcase_15 | AC | 23 ms
23,712 KB |
testcase_16 | AC | 21 ms
24,324 KB |
testcase_17 | AC | 23 ms
24,228 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport] /home/judge/data/code/Main.nim(1, 47) Warning: imported and not used: 'macros' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() let A = newSeqWith(n,scan()) proc trySort(B:seq[int]) : seq[(int,int)] = var C = A for i in 0..<n: if C[i] == B[i]: continue for j in i+1..<n: if C[j] != B[i]: continue swap(C[i],C[j]) result &= (i,j) let r1 = A.sorted(cmp,Descending).trySort() let r2 = A.sorted(cmp,Ascending).trySort() let results = (if r1.len > r2.len: r2 else:r1) echo results.len() for rs in results: echo rs[0]," ",rs[1] discard stdin.readLine()