답안 #308333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308333 2020-09-30T23:50:33 Z chubyxdxd 기지국 (IOI20_stations) C++17
0 / 100
901 ms 768 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+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;
  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 min(c[0],c[1]);
  else return max(c[0],c[1]);
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i=0;i<u.size();i++){
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 504 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 901 ms 640 KB Output is correct
2 Incorrect 661 ms 640 KB Wrong query response.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -