# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
354546 | 2021-01-22T04:01:33 Z | Dilshod_Imomov | Stations (IOI20_stations) | C++17 | 7 ms | 876 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int N = 1e3 + 7; vector < int > adj[N]; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n); for ( int i = 0; i < n; i++ ) { int x = u[i], y = v[i]; adj[x].push_back(y); adj[y].push_back(x); } vector < int > used(n + 1); while ( 1 ) { int rt = -1; for ( int i = 0; i < n; i++ ) { if ( adj[i].size() == 1 && !used[i] ) { rt = i; break; } } if ( rt == -1 ) { break; } int cnt = 0, x = rt, num = 0; while ( num < n ) { labels[x] = num++; used[x] = 1; for ( auto y: adj[x] ) { if ( !used[y] ) { x = y; } } } } return labels; } int find_next_station(int s, int t, std::vector<int> c) { if ( c.size() == 1 ) { return c[0]; } if ( s < t ) { return c[1]; } return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (duplicates values). scenario=1, label=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 876 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (duplicates values). scenario=2, label=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Invalid labels (duplicates values). scenario=1, label=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 652 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |