結果
問題 | No.443 GCD of Permutation |
ユーザー | yuruhiya |
提出日時 | 2021-01-24 17:24:41 |
言語 | Crystal (1.11.2) |
結果 |
MLE
|
実行時間 | - |
コード長 | 373 bytes |
コンパイル時間 | 22,715 ms |
コンパイル使用メモリ | 263,364 KB |
実行使用メモリ | 808,300 KB |
最終ジャッジ日時 | 2023-09-13 13:23:27 |
合計ジャッジ時間 | 23,513 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
4,884 KB |
testcase_01 | AC | 3 ms
4,740 KB |
testcase_02 | AC | 2 ms
4,752 KB |
testcase_03 | AC | 3 ms
4,796 KB |
testcase_04 | AC | 3 ms
4,932 KB |
testcase_05 | AC | 4 ms
4,816 KB |
testcase_06 | AC | 3 ms
4,764 KB |
testcase_07 | AC | 3 ms
4,876 KB |
testcase_08 | AC | 3 ms
4,864 KB |
testcase_09 | AC | 3 ms
4,852 KB |
testcase_10 | AC | 3 ms
4,828 KB |
testcase_11 | AC | 3 ms
4,876 KB |
testcase_12 | AC | 2 ms
4,696 KB |
testcase_13 | AC | 3 ms
4,764 KB |
testcase_14 | AC | 3 ms
5,196 KB |
testcase_15 | AC | 760 ms
325,848 KB |
testcase_16 | AC | 89 ms
56,364 KB |
testcase_17 | AC | 212 ms
110,108 KB |
testcase_18 | MLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
ソースコード
lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end require "big" s = read_line num = s.to_big_i s = s.chars.map &.to_i n = s.size if s.count(s[0]) == n puts s.join exit end p num.gcd (0...n).to_a.combinations(2).map { |(i, j)| 9 * (s[i] - s[j]).abs }.reduce(0) { |i, j| i.gcd(j) }