제출 #1241286

#제출 시각아이디문제언어결과실행 시간메모리
1241286hynmj기지국 (IOI20_stations)C++20
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; map<int, vector<int>> graph; vector<int> labels; int times; void dfs(int node, int parent, int depth) { if ((depth )%2==1) { labels[node] = ++times; } for (int i:graph[node]) { if (i!=parent) { dfs(i,node,depth+1); } } if ((depth )%2==0) { labels[node] = ++times; } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { times = -1; labels.resize(n); for (int i=0;i<n-1; i++) { graph[u[i]].push_back(v[i]); graph[v[i]].push_back(u[i]); } dfs(1,-1,0); graph.clear(); return labels; } int find_next_station(int s, int t, std::vector<int> c) { int n = c.size(); if (n==1) return c[0]; if (s >= c[0]) { if (t> s) return c[0]; for (int i=n-1;i>=0;i--) { if (c[i] >= t ) { return c[i]; } } } else { if (t < s) return c[n-1]; for (int i=0;i<n;i++) { if (c[i] <= t ) { return c[i]; } } return c.back() } return c[0]; }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:67:24: error: expected ';' before '}' token
   67 |         return c.back()
      |                        ^
      |                        ;
   68 |     }
      |     ~