Submission #308349

# Submission time Handle Problem Language Result Execution time Memory
308349 2020-10-01T00:54:35 Z chubyxdxd Stations (IOI20_stations) C++17
0 / 100
862 ms 1024 KB
#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
vector<int> gg;
vector<int> labels;
int id=0;
void dfs(int node,int pad){
  labels[node]=id;
  id++;
  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();
  id=0;
  G.assign(n+10,vector<int>());
  for(int i=0;i<u.size();i++){
    G[u[i]].push_back(v[i]);
    G[v[i]].push_back(u[i]);
  }
  int piv=0;
  labels.assign(n,0);
  for(int i=0;i<n;i++){
    if(G[i].size()==1){
      dfs(piv,-1);
      break;
    }
  }
  return labels;
}
 
int find_next_station(int s, int t,vector<int> c) {
  if(int(c.size())==1)return c[0];
  if(s<t)return max(c[0],c[1]);
  else return min(c[0],c[1]);
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for(int i=0;i<u.size();i++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 527 ms 1008 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 489 ms 812 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 746 ms 1024 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 862 ms 640 KB Output is correct
2 Incorrect 771 ms 648 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 700 ms 768 KB Wrong query response.
2 Halted 0 ms 0 KB -