Submission #306589

# Submission time Handle Problem Language Result Execution time Memory
306589 2020-09-25T23:27:27 Z chubyxdxd Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097152 KB
#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
vector<int> gg;
void dfs(int node,int pad){
  gg.push_back(node);
  for(auto i:G[node]){
    if(i==pad)continue;
    dfs(i,node);
  }
}
vector<int> label(int n, int k,vector<int> u,vector<int> v) {
  G.clear();
  G.assign(n+1,vector<int>());
  for(int i=0;i<n;i++){
    G[u[i]].push_back(v[i]);
    G[v[i]].push_back(u[i]);
  }
  int piv=0;
  for(int i=0;i<n;i++){
    if(G[i].size()==1){
      piv=i;
      break;
    }
  }
  dfs(piv,piv);
  vector<int> labels(n);
  for(int i=0;i<n;i++){
    labels[gg[i]]=i;
  }
  return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
  if(t<s)return s-1;
  else return s+1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 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 Execution timed out 3136 ms 1202360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3002 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 844 ms 776 KB Output is correct
2 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -