Submission #312943

# Submission time Handle Problem Language Result Execution time Memory
312943 2020-10-14T19:59:55 Z DanerZein Stations (IOI20_stations) C++14
0 / 100
5 ms 384 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
  vector<int> labels;
  labels.assign(n,-1);
  // 13 points - task 3
  vector<vi>G;
  G.resize(n+1);
  int t=u.size();
  for(int i=0;i<t;i++){
    int x=u[i],y=v[i];
    G[x].push_back(y);
    G[y].push_back(x);
  }
  int id=-1;
  for(int i=0;i<t;i++){
    if(G[i].size()>1){
      id=G[i].size();
      break;
    }
  }
  int no=1;
  labels[id]=0;
  for(int i=0;i<n;i++){
    if(labels[id]==-1){
      labels[id]=no;
      no++;
    }
  }
  // 8 points - taks 2
  /*for(int i=0;i<n;i++) labels[i]=i;*/
  // 5 points - task 1
  /*int no=0,id=-1;
  for(int i=0;i<n;i++){
    if(G[i].size()==1){
      id=i;
      break;
    }
  }
  queue<int> q;
  q.push(id);
  while(!q.empty()){
    int x=q.front();
    q.pop();
    labels[x]=no;
    no++;
    for(auto &v:G[x]){
      if(labels[v]==-1){
	q.push(v);
      }
    }
  }*/
  return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
  // 5 points - task 1
  /*  if(s>t)
    return s-1;
  return s+1;*/
  // 8 points - task 2
  /*queue<ii> q;
  q.push(ii(s*2+1,0));
  q.push(ii(s*2+2,1));
  int res=-1;
  while(!q.empty()){
    int x=q.front().first;
    int sw=q.front().second;
    if(x==t){
      res=sw;
      break;
    }
    q.pop();
    if(x*2+1<=t) q.push(ii(x*2+1,sw));
    if(x*2+2<=t) q.push(ii(x*2+2,sw));
  }
  if(res==-1){
    return c[0];
  }
  else{
    if(s==0){
      if(res==0) return c[0];
      return c[1];
    }
    if(res==0) return c[1];
    else return c[2];
  }*/
  // 16 points - task 3
  return c[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=-1
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=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -