Task: | Sticky Situation |
Sender: | Koodi Ilolle |
Submission time: | 2017-09-26 17:40:03 +0300 |
Language: | Java |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.13 s | details |
#2 | ACCEPTED | 0.14 s | details |
#3 | ACCEPTED | 0.13 s | details |
#4 | ACCEPTED | 0.15 s | details |
#5 | ACCEPTED | 0.14 s | details |
#6 | ACCEPTED | 0.13 s | details |
#7 | ACCEPTED | 0.16 s | details |
#8 | ACCEPTED | 0.17 s | details |
#9 | ACCEPTED | 0.13 s | details |
#10 | ACCEPTED | 0.11 s | details |
#11 | ACCEPTED | 0.12 s | details |
#12 | ACCEPTED | 0.15 s | details |
#13 | ACCEPTED | 0.12 s | details |
#14 | ACCEPTED | 0.14 s | details |
#15 | ACCEPTED | 0.11 s | details |
#16 | ACCEPTED | 0.12 s | details |
#17 | ACCEPTED | 0.15 s | details |
#18 | ACCEPTED | 0.11 s | details |
#19 | ACCEPTED | 0.16 s | details |
#20 | ACCEPTED | 0.11 s | details |
#21 | ACCEPTED | 0.18 s | details |
#22 | ACCEPTED | 0.12 s | details |
#23 | ACCEPTED | 0.14 s | details |
#24 | ACCEPTED | 0.14 s | details |
#25 | ACCEPTED | 0.11 s | details |
#26 | ACCEPTED | 0.12 s | details |
#27 | ACCEPTED | 0.15 s | details |
#28 | ACCEPTED | 0.12 s | details |
#29 | ACCEPTED | 0.12 s | details |
#30 | ACCEPTED | 0.12 s | details |
#31 | ACCEPTED | 0.14 s | details |
#32 | ACCEPTED | 0.11 s | details |
#33 | ACCEPTED | 0.15 s | details |
#34 | ACCEPTED | 0.14 s | details |
#35 | ACCEPTED | 0.15 s | details |
#36 | ACCEPTED | 0.12 s | details |
#37 | ACCEPTED | 0.12 s | details |
#38 | TIME LIMIT EXCEEDED | -- | details |
#39 | ACCEPTED | 0.13 s | details |
Code
import java.util.Arrays; /* * 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. */ /** * * @author henpeura */ public class Sticky { public static void main(String[] args) { IO io = new IO(); int maara = io.nextInt(); long[] tikut = new long[maara]; for (int i = 0; i < maara; i++) { tikut[i] = io.nextLong(); } Arrays.sort(tikut); // System.out.println(Arrays.toString(tikut)); boolean valid = false; for (int i = 0; i < tikut.length; i++) { if (valid) { break; } for (int j = i + 1; j < tikut.length; j++) { if (valid) { break; } for (int k = i + 2; k < tikut.length; k++) { if (!(j > tikut.length - 1 || k > tikut.length - 1) && (i != j && j != k && i != k)) { long l = tikut[i]; long c = tikut[j]; long r = tikut[k]; /* System.out.println("###"); System.out.println(l); System.out.println(c); System.out.println(r); System.out.println("###"); */ if (validTriangle(l, c, r)) { valid = true; break; } } } } } /*for (int i = 0; i < tikut.length - 2; i++) { long l = tikut[i]; long c = tikut[i + 1]; long r = tikut[i + 2]; if (validTriangle(l, c, r)) { valid = true; break; } }*/ if (valid) { io.println("possible"); } else { io.println("impossible"); } io.close(); } private static boolean validTriangle(long l, long c, long r) { if (l == c && l == r && c == r) { return true; } double s = (l + c + r) / 2.0; // System.out.println(s * (s - l) * (s - c) * (s - r)); if (s * (s - l) * (s - c) * (s - r) <= 0) { return false; } return true; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
44 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 2
Verdict: ACCEPTED
input |
---|
506 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 3
Verdict: ACCEPTED
input |
---|
349 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 4
Verdict: ACCEPTED
input |
---|
555 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 5
Verdict: ACCEPTED
input |
---|
210 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 6
Verdict: ACCEPTED
input |
---|
757 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 7
Verdict: ACCEPTED
input |
---|
503 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 8
Verdict: ACCEPTED
input |
---|
419 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 9
Verdict: ACCEPTED
input |
---|
19 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 10
Verdict: ACCEPTED
input |
---|
515 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 11
Verdict: ACCEPTED
input |
---|
718 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 12
Verdict: ACCEPTED
input |
---|
204 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 13
Verdict: ACCEPTED
input |
---|
330 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 14
Verdict: ACCEPTED
input |
---|
862 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 15
Verdict: ACCEPTED
input |
---|
982 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 16
Verdict: ACCEPTED
input |
---|
494 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 17
Verdict: ACCEPTED
input |
---|
4 413658328434492816 42131811934... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 18
Verdict: ACCEPTED
input |
---|
967 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 19
Verdict: ACCEPTED
input |
---|
838 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 20
Verdict: ACCEPTED
input |
---|
449 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 21
Verdict: ACCEPTED
input |
---|
458 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 22
Verdict: ACCEPTED
input |
---|
635 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 23
Verdict: ACCEPTED
input |
---|
911 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 24
Verdict: ACCEPTED
input |
---|
156 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 25
Verdict: ACCEPTED
input |
---|
295 413658328434492816 42131811934... |
correct output |
---|
possible |
user output |
---|
possible |
Test 26
Verdict: ACCEPTED
input |
---|
88 1 1 2 3 5 8 13 21 34 55 89 144... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 27
Verdict: ACCEPTED
input |
---|
88 21 10610209857723 1836311903 7... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 28
Verdict: ACCEPTED
input |
---|
4 688138922692403404 53826514650... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 29
Verdict: ACCEPTED
input |
---|
6 1051054321739242054 6730047734... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 30
Verdict: ACCEPTED
input |
---|
8 3450451668468094 1119558431635... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 31
Verdict: ACCEPTED
input |
---|
10 43884608503565000 302405275242... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 32
Verdict: ACCEPTED
input |
---|
12 385129830092889 35573055922474... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 33
Verdict: ACCEPTED
input |
---|
14 3525644022645 589629197579404 ... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 34
Verdict: ACCEPTED
input |
---|
16 17995284407142 114231612799405... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 35
Verdict: ACCEPTED
input |
---|
18 6170861631849362 2060967377839... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 36
Verdict: ACCEPTED
input |
---|
61 1 4398046511104 8388608 687194... |
correct output |
---|
impossible |
user output |
---|
impossible |
Test 37
Verdict: ACCEPTED
input |
---|
89 1 1 2 3 5 8 13 21 34 55 89 144... |
correct output |
---|
possible |
user output |
---|
possible |
Test 38
Verdict: TIME LIMIT EXCEEDED
input |
---|
20000 1 1 2 3 5 8 13 21 34 55 89 144... |
correct output |
---|
possible |
user output |
---|
(empty) |
Test 39
Verdict: ACCEPTED
input |
---|
200 1 1125899906842624 1 109951162... |
correct output |
---|
possible |
user output |
---|
possible |