# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305411 | 2020-09-23T03:05:27 Z | daniel920712 | Stations (IOI20_stations) | C++14 | 873 ms | 1424 KB |
#include "stations.h" #include <vector> #include <math.h> #include <iostream> #include <stdio.h> using namespace std; vector < int > Next[1005]; vector < int > how; int con[1005]={0}; int ans[1005]={0}; int sz[1005]={0}; bool use[1005]={0}; int st; void F(int here) { //printf("%d %d\n",here,con); int now=0; use[here]=1; sz[here]=1; how.push_back(here); for(auto i:Next[here]) { if(!use[i]) { F(i); sz[here]+=sz[i]; } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels; how.clear(); int i; for(i=0;i<n;i++) { labels.push_back(0); Next[i].clear(); con[i]=0; use[i]=0; } for(int i=0;i<n-1;i++) { con[u[i]]++; con[v[i]]++; Next[u[i]].push_back(v[i]); Next[v[i]].push_back(u[i]); } F(0); for(i=0;i<n;i++) labels[how[i]]=1000*i+(sz[how[i]]-1); //for(i=0;i<n;i++) printf("%d ",labels[i]); //printf("\n"); return labels; } int find_next_station(int s, int t, vector<int> c) { int x,n=c.size(),i; //printf("%d %d %d\n",s,t,n); if(n==1) return c[0]; if(t/1000>=s/1000+1&&t/1000<=s/1000+s%1000+1) { for(i=0;i<n;i++) { //printf("%d %d\n",s,c[i]); if(c[i]/1000>s/1000) { if(t/1000>=c[i]/1000&&t/1000<=c[i]/1000+c[i]%1000) return c[i]; } } } else return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6003 |
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=1510 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 873 ms | 768 KB | Output is correct |
2 | Correct | 679 ms | 768 KB | Output is correct |
3 | Runtime error | 2 ms | 1120 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 1424 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |