Submission #518495

# Submission time Handle Problem Language Result Execution time Memory
518495 2022-01-23T23:34:08 Z DanerZein Stations (IOI20_stations) C++14
10 / 100
866 ms 656 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.clear();
  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;
      continue;
    }
    if(l<=lab && r>=lab){
      return v;
    }
  }
  return pa;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 416 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1004
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 420 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=511994
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 412 KB Invalid labels (values out of range). scenario=2, k=1000000, vertex=0, label=1000008
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 866 ms 492 KB Output is correct
2 Correct 691 ms 492 KB Output is correct
3 Correct 595 ms 400 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 3 ms 476 KB Output is correct
6 Correct 0 ms 468 KB Output is correct
7 Correct 614 ms 400 KB Output is correct
8 Correct 819 ms 400 KB Output is correct
9 Correct 699 ms 400 KB Output is correct
10 Correct 600 ms 404 KB Output is correct
11 Correct 6 ms 476 KB Output is correct
12 Correct 6 ms 468 KB Output is correct
13 Correct 5 ms 476 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 0 ms 468 KB Output is correct
16 Correct 427 ms 476 KB Output is correct
17 Correct 482 ms 476 KB Output is correct
18 Correct 527 ms 496 KB Output is correct
19 Correct 524 ms 496 KB Output is correct
20 Correct 440 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 479 ms 656 KB Wrong query response.
2 Halted 0 ms 0 KB -