제출 #517169

#제출 시각아이디문제언어결과실행 시간메모리
517169Ai7081슈퍼트리 잇기 (IOI20_supertrees)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1005; int cnt; vector<int> ret, sub; vector<vector<int>> adj; void dfs(int v, int p, bool ismax) { ret[v] = cnt; cnt += (!ismax); sub[v] = 1; for (auto to : adj[v]) { if (to == p) continue; dfs(to, v, !ismax); if (ismax) ret[v] += sub[to]; sub[v] += sub[to]; } cnt += ismax; return; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { adj.assign(n, vector<int>()); for (int i=0; i<n-1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } sub.assign(n, 0); ret.assign(n, 0); dfs(0, 0, 0); return ret; } int find_next_station(int s, int t, vector<int> c) { bool ismax = (s > c[0]); if (ismax) { if (t > s) return c[0]; for (int i=1; i<c.size(); i++) { if (t < c[i]) return c[i-1]; } return c[c.size()-1]; } else { if (t < s) return c[c.size()-1]; for (int i=0; i<c.size()-1; i++) { if (t > c[i]) return c[i+1]; } return c[0]; } return -1; }

컴파일 시 표준 에러 (stderr) 메시지

supertrees.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
supertrees.cpp:39:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (int i=1; i<c.size(); i++) {
      |                       ~^~~~~~~~~
supertrees.cpp:46:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for (int i=0; i<c.size()-1; i++) {
      |                       ~^~~~~~~~~~~
/usr/bin/ld: /tmp/ccFLO2V6.o: in function `main':
grader.cpp:(.text.startup+0x39a): undefined reference to `construct(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status