Submission #523966


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, (1<<i-1)]
    queue << [t+1, -(1<<i-1)]
}
queue.sort_by!(&:first)
indices = 0
ng = {}

until queue.empty?
    x = queue[0][0]
    while !queue.empty? && queue[0][0] == x
        _, event = queue.shift
        indices += event
    end
    ng[indices.to_s(2).size] = 1 if indices > 0 && (indices & (indices - 1) == 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 497 Byte
Status
Exec Time 2119 ms
Memory 703452 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix
./Main.rb:5: warning: `&' interpreted as argument prefix
./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 57 ms 5096 KB
subtask0_sample_02.txt 60 ms 5096 KB
subtask0_sample_03.txt 57 ms 5096 KB
subtask1_01.txt 2118 ms 684736 KB
subtask1_02.txt 2114 ms 700736 KB
subtask1_03.txt 2119 ms 703452 KB
subtask1_04.txt 2115 ms 697448 KB
subtask1_05.txt 2115 ms 692292 KB
subtask1_06.txt 57 ms 5096 KB
subtask1_07.txt 56 ms 5100 KB
subtask1_08.txt 56 ms 5144 KB
subtask1_09.txt 53 ms 5100 KB
subtask2_01.txt 2118 ms 691688 KB
subtask2_02.txt 2111 ms 665280 KB
subtask2_03.txt 58 ms 5100 KB
subtask2_04.txt 59 ms 5080 KB
subtask2_05.txt 57 ms 5140 KB
subtask2_06.txt 58 ms 5100 KB
subtask2_07.txt 59 ms 5100 KB
subtask2_08.txt 2107 ms 693352 KB