| Task: | Osajono |
| Sender: | Maunuliini |
| Submission time: | 2015-10-02 15:29:40 +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.17 s | 1 | details |
| #2 | RUNTIME ERROR | 0.17 s | 1 | details |
| #3 | RUNTIME ERROR | 0.17 s | 1 | details |
| #4 | RUNTIME ERROR | 0.17 s | 1 | details |
| #5 | RUNTIME ERROR | 0.17 s | 1 | details |
| #6 | RUNTIME ERROR | 0.18 s | 2 | details |
| #7 | RUNTIME ERROR | 0.17 s | 2 | details |
| #8 | RUNTIME ERROR | 0.17 s | 2 | details |
| #9 | RUNTIME ERROR | 0.19 s | 2 | details |
| #10 | RUNTIME ERROR | 0.18 s | 2 | details |
| #11 | RUNTIME ERROR | 0.19 s | 3 | details |
| #12 | RUNTIME ERROR | 0.18 s | 3 | details |
| #13 | RUNTIME ERROR | 0.19 s | 3 | details |
| #14 | RUNTIME ERROR | 0.18 s | 3 | details |
| #15 | RUNTIME ERROR | 0.18 s | 3 | 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.
*/
/**
*
* @author alexey
*/
import java.util.*;
public class Datatahti201641 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
//Scanner cfg=new Scanner(System.in);
IO io =new IO();
int city=io.nextInt();
int connect=io.nextInt();
long[][] cities = new long[city+1][2];
int i=1;
while(i<city+1){
cities[i][0]=Long.MAX_VALUE;
cities[i][1]=Long.MAX_VALUE;
i++;
}
cities[1][0]=0;
cities[1][1]=0;
ArrayList<ArrayList<int[]>> connections= new ArrayList<ArrayList<int[]>>();
connections.add(new ArrayList());
for (int j = 0; j < city; j++) {
connections.add(new ArrayList<int[]>());
}
for (int j = 0; j < connect; j++) {
int a=io.nextInt();
int b=io.nextInt();
int c=io.nextInt();
int[] d =new int[2];
d[0]=b;
d[1]=c;
connections.get(a).add(d);
}
Set check = new HashSet();
Set check2 = new HashSet();
check.add(1);
while(true){
for(Object b:check){
int a=(Integer) b;
for(int[] k:connections.get(a)){
long x=cities[k[0]][0];
long y=k[1]+cities[a][1];
if(x>y){
check2.add(k[0]);
cities[k[0]][0]=y;
}
}
}
check.clear();
if(check2.isEmpty()){
break;
}
for(Object c:check2){
int a= (Integer) c;
for(int[] k:connections.get(a)){
long x=cities[k[0]][1];
long y=cities[a][0];
if(x>y){
check.add(k[0]);
cities[k[0]][1]=y;
}
}
}
if(check.isEmpty()){
break;
}
check2.clear();
}
io.println(Math.min(cities[city][0], cities[city][1]));
io.close();
}
}
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
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 Datatahti201641.main(Datatahti201641.java:24)
