# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
310314 | 2020-10-06T16:08:05 Z | Peacher29 | Stations (IOI20_stations) | C++14 | 980 ms | 1008 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; class pont{ public: vector<int> v; int id=-1; void dfs(bool mi); }; int dd; vector<pont> p; void pont::dfs(bool mi){ if(id==-1){ if(mi){ id=-2; } else { id=++dd; } for(int i : v){ p[i].dfs(!mi); } if(mi){ id=++dd; } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { p.clear(); p.resize(n); dd=-1; for(int i=0;i<n-1;i++){ p[u[i]].v.push_back(v[i]); p[v[i]].v.push_back(u[i]); } p[0].dfs(0); vector<int> er(n); for(int i=0;i<n;i++){ er[i] = p[i].id; } return er; } int find_next_station(int s, int t, vector<int> c) { if(s==t){ exit(255); } if(c.size()==1){ return c[0]; } sort(c.begin(), c.end()); /*for(int i : c){ cout << i << ' '; }*/ //cout << '\n'; if(s<c[0]){ if(t<s || c[c.size()-2]<t){ return c[c.size()-1]; } else { for(int i=1;i<c.size()-2+(s==0);i++){ if(t<=c[i]){ return c[i]; } } } } else { if(t>s || c[1]>t){ return c[0]; } else { for(int i=c.size()-1;i>0;i--){ if(c[i]<=t){ return c[i]; } } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 530 ms | 760 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 499 ms | 984 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 526 ms | 1008 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 980 ms | 640 KB | Output is correct |
2 | Incorrect | 876 ms | 916 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 556 ms | 896 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |