結果
問題 | No.274 The Wall |
ユーザー | YosukeKawada |
提出日時 | 2018-01-09 15:22:03 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,006 bytes |
コンパイル時間 | 499 ms |
コンパイル使用メモリ | 11,508 KB |
実行使用メモリ | 50,168 KB |
最終ジャッジ日時 | 2023-08-25 02:20:53 |
合計ジャッジ時間 | 15,076 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 83 ms
15,124 KB |
testcase_01 | AC | 82 ms
15,148 KB |
testcase_02 | WA | - |
testcase_03 | AC | 84 ms
15,276 KB |
testcase_04 | AC | 82 ms
15,328 KB |
testcase_05 | AC | 83 ms
15,224 KB |
testcase_06 | AC | 82 ms
15,200 KB |
testcase_07 | AC | 82 ms
14,992 KB |
testcase_08 | AC | 85 ms
15,224 KB |
testcase_09 | AC | 83 ms
15,228 KB |
testcase_10 | AC | 82 ms
15,148 KB |
testcase_11 | AC | 87 ms
15,260 KB |
testcase_12 | AC | 1,867 ms
50,008 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 86 ms
15,476 KB |
testcase_17 | AC | 86 ms
15,300 KB |
testcase_18 | AC | 90 ms
15,124 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 1,279 ms
49,976 KB |
testcase_23 | AC | 1,274 ms
50,056 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
N,M = $stdin.gets.chomp.split(" ").map{ |a| a.to_i } lines = [] N.times { l,r = $stdin.gets.chomp.split(" ").map{ |a| a.to_i } lines << [l,r] } #p lines connection = (0...lines.size).map { |i| l0,r0 = *lines[i] vl0,vr0 = M-1-l0,M-1-r0 (0...lines.size).map { |j| next nil if i == j l1,r1 = *lines[j] ok1 = (r0 < l1 || r1 < l0) ok2 = (vr0 < l1 || r1 < vl0) case when ok1 && !ok2; +1 when !ok1 && ok2; -1 when ok1 && ok2; nil when !ok1 && !ok2 puts "NO" exit end } } #p connection status = (0..N).map{ nil } connection.each_with_index { |line,i| status[i] = status[i] || +1 line.each_with_index{ |c,j| case when i == j; next when c == +1 && status[j] == nil; status[j] = +status[i] when c == +1 && status[j] != status[i] puts "NO" exit when c == -1 && status[j] == nil; status[j] = -status[i] when c == -1 && status[j] == status[i] puts "NO" exit end } } #p status puts "YES"