답안 #424197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
424197 2021-06-11T17:54:53 Z OttoTheDino 기지국 (IOI20_stations) C++17
컴파일 오류
0 ms 0 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e)                          for (int i = s; i <= e; ++i)
#define pb                                  push_back
typedef vector<int> vi;

const int mxn = 2e4;
int id, res[mxn];
vi neibs[mxn];

void dfs (int u, int prev) {
    for (int v : neibs[u]) {
        if (v==prev) continue;
        dfs (v, u);
    }
    res[u]=id++;
}

vi label (int n, int k, vi u, vi v) {
    rep (i,0,n-2) {
        neibs[u[i]].pb(v[i]);
        neibs[v[i]].pb(u[i]);
    }
    return -1;
    dfs (0,-1);
    vi L(n);
    rep (i,0,n-1) L[i] = res[i];
    return L;
}

int find_next_station (int s, int t, vi c) {
    sort(c.begin(), c.end());
    for (int v : c) if (v>=t) return v;
    return c.back();
}

Compilation message

stations.cpp: In function 'vi label(int, int, vi, vi)':
stations.cpp:25:13: error: could not convert '-1' from 'int' to 'vi' {aka 'std::vector<int>'}
   25 |     return -1;
      |             ^
      |             |
      |             int