# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
305998 |
2020-09-24T09:13:10 Z |
llaki |
Stations (IOI20_stations) |
Java 11 |
|
1689 ms |
39740 KB |
import java.util.ArrayList;
public class stations {
int[] label(int n, int k, int[] u, int[] v) {
ArrayList<Integer>[] G = new ArrayList[n];
for (int i = 0; i < G.length; i++) {
G[i] = new ArrayList<>();
}
for (int i = 0; i < u.length; i++) {
G[u[i]].add(v[i]);
G[v[i]].add(u[i]);
}
int leaf = -1;
for (int i = 0; i < n; i++) {
if (G[i].size() == 1) {
leaf = i;
break;
}
}
int[] labels = new int[n];
int cur = 0;
int node = leaf;
int prev = -1;
while (true) {
labels[node] = cur;
cur++;
boolean found = false;
for (int to : G[node]) {
if (to == prev) continue;
prev = node;
node = to;
found = true;
break;
}
if (!found) break;
}
return labels;
}
int find_next_station(int s, int t, int[] c) {
for (int nd : c) {
if (s <= nd && nd <= t) return nd;
if (s >= nd && nd >= t) return nd;
}
return -1;
}
}
Compilation message
Note: stations.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1079 ms |
36052 KB |
Output is correct |
2 |
Correct |
1227 ms |
37752 KB |
Output is correct |
3 |
Correct |
1450 ms |
35832 KB |
Output is correct |
4 |
Correct |
1185 ms |
34740 KB |
Output is correct |
5 |
Correct |
1150 ms |
32792 KB |
Output is correct |
6 |
Correct |
1098 ms |
38372 KB |
Output is correct |
7 |
Correct |
1182 ms |
32980 KB |
Output is correct |
8 |
Correct |
175 ms |
21256 KB |
Output is correct |
9 |
Correct |
184 ms |
20968 KB |
Output is correct |
10 |
Correct |
164 ms |
20968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
149 ms |
14200 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1219 ms |
36084 KB |
Output is correct |
2 |
Correct |
1061 ms |
39740 KB |
Output is correct |
3 |
Correct |
1582 ms |
37904 KB |
Output is correct |
4 |
Correct |
1324 ms |
34600 KB |
Output is correct |
5 |
Correct |
1160 ms |
33240 KB |
Output is correct |
6 |
Correct |
1117 ms |
38840 KB |
Output is correct |
7 |
Correct |
989 ms |
33240 KB |
Output is correct |
8 |
Correct |
193 ms |
21044 KB |
Output is correct |
9 |
Correct |
193 ms |
21124 KB |
Output is correct |
10 |
Correct |
164 ms |
20920 KB |
Output is correct |
11 |
Incorrect |
80 ms |
10216 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1473 ms |
36232 KB |
Output is correct |
2 |
Correct |
1307 ms |
36268 KB |
Output is correct |
3 |
Correct |
1367 ms |
35516 KB |
Output is correct |
4 |
Correct |
164 ms |
20812 KB |
Output is correct |
5 |
Correct |
181 ms |
20952 KB |
Output is correct |
6 |
Correct |
166 ms |
21080 KB |
Output is correct |
7 |
Incorrect |
99 ms |
10044 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1232 ms |
36404 KB |
Output is correct |
2 |
Correct |
1107 ms |
38092 KB |
Output is correct |
3 |
Correct |
1689 ms |
36816 KB |
Output is correct |
4 |
Correct |
1347 ms |
34592 KB |
Output is correct |
5 |
Correct |
1115 ms |
32480 KB |
Output is correct |
6 |
Correct |
1206 ms |
37456 KB |
Output is correct |
7 |
Correct |
1092 ms |
33508 KB |
Output is correct |
8 |
Correct |
174 ms |
21284 KB |
Output is correct |
9 |
Correct |
182 ms |
21176 KB |
Output is correct |
10 |
Correct |
160 ms |
21068 KB |
Output is correct |
11 |
Incorrect |
163 ms |
15040 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |