Task: | Forest |
Sender: | Anonyymit Algoritmistit |
Submission time: | 2015-09-16 18:59:11 +0300 |
Language: | Java |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.19 s | details |
#2 | ACCEPTED | 0.18 s | details |
#3 | WRONG ANSWER | 0.18 s | details |
#4 | WRONG ANSWER | 0.18 s | details |
#5 | WRONG ANSWER | 0.18 s | details |
#6 | WRONG ANSWER | 0.20 s | details |
#7 | WRONG ANSWER | 0.17 s | details |
#8 | WRONG ANSWER | 0.18 s | details |
#9 | WRONG ANSWER | 0.18 s | details |
#10 | WRONG ANSWER | 0.18 s | details |
#11 | WRONG ANSWER | 0.25 s | details |
#12 | WRONG ANSWER | 0.25 s | details |
#13 | WRONG ANSWER | 0.27 s | details |
#14 | WRONG ANSWER | 0.26 s | details |
#15 | WRONG ANSWER | 0.28 s | details |
#16 | WRONG ANSWER | 0.29 s | details |
#17 | WRONG ANSWER | 0.29 s | details |
#18 | WRONG ANSWER | 0.27 s | details |
#19 | WRONG ANSWER | 0.29 s | details |
#20 | WRONG ANSWER | 0.29 s | details |
Code
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package kilo.v2.t2; import java.util.ArrayList; import java.util.Iterator; /** * * @author asjuvone */ public class KILOV2T2 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here IO io = new IO(); int n = io.nextInt(); int uloeviX = io.nextInt(); int uloeviY = io.nextInt(); Pari uolevi = new Pari(uloeviX, uloeviY); int nakee = n; ArrayList<Pari> parit = new ArrayList(); for (int i = 0; i < n; i++) { int x = io.nextInt(); int y = io.nextInt(); Pari uus = new Pari(x, y); parit.add(uus); } for (Iterator<Pari> it = parit.iterator(); it.hasNext();) { Pari pari = it.next(); for (Pari piste : parit) { if (piste.equals(pari)) continue; if (onksPisteSuoral(piste, pari, uolevi)) { nakee--; it.remove(); break; } } } System.out.println(parit.size()); } static boolean onksPisteSuoral(Pari piste, Pari suora1, Pari suora2) { if (piste.y < Math.max(suora1.y, suora2.y) && piste.x > Math.min(suora1.x, suora2.x) && piste.y > Math.min(suora1.y, suora2.y) && piste.x < Math.max(suora1.x, suora2.x)) { if (piste.y == (suora1.x * suora2.y) / suora2.x ) { return true; } } return false; } // static boolean onkoPisteSuoralla(Pari piste, Pari suora1, Pari suora2) { // //Lasketaan pisteen etäisyys suorasta ja jos se on 0 niin true, muuten false; // int x1 = suora1.x; // int x2 = suora2.x; // int y1 = suora1.y; // int y2 = suora2.y; // int x3 = piste.x; // int y3 = piste.y; // // double ylaosa = Math.abs((x1 * y2) - (x2 * y1) + (x2 * y3) - (x3 - y2) + (x3 * y1) - (x1 * y3)); // // double alaosa = (Math.pow(suora1.x - suora2.x, 2) + Math.pow(suora1.y - suora2.y, 2)); // System.out.println(ylaosa / alaosa); // return (ylaosa / alaosa) < 0.05; // } } class Pari { long x; long y; public Pari(long x, long y) { this.x = x; this.y = y; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
152
391446 44026 391450 44026 391448 44028 391450 44028 ... |
correct output |
---|
117 |
user output |
---|
112 |
Test 2
Verdict: ACCEPTED
input |
---|
167
-395738 -130738 -395745 -130742 -395739 -130735 -395746 -130731 ... |
correct output |
---|
124 |
user output |
---|
124 |
Test 3
Verdict: WRONG ANSWER
input |
---|
183
200778 460834 200784 460841 200769 460836 200773 460830 ... |
correct output |
---|
132 |
user output |
---|
181 |
Test 4
Verdict: WRONG ANSWER
input |
---|
130
223758 419977 223753 419974 223762 419974 223759 419983 ... |
correct output |
---|
97 |
user output |
---|
127 |
Test 5
Verdict: WRONG ANSWER
input |
---|
168
375864 397759 375855 397764 375855 397757 375866 397758 ... |
correct output |
---|
124 |
user output |
---|
149 |
Test 6
Verdict: WRONG ANSWER
input |
---|
187
-23941 284266 -113941 -30734 -113941 689266 -203941 329266 ... |
correct output |
---|
134 |
user output |
---|
187 |
Test 7
Verdict: WRONG ANSWER
input |
---|
127
260079 -413943 440079 -53943 575079 36057 530079 -773943 ... |
correct output |
---|
98 |
user output |
---|
127 |
Test 8
Verdict: WRONG ANSWER
input |
---|
144
411083 460318 366083 145318 771083 865318 411083 685318 ... |
correct output |
---|
109 |
user output |
---|
144 |
Test 9
Verdict: WRONG ANSWER
input |
---|
135
-460235 328576 -145235 553576 -910235 688576 -280235 58576 ... |
correct output |
---|
98 |
user output |
---|
135 |
Test 10
Verdict: WRONG ANSWER
input |
---|
113
390086 -474936 -59914 -609936 480086 -879936 345086 -204936 ... |
correct output |
---|
86 |
user output |
---|
113 |
Test 11
Verdict: WRONG ANSWER
input |
---|
1921
221773 -175524 -75227 -72024 -75227 -72023 527773 -22524 ... |
correct output |
---|
1866 |
user output |
---|
1921 |
Test 12
Verdict: WRONG ANSWER
input |
---|
1960
-166870 -301876 4130 -45376 4129 -45376 4130 -45377 ... |
correct output |
---|
1891 |
user output |
---|
1960 |
Test 13
Verdict: WRONG ANSWER
input |
---|
1983
490468 217759 85468 357259 791968 631759 76468 150259 ... |
correct output |
---|
1917 |
user output |
---|
1983 |
Test 14
Verdict: WRONG ANSWER
input |
---|
1910
75208 56523 340708 452523 340708 452522 -356792 430023 ... |
correct output |
---|
1863 |
user output |
---|
1910 |
Test 15
Verdict: WRONG ANSWER
input |
---|
1984
-178901 -113059 -381401 12941 -381400 12941 -381401 12940 ... |
correct output |
---|
1932 |
user output |
---|
1984 |
Test 16
Verdict: WRONG ANSWER
input |
---|
2000
-318296 48998 -322618 47556 -335584 43230 -300516 32354 ... |
correct output |
---|
1794 |
user output |
---|
1988 |
Test 17
Verdict: WRONG ANSWER
input |
---|
2000
-376251 158360 -373641 158980 -386177 169482 -387909 155698 ... |
correct output |
---|
1796 |
user output |
---|
1993 |
Test 18
Verdict: WRONG ANSWER
input |
---|
2000
4141 -447930 22987 -450556 22988 -450556 8931 -452688 ... |
correct output |
---|
1797 |
user output |
---|
2000 |
Test 19
Verdict: WRONG ANSWER
input |
---|
2000
-83018 -8575 -84778 -5615 -84778 -5616 -84778 -5614 ... |
correct output |
---|
1819 |
user output |
---|
1999 |
Test 20
Verdict: WRONG ANSWER
input |
---|
2000
-199417 -261684 -204449 -244760 -219545 -193988 -183653 -255010 ... |
correct output |
---|
1803 |
user output |
---|
1999 |