Submission #524008


Source Code Expand

Copy
n, m = gets.split(' ').map(&:to_i)
area = Array.new(m).map{Array.new(2)}

m.times do |i|
    area[i][0], area[i][1] = gets.split(' ').map(&:to_i)
end

ca = Array.new(n).map{Array.new(1,0)}
ca.each do |c|
    c[1] = Array.new()
end

m.times do |i|
    for j in (area[i][0]-1)..(area[i][1]-1)
        ca[j][0] += 1
        ca[j][1].push(i+1)
    end
end

cca = Array.new
ccaa = []
ca.each_with_index do |c, i|
    if c[0] > 1 
        cca.push(c[1])
        c[1].each do |cc|
            ccaa.push(cc)
        end
    end
end

ansc = 0
ansa = []
ccaa.uniq.each do |p|
    count = 0
    cca.each do |pp|
        if pp.include?(p)
            count += 1
        end
    end
    if count > area[p-1][1] - area[p-1][0]
        ansc +=1
        ansa.push(p)
    end
end

puts ansc
puts ansa

Submission Info

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

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 60 ms 5256 KB
subtask0_sample_02.txt 60 ms 5100 KB
subtask0_sample_03.txt 61 ms 5100 KB
subtask1_01.txt 1002 ms 44508 KB
subtask1_02.txt 2047 ms 58968 KB
subtask1_03.txt 2044 ms 43776 KB
subtask1_04.txt 2042 ms 36528 KB
subtask1_05.txt 2043 ms 36696 KB
subtask1_06.txt 94 ms 5220 KB
subtask1_07.txt 64 ms 5096 KB
subtask1_08.txt 64 ms 5268 KB
subtask1_09.txt 67 ms 5100 KB
subtask2_01.txt 2049 ms 92260 KB
subtask2_02.txt 2051 ms 92256 KB
subtask2_03.txt 110 ms 5224 KB
subtask2_04.txt 104 ms 5224 KB
subtask2_05.txt 104 ms 5224 KB
subtask2_06.txt 101 ms 5224 KB
subtask2_07.txt 122 ms 5312 KB
subtask2_08.txt 2046 ms 69376 KB