結果
問題 | No.1972 Modulo Set |
ユーザー | siman |
提出日時 | 2022-06-11 09:51:27 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 11,940 KB |
実行使用メモリ | 36,140 KB |
最終ジャッジ日時 | 2023-10-21 17:10:26 |
合計ジャッジ時間 | 6,851 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 90 ms
16,080 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 89 ms
16,356 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 92 ms
16,872 KB |
testcase_14 | AC | 93 ms
17,136 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 87 ms
16,084 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 141 ms
24,204 KB |
testcase_23 | AC | 209 ms
34,368 KB |
testcase_24 | AC | 129 ms
21,664 KB |
testcase_25 | AC | 154 ms
26,544 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 132 ms
24,680 KB |
testcase_29 | AC | 152 ms
26,432 KB |
testcase_30 | AC | 183 ms
32,744 KB |
testcase_31 | AC | 90 ms
16,612 KB |
testcase_32 | AC | 165 ms
27,576 KB |
testcase_33 | WA | - |
testcase_34 | AC | 228 ms
36,100 KB |
testcase_35 | AC | 230 ms
36,100 KB |
testcase_36 | AC | 227 ms
36,096 KB |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map(&:to_i) A = gets.split.map(&:to_i) counter = A.map { |a| a % M }.tally counter.default = 0 ans = [1, counter[0]].min checked = Hash.new(false) counter.each do |i, cnt| j = M - i next if checked[j] checked[i] = true checked[j] = true cnt_1 = ((i + i) % M == 0) ? [1, counter[i]].min : counter[i] cnt_2 = ((j + j) % M == 0) ? [1, counter[j]].min : counter[j] ans += [cnt_1, cnt_2].max end puts ans