Submission #523852


Source Code Expand

Copy
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 = 0
ng = {}

until queue.empty?
    x = queue[0][0]
    while !queue.empty? && queue[0][0] == x
        _, event, i = queue.shift
        if event == :start
            indices |= (1 << i)
        else
            indices -= (1 << i)
        end
    end
    ng[indices.to_s(2).size] = 1 if indices > 0 && (indices - 1) & indices == 0
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 580 Byte
Status
Exec Time 2044 ms
Memory 59736 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix
./Main.rb:5: warning: `&' interpreted as argument prefix
./Main.rb:27: warning: shadowing outer local variable - i
./Main.rb:1: 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 59 ms 5100 KB
subtask0_sample_02.txt 58 ms 5224 KB
subtask0_sample_03.txt 58 ms 5100 KB
subtask1_01.txt 2044 ms 59736 KB
subtask1_02.txt 2043 ms 40960 KB
subtask1_03.txt 2041 ms 22036 KB
subtask1_04.txt 2042 ms 21996 KB
subtask1_05.txt 2042 ms 21992 KB
subtask1_06.txt 74 ms 5068 KB
subtask1_07.txt 58 ms 5108 KB
subtask1_08.txt 58 ms 5148 KB
subtask1_09.txt 112 ms 5104 KB
subtask2_01.txt 2043 ms 22076 KB
subtask2_02.txt 2038 ms 23068 KB
subtask2_03.txt 63 ms 5096 KB
subtask2_04.txt 63 ms 5144 KB
subtask2_05.txt 61 ms 5100 KB
subtask2_06.txt 60 ms 5096 KB
subtask2_07.txt 60 ms 5228 KB
subtask2_08.txt 2041 ms 21896 KB