제출 #333458

#제출 시각아이디문제언어결과실행 시간메모리
333458sabamakuStations (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> #define f first #define s second using namespace std; int cnt; pair <int,int> d[20005]; vector <int> vi[2005]; void dfs(int x,int p){ d[x].f = cnt++; for (int j = 0; j < vi[x].size(); j++){ int to = vi[x][j]; if (to == p) continue; dfs(to,x); } d[x].s = cnt++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels; for (int i = 0; i < 1001; i++){ vi[i].clear(); d[i].f = 0; d[i].f = d[i].s; } for (int i = 0; i < u.size(); i++){ vi[u[i]].pb(v[i]); vi[v[i]].pb(u[i]); } cnt = 0; dfs(0,0); for (int i = 0; i < n; i++) labels.pb((d[i].f) * 1000 + d[i].s); return labels; } int find_next_station(int s, int t, vector<int> v1) { if (s / 1000 < t / 1000){ for (int i = 1; i < v1.size();i++) if (t / 1000 >= v1[i] / 1000 && v1[i] % 1000 >= t % 1000) return v1[i]; } return v1[0]; }

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

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int j = 0; j < vi[x].size(); j++){
      |                     ~~^~~~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < u.size(); i++){
      |                     ~~^~~~~~~~~~
stations.cpp:31:18: error: 'class std::vector<int>' has no member named 'pb'
   31 |         vi[u[i]].pb(v[i]);
      |                  ^~
stations.cpp:32:18: error: 'class std::vector<int>' has no member named 'pb'
   32 |         vi[v[i]].pb(u[i]);
      |                  ^~
stations.cpp:37:16: error: 'class std::vector<int>' has no member named 'pb'
   37 |         labels.pb((d[i].f) * 1000 + d[i].s);
      |                ^~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:43:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for (int i = 1; i < v1.size();i++)
      |                         ~~^~~~~~~~~~~