Task: | Osajono |
Sender: | Galax |
Submission time: | 2015-09-30 13:19:43 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.19 s | 1 | details |
#2 | RUNTIME ERROR | 0.17 s | 1 | details |
#3 | RUNTIME ERROR | 0.17 s | 1 | details |
#4 | RUNTIME ERROR | 0.18 s | 1 | details |
#5 | RUNTIME ERROR | 0.18 s | 1 | details |
#6 | RUNTIME ERROR | 0.17 s | 2 | details |
#7 | RUNTIME ERROR | 0.18 s | 2 | details |
#8 | RUNTIME ERROR | 0.17 s | 2 | details |
#9 | RUNTIME ERROR | 0.18 s | 2 | details |
#10 | RUNTIME ERROR | 0.17 s | 2 | details |
#11 | RUNTIME ERROR | 0.17 s | 3 | details |
#12 | RUNTIME ERROR | 0.18 s | 3 | details |
#13 | RUNTIME ERROR | 0.18 s | 3 | details |
#14 | RUNTIME ERROR | 0.18 s | 3 | details |
#15 | RUNTIME ERROR | 0.18 s | 3 | details |
Code
import java.util.ArrayList;import java.util.Scanner;public class Ohjelma {public static void main(String[] args) {IO io = new IO();int books = io.nextInt();ArrayList<Integer> uo = new ArrayList<>();/* String un = io.next();String temp = "";for (int i = 0; i < un.length(); i++) {if (un.charAt(i)==' ') {uo.add(Integer.parseInt(temp));temp = "";} else {temp+=un.charAt(i);}}*/for (int i = 0; i < books; i++) {uo.add(io.nextInt());}ArrayList<Integer> ma = new ArrayList<>();for (int i = 0; i < books; i++) {ma.add(io.nextInt());}/* uo.add(Integer.parseInt(temp));temp = "";String mas = io.next();for (int i = 0; i < mas.length(); i++) {if (mas.charAt(i)==' ') {ma.add(Integer.parseInt(temp));temp = "";} else {temp+=mas.charAt(i);}}ma.add(Integer.parseInt(temp));*/ArrayList<Integer> end = new ArrayList<>();for (int i = 0; i < books; i++) {end.add(0);}ArrayList<Integer> tempo = new ArrayList<>();ArrayList<Integer> tempo2 = new ArrayList<>();for (int i = 0; i < books; i++) {Boolean wasAdded = false;for (int j = 0; j < books; j++) {if (i+1 != ma.get(j) && i+1 != uo.get(j) && end.get(j)==0) {end.set(j, i+1);wasAdded = true;break;}}if (!wasAdded) {tempo.add(i+1);}}for (int i = 0; i < end.size(); i++) {if (end.get(i)==0) {tempo2.add(i);}}//tempo2 includes the positions of 0 ints//tempo includes the values not addedif (tempo.size()!=0) {for (int i = 0; i < books; i++) {if((tempo.get(0) != ma.get(i) && tempo.get(0) != uo.get(i))&& ma.get(tempo2.get(0)) != end.get(i) && uo.get(tempo2.get(0)) != end.get(i)) {int tem = end.get(i);end.set(i,tempo.get(0));end.set(tempo2.get(0),tem);break;}}}for (int i = 0; i < end.size(); i++) {io.print(end.get(i) + " ");}}}
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
BBBAABBBAAAABBAAAABAABAABBBBBB... |
correct output |
---|
2554 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 2
Group: 1
Verdict: RUNTIME ERROR
input |
---|
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL... |
correct output |
---|
299 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 3
Group: 1
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA... |
correct output |
---|
4314 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 4
Group: 1
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4231 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 5
Group: 1
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
5050 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
BBABABBBABBAABBABBABAABAAABABA... |
correct output |
---|
6253029 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 7
Group: 2
Verdict: RUNTIME ERROR
input |
---|
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG... |
correct output |
---|
485173 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 8
Group: 2
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
12427725 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
12467549 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 10
Group: 2
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
12502500 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 11
Group: 3
Verdict: RUNTIME ERROR
input |
---|
BAAAAABABBABAABAABABABBBABBAAB... |
correct output |
---|
2500051369 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 12
Group: 3
Verdict: RUNTIME ERROR
input |
---|
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR... |
correct output |
---|
192407124 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 13
Group: 3
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4998050400 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 14
Group: 3
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4998850144 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)
Test 15
Group: 3
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
5000050000 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(IO.java:111) at Ohjelma.main(Ohjelma.java:7)