結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
|
提出日時 | 2021-11-14 15:06:18 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 1,079 ms / 2,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 221 ms |
コンパイル使用メモリ | 7,168 KB |
実行使用メモリ | 207,872 KB |
最終ジャッジ日時 | 2024-11-29 17:55:31 |
合計ジャッジ時間 | 12,936 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split(" ").map{|s| s.to_i} V = Array.new(N) {Array.new(N, 0)} M.times { a, b = gets.split(" ").map{|s| s.to_i} V[a-1][b-1] = V[b-1][a-1] = 1 } cnt = 0 change = true while change do change = false 0.upto(N-1) {|i| if V[i].sum == 1 then j = V[i].index(1) V[i][j] = V[j][i] = 0 change = true cnt += 1 end } end puts cnt % 2 == 1 ? "Yes" : "No"