Task: | Counting Canals |
Sender: | thierry |
Submission time: | 2018-09-13 18:38:18 +0300 |
Language: | Java |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.14 s | details |
#2 | RUNTIME ERROR | 0.14 s | details |
#3 | RUNTIME ERROR | 0.14 s | details |
#4 | RUNTIME ERROR | 0.14 s | details |
#5 | RUNTIME ERROR | 0.15 s | details |
#6 | RUNTIME ERROR | 0.14 s | details |
#7 | RUNTIME ERROR | 0.14 s | details |
#8 | RUNTIME ERROR | 0.14 s | details |
#9 | RUNTIME ERROR | 0.14 s | details |
#10 | RUNTIME ERROR | 0.15 s | details |
#11 | RUNTIME ERROR | 0.54 s | details |
#12 | RUNTIME ERROR | 0.55 s | details |
#13 | RUNTIME ERROR | 0.53 s | details |
#14 | RUNTIME ERROR | 0.54 s | details |
#15 | RUNTIME ERROR | 0.54 s | details |
#16 | RUNTIME ERROR | 0.53 s | details |
#17 | RUNTIME ERROR | 0.53 s | details |
#18 | RUNTIME ERROR | 0.54 s | details |
#19 | RUNTIME ERROR | 0.54 s | details |
#20 | RUNTIME ERROR | 0.54 s | details |
#21 | RUNTIME ERROR | 0.53 s | details |
#22 | RUNTIME ERROR | 0.53 s | details |
#23 | RUNTIME ERROR | 0.54 s | details |
#24 | RUNTIME ERROR | 0.54 s | details |
#25 | RUNTIME ERROR | 0.54 s | details |
#26 | RUNTIME ERROR | 0.53 s | details |
#27 | RUNTIME ERROR | 0.54 s | details |
#28 | RUNTIME ERROR | 0.54 s | details |
#29 | RUNTIME ERROR | 0.54 s | details |
#30 | RUNTIME ERROR | 0.54 s | details |
Code
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class Viikko2e { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader s = new FastReader(); int n = s.nextInt(); int[][] sudoku = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int a = s.nextInt(); if (a > n) { System.out.println("NO"); break; } sudoku[i][j] = a; } } if (tarkista(n, sudoku)) { System.out.println("YES"); } else { System.out.println("NO"); } } private static boolean tarkista(int n, int[][] sudoku) { Set<Integer> setti = new HashSet<>(); for (int i = 0; i < n; i++) { for (int j = 0; i < n; i++) { int a = sudoku[i][j]; if (setti.contains(a)) { return false; } setti.add(a); } setti.clear(); } for (int i = 0; i < n; i++) { for (int j = 0; i < n; i++) { int a = sudoku[j][i]; if (setti.contains(a)) { return false; } setti.add(a); } } return true; } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
5 1 2 2 3 3 4 4 5 |
correct output |
---|
15 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 2
Verdict: RUNTIME ERROR
input |
---|
4 3 2 2 1 4 2 |
correct output |
---|
9 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 3
Verdict: RUNTIME ERROR
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 4
Verdict: RUNTIME ERROR
input |
---|
6 1 3 3 5 3 4 4 6 ... |
correct output |
---|
17 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 5
Verdict: RUNTIME ERROR
input |
---|
10 10 1 1 9 9 2 2 8 ... |
correct output |
---|
19 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 6
Verdict: RUNTIME ERROR
input |
---|
10 10 6 2 4 1 2 5 10 ... |
correct output |
---|
25 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 7
Verdict: RUNTIME ERROR
input |
---|
10 9 1 8 1 8 5 10 2 ... |
correct output |
---|
20 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 8
Verdict: RUNTIME ERROR
input |
---|
10 9 5 1 6 8 5 10 6 ... |
correct output |
---|
24 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 9
Verdict: RUNTIME ERROR
input |
---|
10 10 3 1 6 6 3 10 8 ... |
correct output |
---|
26 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 10
Verdict: RUNTIME ERROR
input |
---|
10 1 10 9 3 5 10 6 8 ... |
correct output |
---|
22 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.NullPointerException at java.base/java.util.StringTo...
Test 11
Verdict: RUNTIME ERROR
input |
---|
100000 61825 85829 24480 90462 1014 5496 81225 44931 ... |
correct output |
---|
3130799 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 12
Verdict: RUNTIME ERROR
input |
---|
100000 12328 59847 68010 51200 20911 42026 5769 15416 ... |
correct output |
---|
13958274 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 13
Verdict: RUNTIME ERROR
input |
---|
100000 20362 12728 7958 63236 52010 30403 43065 57339 ... |
correct output |
---|
15065805 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 14
Verdict: RUNTIME ERROR
input |
---|
100000 8572 72714 94149 74894 64167 42479 28114 53008 ... |
correct output |
---|
365273 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 15
Verdict: RUNTIME ERROR
input |
---|
100000 1978 36216 32844 35606 89082 19460 32960 67705 ... |
correct output |
---|
299957 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 16
Verdict: RUNTIME ERROR
input |
---|
100000 1 100000 2 100000 2 99999 3 99999 ... |
correct output |
---|
199999 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 17
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 2 3 3 4 4 5 ... |
correct output |
---|
5000050000 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 18
Verdict: RUNTIME ERROR
input |
---|
100000 26026 17578 2063 27495 18825 88516 73417 44243 ... |
correct output |
---|
300106 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 19
Verdict: RUNTIME ERROR
input |
---|
100000 62594 92916 39396 77445 39736 18145 51960 63921 ... |
correct output |
---|
305292 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 20
Verdict: RUNTIME ERROR
input |
---|
100000 35361 29834 80103 20628 56121 98538 96141 60130 ... |
correct output |
---|
299953 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 21
Verdict: RUNTIME ERROR
input |
---|
100000 83387 6566 1464 36071 83940 1947 30207 81630 ... |
correct output |
---|
18170796 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 22
Verdict: RUNTIME ERROR
input |
---|
100000 57048 59591 13592 7630 96625 65606 39702 62144 ... |
correct output |
---|
122357921 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 23
Verdict: RUNTIME ERROR
input |
---|
100000 665 16956 97424 82744 19070 82235 29207 21317 ... |
correct output |
---|
255370837 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 24
Verdict: RUNTIME ERROR
input |
---|
100000 73391 7794 48957 7794 10376 7794 68812 7794 ... |
correct output |
---|
661409588 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 25
Verdict: RUNTIME ERROR
input |
---|
100000 25428 93716 47665 20024 43005 47665 47665 4035 ... |
correct output |
---|
775090231 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 26
Verdict: RUNTIME ERROR
input |
---|
100000 88514 75301 20924 75301 8871 75301 26360 75301 ... |
correct output |
---|
1860034699 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 27
Verdict: RUNTIME ERROR
input |
---|
100000 31831 1 46505 1 76032 1 41560 1 ... |
correct output |
---|
199999 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 28
Verdict: RUNTIME ERROR
input |
---|
100000 38156 15310 92580 66280 10847 49530 8672 38794 ... |
correct output |
---|
27926764 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 29
Verdict: RUNTIME ERROR
input |
---|
100000 60300 13490 372 28166 4123 3653 97935 79942 ... |
correct output |
---|
27607584 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...
Test 30
Verdict: RUNTIME ERROR
input |
---|
100000 93798 40604 95227 14928 80126 98198 54474 67913 ... |
correct output |
---|
22603373 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Viikko2e.main(V...