답안 #385695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385695 2021-04-04T18:37:01 Z Ahmadsm2005 기지국 (IOI20_stations) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
int C;
vector<vector<int>>edges;
vector<int>labels;
void DFS(int v,int u=-1){
int LAST=0,INIT=C;
for(int i=0;i<edges[v].size();i++){
C+=10001;
if(edges[v][i]!=u)
LAST=DFS(edges[v][i],v);
C-=10001;
C++;
}
C=INIT;
labels[v]=C;
C+=1001;
}
vector<int>label(int n,int k,vector<int>u,vector<int>v){
labels.clear();
labels.resize(n);
edges.resize(n);
for(int i=0;i<u.size();i++){
edges[u[i]].push_back(v[i]),edges[v[i]].push_back(u[i]);
}
DFS(0);
C=0;
edges.clear();
return labels;
}
int find_next_station(int s, int t,vector<int>c){
if((s/10001)>(t/10001))
return c[0];
for(int i=c.size();i>=0;i--){
if(c[i]%1001<=t%1001)
return c[i];
}
return c[0];
}

Compilation message

stations.cpp: In function 'void DFS(int, int)':
stations.cpp:9:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | for(int i=0;i<edges[v].size();i++){
      |             ~^~~~~~~~~~~~~~~~
stations.cpp:12:9: error: void value not ignored as it ought to be
   12 | LAST=DFS(edges[v][i],v);
      |      ~~~^~~~~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~