Submission #518494

# Submission time Handle Problem Language Result Execution time Memory
518494 2022-01-23T23:28:44 Z DanerZein Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int MAX_N=1010;
vector<vi> G;
int out[MAX_N],mi[MAX_N];
int ite=0;
void dfs(int u,int p){
  mi[u]=1e9;
  for(auto &v:G[u]){
    if(v!=p){
      dfs(v,u);
      mi[u]=min(mi[u],mi[v]);
    }
  }
  out[u]=ite++;
  mi[u]=min(mi[u],out[u]);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
  G.resize(n+1);
  for(int i=0;i<n-1;i++){
    G[u[i]].push_back(v[i]);
    G[v[i]].push_back(u[i]);
  }
  dfs(0,0);
  vector<int> la;
  for(int i=0;i<n;i++){
    la.push_back(out[i]+(mi[i]*1000));
  }
  return la;
}

int find_next_station(int s, int t, std::vector<int> c) {
  int pa=-1;
  int lab=t%1000;
  for(auto &v:c){
    int l=v/1000;
    int r=v%1000;
    if(r>s%1000){
      pa=v;
    }
    else{
      if(l<=lab && r>=lab){
	return v;
      }
    }
  }
  return pa;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3047 ms 9940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1293 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 778 ms 476 KB Output is correct
2 Runtime error 890 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2188 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -