Submission #630919


Source Code Expand

n=gets.to_i
pt=Array.new(n)
n.times{|i|
    x,y=gets.split(" ").map!(&:to_i);
    pt[i]=[x,y]
}
t=[0,0,0]
d=[0,0,0]
(0..(n-1)).to_a.combination(3).each{|e|
    x1=pt[e[0]][0]-pt[e[1]][0]
    y1=pt[e[0]][1]-pt[e[1]][1]
    x2=pt[e[1]][0]-pt[e[2]][0]
    y2=pt[e[1]][1]-pt[e[2]][1]
    x3=pt[e[2]][0]-pt[e[0]][0]
    y3=pt[e[2]][1]-pt[e[0]][1]
    d[0]=x1*x2+y1*y2
    d[1]=x2*x3+y2*y3
    d[2]=x3*x1+y3*y1
    if d.include?(0)
        t[1]+=1 
    elsif d.inject{|s,e|(s&&((s>0)^(e>0))) ? nil : s}
        t[0]+=1
    else
        t[2]+=1
    end
}

puts t*" "

Submission Info

Submission Time
Task D - 三角形の分類
User m_buyoh
Language Ruby (1.9.3p550)
Score 30
Code Size 588 Byte
Status TLE
Exec Time 7042 ms
Memory 4272 KB

Compile Error

./Main.rb:22: warning: shadowing outer local variable - e

Judge Result

Set Name sample subtask01 subtask02
Score / Max Score 0 / 0 30 / 30 0 / 70
Status
AC × 2
AC × 28
AC × 29
TLE × 25
Set Name Test Cases
sample sample-01.txt, sample-02.txt
subtask01 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, sample-01.txt, sample-02.txt
subtask02 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, 02-00.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt, 02-17.txt, 02-18.txt, 02-19.txt, 02-handmade00.txt, 02-handmade01.txt, 02-handmade02.txt, 02-handmade03.txt, 02-handmade04.txt, 02-handmade05.txt, sample-01.txt, sample-02.txt
Case Name Status Exec Time Memory
01-00.txt AC 50 ms 4048 KB
01-01.txt AC 50 ms 4112 KB
01-02.txt AC 49 ms 4072 KB
01-03.txt AC 52 ms 4072 KB
01-04.txt AC 55 ms 4088 KB
01-05.txt AC 82 ms 4072 KB
01-06.txt AC 82 ms 4072 KB
01-07.txt AC 546 ms 4108 KB
01-08.txt AC 542 ms 4112 KB
01-09.txt AC 547 ms 4196 KB
01-10.txt AC 550 ms 4064 KB
01-11.txt AC 547 ms 4064 KB
01-12.txt AC 545 ms 4072 KB
01-13.txt AC 550 ms 4072 KB
01-14.txt AC 542 ms 4068 KB
01-15.txt AC 551 ms 4108 KB
01-16.txt AC 562 ms 4108 KB
01-17.txt AC 566 ms 4104 KB
01-18.txt AC 583 ms 4068 KB
01-19.txt AC 566 ms 4124 KB
01-handmade00.txt AC 125 ms 4064 KB
01-handmade01.txt AC 541 ms 4060 KB
01-handmade02.txt AC 200 ms 4112 KB
01-handmade03.txt AC 515 ms 4120 KB
01-handmade04.txt AC 543 ms 4072 KB
01-handmade05.txt AC 550 ms 4064 KB
02-00.txt AC 4011 ms 4108 KB
02-01.txt TLE 7035 ms 4196 KB
02-02.txt TLE 7036 ms 4196 KB
02-03.txt TLE 7035 ms 4164 KB
02-04.txt TLE 7037 ms 4256 KB
02-05.txt TLE 7042 ms 4196 KB
02-06.txt TLE 7035 ms 4196 KB
02-07.txt TLE 7037 ms 4196 KB
02-08.txt TLE 7041 ms 4272 KB
02-09.txt TLE 7035 ms 4204 KB
02-10.txt TLE 7036 ms 4192 KB
02-11.txt TLE 7035 ms 4220 KB
02-12.txt TLE 7035 ms 4196 KB
02-13.txt TLE 7036 ms 4192 KB
02-14.txt TLE 7036 ms 4192 KB
02-15.txt TLE 7036 ms 4200 KB
02-16.txt TLE 7036 ms 4192 KB
02-17.txt TLE 7037 ms 4192 KB
02-18.txt TLE 7035 ms 4196 KB
02-19.txt TLE 7035 ms 4196 KB
02-handmade00.txt TLE 7035 ms 4192 KB
02-handmade01.txt TLE 7035 ms 4196 KB
02-handmade02.txt TLE 7035 ms 4240 KB
02-handmade03.txt TLE 7037 ms 4192 KB
02-handmade04.txt TLE 7035 ms 4192 KB
02-handmade05.txt TLE 7035 ms 4168 KB
sample-01.txt AC 52 ms 4068 KB
sample-02.txt AC 51 ms 4068 KB