結果

問題 No.1640 簡単な色塗り
ユーザー simansiman
提出日時 2021-08-13 18:13:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 30,096 KB
最終ジャッジ日時 2023-09-12 04:07:26
合計ジャッジ時間 21,280 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,156 KB
testcase_01 AC 84 ms
15,144 KB
testcase_02 AC 82 ms
15,056 KB
testcase_03 AC 82 ms
15,060 KB
testcase_04 AC 435 ms
30,096 KB
testcase_05 AC 439 ms
29,992 KB
testcase_06 AC 83 ms
15,292 KB
testcase_07 WA -
testcase_08 AC 82 ms
15,288 KB
testcase_09 AC 84 ms
15,032 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 119 ms
16,932 KB
testcase_31 AC 375 ms
28,420 KB
testcase_32 AC 322 ms
26,872 KB
testcase_33 AC 243 ms
23,032 KB
testcase_34 AC 291 ms
26,320 KB
testcase_35 AC 234 ms
22,816 KB
testcase_36 AC 121 ms
17,056 KB
testcase_37 AC 135 ms
18,176 KB
testcase_38 AC 340 ms
26,988 KB
testcase_39 AC 177 ms
20,476 KB
testcase_40 AC 182 ms
20,524 KB
testcase_41 AC 286 ms
26,416 KB
testcase_42 AC 205 ms
21,552 KB
testcase_43 AC 207 ms
22,212 KB
testcase_44 AC 202 ms
21,636 KB
testcase_45 AC 168 ms
19,988 KB
testcase_46 AC 124 ms
16,956 KB
testcase_47 AC 108 ms
16,288 KB
testcase_48 AC 348 ms
27,320 KB
testcase_49 AC 97 ms
15,496 KB
testcase_50 AC 83 ms
15,096 KB
testcase_51 AC 82 ms
15,244 KB
testcase_52 WA -
testcase_53 WA -
07_evil_01.txt WA -
07_evil_02.txt WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
Q = []

N.times do |i|
  a, b = gets.split.map(&:to_i)

  Q << [i, [a, b]]
end

Q.sort_by! { |_i, (a, b)| [a, b].min }
checked = Array.new(N + 1, false)
ans = Array.new(N)

Q.each do |i, (a, b)|
  if not checked[a]
    ans[i] = a
    checked[a] = true
  elsif not checked[b]
    ans[i] = b
    checked[b] = true
  else
    puts 'No'
    exit
  end
end

puts 'Yes'
puts ans
0