# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
354370 | 2021-01-21T19:51:37 Z | doowey | Stations (IOI20_stations) | C++14 | 1011 ms | 1196 KB |
#include <bits/stdc++.h> #include "stations.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair const int N = 1005; vector<int> T[N]; vector<int> sol; int ti; void dfs(int u, int pp, int bit){ if(bit == 0){ sol[u]=ti; ti++; } for(auto x : T[u]){ if(x==pp) continue; dfs(x,u,(bit^1)); } if(bit == 1){ sol[u]=ti; ti++; } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { sol.clear(); sol.resize(n); for(int i = 0 ; i < n; i ++ ){ T[i].clear(); } for(int i = 0 ; i < u.size(); i ++ ){ T[u[i]].push_back(v[i]); T[v[i]].push_back(u[i]); } dfs(0,-1,0); return sol; } int find_next_station(int s, int t, vector<int> c) { ti = 0; bool is = true; for(auto x : c){ if(s > x) is = false; } if(is){ // s is tout sort(c.begin(), c.end()); if(t <= c[0] || t >= s){ return c[0]; } c.push_back(s); for(int i = 0 ; i + 1 < c.size(); i ++ ){ if(t >= c[i] && t <= c[i + 1]){ return i; } } } else{ if(t <= s || t >= c.back()) return c.back(); if(t >= s && c[0] >= t) return c[0]; for(int i = 1; i < c.size()-1; i ++ ){ if(c[i-1] < t && t < c[i]){ return c[i]; } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 524 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 | 629 ms | 1196 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1011 ms | 952 KB | Output is correct |
2 | Incorrect | 886 ms | 952 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 561 ms | 1024 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |