# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429437 | 2021-06-15T23:34:03 Z | DanerZein | Stations (IOI20_stations) | C++14 | 973 ms | 3084 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; vector<vi> G; vector<vi> li; void dfs(int u,int p){ for(auto &v:G[u]){ if(v!=p){ dfs(v,u); for(int i=0;i<li[v].size();i++){ li[u].push_back(li[v][i]); } } } li[u].push_back(u); } int construct(int id){ int s=0; int e=1; for(int i=li[id].size()-1;i>=0;i--){ s+=(li[id][i]*e); e*=10; } return s; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { G.clear(); li.clear(); G.resize(n+1); li.resize(n+1); for(int i=0;i<n-1;i++){ G[u[i]].push_back(v[i]); G[v[i]].push_back(u[i]); } dfs(0,-1); vector<int> lab; for(int i=0;i<n;i++){ lab.push_back(construct(i)); } return lab; } int find_next_station(int s, int t, std::vector<int> c) { int pa=-1; int hj=-1; for(auto &v:c){ if(v>s){ pa=v; continue; } int aux=v; int e=10; for(int i=0;i<8;i++){ int a,b; a=aux%e; b=aux/e; e*=10; if(a==t || b==t) hj=v; } } if(hj==-1) return pa; return hj; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 3028 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1148210668 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 456 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=230144572 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 3084 KB | Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=-1366872140 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 973 ms | 520 KB | Output is correct |
2 | Correct | 874 ms | 400 KB | Output is correct |
3 | Correct | 721 ms | 400 KB | Output is correct |
4 | Correct | 3 ms | 468 KB | Output is correct |
5 | Correct | 4 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 468 KB | Output is correct |
7 | Incorrect | 793 ms | 472 KB | Wrong query response. |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 3004 KB | Invalid labels (values out of range). scenario=1, k=1000000000, vertex=1, label=-1676502435 |
2 | Halted | 0 ms | 0 KB | - |