Submission #2861626


Source Code Expand

Copy
lines = $stdin.read
array = lines.split("\n")
 
TIME = 10**5*2
 
N,C = array[0].split(" ").map(&:to_i)
 
cumsum = Array.new(C).map{Array.new(TIME,0)}
 
array[1..N+1].each do |rec|
  s,t,c  = rec.split(" ").map(&:to_i)
  s,t=s*2-1,t*2     # double
  s,t,c=s-1,t-1,c-1 # 0-indexed
  cumsum[c][s] += 1
  cumsum[c][t] -= 1
end
 
ans = Array.new(TIME,0)
cumsum.each do |sum|
  for i in 1...sum.length
    sum[i] += sum[i-1]
    ans[i] += 1 if sum[i] > 0
  end
end
puts ans.max

Submission Info

Submission Time
Task D - Recording
User hiroyuking
Language Ruby (2.3.3)
Score 400
Code Size 497 Byte
Status
Exec Time 1418 ms
Memory 59772 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 400 / 400 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt 1366 ms 59772 KB
02.txt 1068 ms 51964 KB
03.txt 1244 ms 59772 KB
04.txt 1418 ms 59772 KB
05.txt 212 ms 13948 KB
06.txt 1025 ms 55164 KB
07.txt 961 ms 54396 KB
08.txt 881 ms 50300 KB
09.txt 1141 ms 59772 KB
10.txt 1102 ms 59772 KB
11.txt 1091 ms 59772 KB
12.txt 173 ms 11132 KB
13.txt 954 ms 50300 KB
14.txt 875 ms 50300 KB
15.txt 734 ms 42492 KB
16.txt 1107 ms 59772 KB
17.txt 1088 ms 59772 KB
18.txt 1188 ms 59772 KB
19.txt 1163 ms 59772 KB
sample_01.txt 75 ms 6524 KB
sample_02.txt 129 ms 9596 KB
sample_03.txt 129 ms 11644 KB