結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー 小野寺健小野寺健
提出日時 2021-11-14 15:06:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 970 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 211,124 KB
最終ジャッジ日時 2023-08-19 21:43:17
合計ジャッジ時間 12,890 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,316 KB
testcase_01 AC 505 ms
210,688 KB
testcase_02 AC 86 ms
15,008 KB
testcase_03 AC 87 ms
15,080 KB
testcase_04 AC 88 ms
15,300 KB
testcase_05 AC 875 ms
210,928 KB
testcase_06 AC 845 ms
210,816 KB
testcase_07 AC 923 ms
210,972 KB
testcase_08 AC 970 ms
211,056 KB
testcase_09 AC 836 ms
210,892 KB
testcase_10 AC 833 ms
211,124 KB
testcase_11 AC 831 ms
211,048 KB
testcase_12 AC 830 ms
211,048 KB
testcase_13 AC 898 ms
210,792 KB
testcase_14 AC 86 ms
16,056 KB
testcase_15 AC 85 ms
16,060 KB
testcase_16 AC 85 ms
15,900 KB
testcase_17 AC 98 ms
15,824 KB
testcase_18 AC 98 ms
16,080 KB
testcase_19 AC 95 ms
15,912 KB
testcase_20 AC 93 ms
15,868 KB
testcase_21 AC 95 ms
15,820 KB
testcase_22 AC 96 ms
15,824 KB
testcase_23 AC 87 ms
15,148 KB
testcase_24 AC 83 ms
15,116 KB
testcase_25 AC 82 ms
15,244 KB
testcase_26 AC 81 ms
15,220 KB
testcase_27 AC 82 ms
15,088 KB
testcase_28 AC 81 ms
15,152 KB
testcase_29 AC 79 ms
15,300 KB
testcase_30 AC 84 ms
15,292 KB
testcase_31 AC 83 ms
15,276 KB
testcase_32 AC 83 ms
15,216 KB
testcase_33 AC 82 ms
15,120 KB
testcase_34 AC 82 ms
15,008 KB
testcase_35 AC 83 ms
15,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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"
0