# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
349973 | 2021-01-18T19:08:09 Z | evn | Stations (IOI20_stations) | C++14 | 853 ms | 1128 KB |
#include <bits/stdc++.h> #include "stations.h" using namespace std; #define f first #define s second #define pb push_back #define mp make_pair #define sz(a) a.size() typedef long long ll; typedef pair<int, int> pii; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int timer = 0; int depth[1005]; int in[1005]; int out[1005]; vector<int> adj[1005]; void dfs(int u, int p){ if(depth[u] % 2 == 0)in[u] = timer++; for(int v : adj[u]){ if(v != p){ depth[v] = depth[u]+1; dfs(v, u); } } if(depth[u] % 2 == 1)out[u] = timer++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); for(int i = 0; i < n;i ++){ adj[i].clear(); depth[i] = 0; } for(int i = 0; i < u.size(); i++){ int a, b; a = u[i]; b = v[i]; adj[a].pb(b); adj[b].pb(a); } dfs(0, -1); for (int i = 0; i < n; i++) { if(depth[i] % 2 == 0)labels[i] = in[i]; else{labels[i] = out[i];} } return labels; } int find_next_station(int s, int t, vector<int> c) { if(c.size() == 1)return c[0]; if(c[0] > s){ //this is the in value if(t < s || t >= c[c.size()-1])return c[c.size()-1]; for(int i = 0; i < c.size(); i++){ if(t <= c[i])return c[i]; } } else{ //this is the out value if(t <= c[0] || t > s)return c[0]; for(int i = c.size()-1; i >= 1; i++){ if(t >= c[i])return c[i]; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1008 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 364 KB | Invalid labels (values out of range). scenario=1, k=1000, vertex=1, label=1507 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 519 ms | 1128 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 853 ms | 864 KB | Output is correct |
2 | Correct | 654 ms | 1120 KB | Output is correct |
3 | Incorrect | 582 ms | 948 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 544 ms | 1084 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |