CSES - KILO 2016 3/5 - Results
Submission details
Task:Ice cream
Sender:PILIPOJAT!!
Submission time:2016-09-20 17:36:37 +0300
Language:Java
Status:READY
Result:
Test results
testverdicttime
#10.31 sdetails
#20.31 sdetails
#30.46 sdetails
#40.43 sdetails
#50.13 sdetails
#60.33 sdetails
#70.29 sdetails
#80.44 sdetails
#90.44 sdetails
#100.39 sdetails
#110.41 sdetails
#120.41 sdetails
#130.55 sdetails
#140.56 sdetails
#150.34 sdetails
#160.37 sdetails
#170.41 sdetails
#180.51 sdetails
#190.55 sdetails
#200.43 sdetails

Code

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author guest-FUber2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Map<Integer, Integer> maku = new HashMap<Integer, Integer>();
        Map<Integer, List<Integer>> verkko = new HashMap<Integer, List<Integer>>();
        
        IO io = new IO();
        int  n = io.nextInt();
        int m = io.nextInt();
        
        for(int i = 1; i < n+1; i++) {//lisätään maut
            maku.put(i, io.nextInt());
            verkko.put(i, new ArrayList<>());
        }
        
        for(int i = 1;  i < m+1; i++){
            int eka = io.nextInt();
            int toka = io.nextInt();
            verkko.get(eka).add(toka);
            verkko.get(toka).add(eka);
        }
        
        int[] vastaukset = new int[n];
        int offset = 0;
        List<Integer> apu = new ArrayList<>();
        for(int i : verkko.keySet()){
            apu.clear();
            apu.add(maku.get(i));
            
            for(int j : verkko.get(i)){
                if(!apu.contains(maku.get(j))){
                    apu.add(maku.get(j));
                }
            }
            vastaukset[offset++] = apu.size();
        }
        String output = Arrays.toString(vastaukset).replaceAll(",", "");
        System.out.println(output.substring(1, output.length() - 1));
    }

}

Test details

Test 1

Verdict:

input
47623 1000
6085 3581 2784 1594 9991 7789 ...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 2

Verdict:

input
29933 10000
37075 97477 24892 91827 86196 ...

correct output
2 6 1 1 5 1 1 7 9 2 2 2 1 1 3 ...

user output
2 3 1 1 4 1 1 2 2 2 2 2 1 1 2 ...

Test 3

Verdict:

input
82771 50000
84 19 10 43 44 51 77 9 4 1 21 ...

correct output
2 1 1 1 100 1 1 1 100 100 1 1 ...

user output
2 1 1 1 2 1 1 1 2 4 1 1 3 4 3 ...

Test 4

Verdict:

input
11645 100000
3041 8953 9167 1268 2312 5911 ...

correct output
6836 6836 6836 6836 6836 6836 ...

user output
24 25 16 18 17 25 17 13 20 16 ...

Test 5

Verdict:

input
1041 100
43553 8035 14355 19335 24786 7...

correct output
2 1 1 3 1 1 1 2 1 1 1 1 3 1 1 ...

user output
2 1 1 2 1 1 1 2 1 1 1 1 2 1 1 ...

Test 6

Verdict:

input
55898 1000
73 44 15 26 63 51 15 71 73 48 ...

correct output
1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 ...

Test 7

Verdict:

input
12027 10000
2456 845 5196 3813 3093 2331 2...

correct output
2 5542 5542 1 5542 5542 5542 5...

user output
2 2 2 1 2 5 4 4 1 3 2 6 2 5 1 ...

Test 8

Verdict:

input
55977 50000
79310 84043 72794 74090 312 15...

correct output
1 33498 33498 33498 33498 1 1 ...

user output
1 3 3 3 4 1 1 5 2 3 7 2 3 4 5 ...

Test 9

Verdict:

input
16237 100000
57 43 3 66 59 10 24 41 56 23 5...

correct output
100 100 100 100 100 100 100 10...

user output
17 11 14 11 15 9 5 11 9 14 7 7...

Test 10

Verdict:

input
93552 100
31 7952 1106 2779 1980 8776 56...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 11

Verdict:

input
100000 1000
99793 93845 56091 42020 27225 ...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 12

Verdict:

input
100000 10000
45 12 5 45 21 73 12 34 97 14 6...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 13

Verdict:

input
100000 50000
3967 8608 4873 6065 3304 1388 ...

correct output
27 10 2 1 205 2 1 5 752 9 2 26...

user output
3 3 2 1 2 2 1 2 2 3 2 2 1 2 1 ...

Test 14

Verdict:

input
70000 100000
9570 57890 88434 83611 76325 3...

correct output
1 1 1 47966 47966 47966 47966 ...

user output
1 1 1 2 2 5 5 3 2 7 3 5 3 3 1 ...

Test 15

Verdict:

input
100000 100
84 34 32 36 64 83 29 4 36 57 9...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 16

Verdict:

input
100000 1000
7080 7863 895 4001 3806 8637 7...

correct output
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 17

Verdict:

input
100000 10000
13821 30085 25414 18462 40885 ...

correct output
1 1 3 1 1 2 1 1 1 2 1 1 1 1 1 ...

user output
1 1 3 1 1 2 1 1 1 2 1 1 1 1 1 ...

Test 18

Verdict:

input
100000 50000
41 89 12 33 73 79 38 48 90 68 ...

correct output
4 1 21 1 2 2 1 1 3 2 3 7 6 20 ...

user output
2 1 2 1 2 2 1 1 3 2 3 3 2 2 2 ...

Test 19

Verdict:

input
100000 100000
4325 2304 2625 9099 4244 1618 ...

correct output
9994 5 9994 9994 9994 1 9994 9...

user output
3 2 4 3 5 1 3 6 6 4 7 2 3 4 3 ...

Test 20

Verdict:

input
100000 100
68725 58766 50437 78768 4415 2...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...