# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308606 | 2020-10-01T15:02:57 Z | lordlorinc | Stations (IOI20_stations) | C++17 | 905 ms | 640 KB |
#include "stations.h" #include <vector> using namespace std; vector<vector<int> > sor; vector<bool> volt; vector<int> eleres, tavozas; int time = -1; void bejaras (int hely){ time++; eleres[hely] = time; volt[hely] = true; for (int x : sor[hely]){ if (volt[x] == false){ bejaras(x); } } time++; tavozas[hely] = time; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { sor.assign(n, vector<int>(0)); volt.assign(n, false); eleres.assign(n, 0); tavozas.assign(n, 0); for (int i = 0; i < u.size(); i++){ sor[u[i]].push_back(v[i]); } bejaras(0); vector<int> labels(n); for (int i = 0; i < n; i++) labels[i] = eleres[i] * 2000 + tavozas[i]; return labels; } int find_next_station(int s, int t, std::vector<int> c) { pair<int, int> hely, cel; hely.first = s / 2000; hely.second = s % 2000; cel.first = t / 2000; cel.second = t % 2000; vector<pair<int, int> > szomszedok(c.size()); for (int i = 0; i < c.size(); i++){ szomszedok[i].first = c[i] / 2000; szomszedok[i].second = c[i] % 2000; } int szuloindex = -1; for (int i = 0; i < c.size(); i++) { if (szomszedok[i].first < hely.first) szuloindex = i; } for (int i = 0; i < c.size(); i++){ if (i != szuloindex){ if (szomszedok[i].first < cel.first && szomszedok[i].second > cel.second){ return c[i]; } } } return c[szuloindex]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Invalid labels (duplicates values). scenario=0, label=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=2006 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Invalid labels (duplicates values). scenario=1, label=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 905 ms | 640 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Invalid labels (duplicates values). scenario=0, label=0 |
2 | Halted | 0 ms | 0 KB | - |