Submission #304910

# Submission time Handle Problem Language Result Execution time Memory
304910 2020-09-22T07:41:02 Z model_code Stations (IOI20_stations) Java 11
76 / 100
1839 ms 40792 KB
import java.util.ArrayList;

public class stations {
  private static final int MAXN = 1000;
  
  private int cnt;
  private ArrayList<Integer>[] adj;
  private int[] labels;
  
  private void dfs(int v, int p, int d) {
  	if(d == 0) labels[v] = cnt;
  	++cnt;
  	for (Integer i : adj[v]) if (i != p) dfs(i, v, d ^ 1);
  	if(d == 1) labels[v] = cnt;
  	++cnt;
  }

  int[] label(int n, int k, int[] u, int[] v) {
    cnt = 0;
    adj = new ArrayList[n];
    for (int i = 0; i < n; i++) {
      adj[i] = new ArrayList<Integer>();
    }
  	for (int i = 0; i < n - 1; i++) {
  		adj[u[i]].add(v[i]);
  		adj[v[i]].add(u[i]);
  	}
  	labels = new int[n];
  	dfs(0, -1, 0);
  	return labels;
  }

  int find_next_station(int s, int t, int[] c) {
  	if (s < c[0]) {
  		if (t < s || t >= c[c.length - 1]) return c[c.length - 1];
  		for (int i : c) if (i >= t) return i;
    	return c[c.length - 1];
  	}
  	if (t > s || t <= c[0]) return c[0];
  	int ans = c[0];
  	for (int i : c) if (i <= t) ans = i;
  	return ans;
  }
}

Compilation message

Note: stations.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 12552 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 158 ms 13480 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1393 ms 34436 KB Output is correct
2 Correct 1372 ms 36052 KB Output is correct
3 Correct 1776 ms 37220 KB Output is correct
4 Correct 1453 ms 34252 KB Output is correct
5 Correct 1383 ms 33472 KB Output is correct
6 Correct 1201 ms 36844 KB Output is correct
7 Correct 1220 ms 34112 KB Output is correct
8 Correct 201 ms 21228 KB Output is correct
9 Correct 211 ms 21000 KB Output is correct
10 Correct 183 ms 21156 KB Output is correct
11 Correct 1340 ms 35428 KB Output is correct
12 Correct 1270 ms 36132 KB Output is correct
13 Correct 1501 ms 40792 KB Output is correct
14 Correct 1203 ms 33860 KB Output is correct
15 Correct 425 ms 25356 KB Output is correct
16 Correct 490 ms 26888 KB Output is correct
17 Correct 717 ms 32572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1723 ms 37748 KB Output is correct
2 Correct 1293 ms 35028 KB Output is correct
3 Correct 1162 ms 34832 KB Output is correct
4 Correct 208 ms 20832 KB Output is correct
5 Correct 214 ms 20812 KB Output is correct
6 Correct 184 ms 20796 KB Output is correct
7 Correct 1489 ms 33936 KB Output is correct
8 Correct 1836 ms 37248 KB Output is correct
9 Correct 1482 ms 35960 KB Output is correct
10 Correct 1565 ms 34416 KB Output is correct
11 Correct 217 ms 20780 KB Output is correct
12 Correct 200 ms 20824 KB Output is correct
13 Correct 194 ms 20668 KB Output is correct
14 Correct 200 ms 20900 KB Output is correct
15 Correct 169 ms 20836 KB Output is correct
16 Correct 1270 ms 33136 KB Output is correct
17 Correct 1340 ms 33880 KB Output is correct
18 Correct 1486 ms 34228 KB Output is correct
19 Correct 1305 ms 32992 KB Output is correct
20 Correct 1187 ms 33392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1315 ms 37636 KB Partially correct
2 Partially correct 1385 ms 38212 KB Partially correct
3 Correct 1771 ms 36624 KB Output is correct
4 Correct 1514 ms 34452 KB Output is correct
5 Correct 1261 ms 34216 KB Output is correct
6 Partially correct 1256 ms 36252 KB Partially correct
7 Partially correct 1163 ms 32784 KB Partially correct
8 Correct 201 ms 20996 KB Output is correct
9 Correct 224 ms 20884 KB Output is correct
10 Correct 200 ms 20872 KB Output is correct
11 Partially correct 1503 ms 40104 KB Partially correct
12 Partially correct 1514 ms 34684 KB Partially correct
13 Correct 1839 ms 37176 KB Output is correct
14 Correct 1414 ms 33396 KB Output is correct
15 Correct 1486 ms 35108 KB Output is correct
16 Partially correct 1280 ms 32852 KB Partially correct
17 Correct 1572 ms 33648 KB Output is correct
18 Partially correct 1464 ms 36884 KB Partially correct
19 Partially correct 1406 ms 38016 KB Partially correct
20 Partially correct 1268 ms 34252 KB Partially correct
21 Correct 377 ms 25124 KB Output is correct
22 Partially correct 498 ms 27420 KB Partially correct
23 Partially correct 831 ms 36692 KB Partially correct
24 Correct 206 ms 20908 KB Output is correct
25 Correct 196 ms 20944 KB Output is correct
26 Correct 219 ms 20904 KB Output is correct
27 Correct 211 ms 20352 KB Output is correct
28 Correct 170 ms 20832 KB Output is correct
29 Correct 1225 ms 33484 KB Output is correct
30 Correct 1357 ms 34252 KB Output is correct
31 Correct 1248 ms 31996 KB Output is correct
32 Correct 1251 ms 33120 KB Output is correct
33 Correct 1282 ms 33756 KB Output is correct
34 Partially correct 1123 ms 35476 KB Partially correct
35 Partially correct 1380 ms 37064 KB Partially correct
36 Partially correct 1232 ms 36432 KB Partially correct
37 Partially correct 1228 ms 36752 KB Partially correct
38 Partially correct 1290 ms 36636 KB Partially correct
39 Partially correct 1336 ms 35524 KB Partially correct
40 Partially correct 1353 ms 37300 KB Partially correct
41 Partially correct 1310 ms 36576 KB Partially correct
42 Partially correct 484 ms 30908 KB Partially correct
43 Partially correct 766 ms 33276 KB Partially correct
44 Partially correct 761 ms 32204 KB Partially correct
45 Partially correct 923 ms 33864 KB Partially correct
46 Partially correct 1038 ms 33704 KB Partially correct
47 Partially correct 1090 ms 36680 KB Partially correct
48 Partially correct 552 ms 32576 KB Partially correct
49 Partially correct 445 ms 28472 KB Partially correct