제출 #719351

#제출 시각아이디문제언어결과실행 시간메모리
719351mseebacher기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define MAXI (int)1e3+10 vector<int> ad[MAXI]; vector<int> labels; int tiefe = 0; void dfs(int x,int e){ labels[x] = tiefe++; for(auto s: ad[x]){ if(s == e) continue; dfs(s,x); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { labels.assign(n,0); ad.clear(); for(int i = 0;i<n-1;i++){ ad[u[i]].push_back(v[i]); ad[v[i]].push_back(u[i]); } for(int i = 0;i<n;i++){ if(ad[i].size() == 1) { dfs(i,-1); break; } } vector<int> dummy = labels; return dummy; } int find_next_station(int s, int t, std::vector<int> c) { if(s > t || !s) return c[0]; return c[1]; }

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

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:23:5: error: request for member 'clear' in 'ad', which is of non-class type 'std::vector<int> [1010]'
   23 |  ad.clear();
      |     ^~~~~