Submission #523699


Source Code Expand

Copy
require 'set'

n, m = gets.split.map &:to_i

queue = []
(1..m).each{|i|
    s, t = gets.split.map &:to_i
    queue << [s, :start, i]
    queue << [t+1, :end, i]
}
queue.sort!
indices = Set.new
ng = {}

until queue.empty?
    x = queue[0][0]
    while !queue.empty? && queue[0][0] == x
        _, event, i = queue.shift
        if event == :start
            indices << i
        else
            indices.delete(i)
        end
    end
    ng[indices.to_a[0]] = 1 if indices.size == 1
end

p m - ng.size
(1..m).each{|i| p i unless ng[i]}

Submission Info

Submission Time
Task B - ドキドキデート大作戦高橋君
User QtaroKujo
Language Ruby (2.1.5p273)
Score 0
Code Size 563 Byte
Status
Exec Time 2042 ms
Memory 28520 KB

Compile Error

./Main.rb:3: warning: `&' interpreted as argument prefix
./Main.rb:7: warning: `&' interpreted as argument prefix
./Main.rb:29: warning: shadowing outer local variable - i
./Main.rb:3: warning: assigned but unused variable - n

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Subtask1 0 / 30 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
All 0 / 70 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 185 ms 5484 KB
subtask0_sample_02.txt 68 ms 5332 KB
subtask0_sample_03.txt 67 ms 5356 KB
subtask1_01.txt 870 ms 28520 KB
subtask1_02.txt 2042 ms 23660 KB
subtask1_03.txt 2042 ms 22172 KB
subtask1_04.txt 2041 ms 22124 KB
subtask1_05.txt 2042 ms 22120 KB
subtask1_06.txt 68 ms 5356 KB
subtask1_07.txt 67 ms 5352 KB
subtask1_08.txt 73 ms 5356 KB
subtask1_09.txt 68 ms 5356 KB
subtask2_01.txt 2041 ms 22124 KB
subtask2_02.txt 2041 ms 23272 KB
subtask2_03.txt 73 ms 5352 KB
subtask2_04.txt 67 ms 5352 KB
subtask2_05.txt 68 ms 5352 KB
subtask2_06.txt 71 ms 5344 KB
subtask2_07.txt 68 ms 5356 KB
subtask2_08.txt 2041 ms 22252 KB