제출 #570121

#제출 시각아이디문제언어결과실행 시간메모리
570121Garguy22도로 폐쇄 (APIO21_roads)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; #define pb push_back; vl minimum_closure_costs(int N, vi U, vi V, vi W){ ll temp = 0; vi ans; sort(W.begin(), W.end()); ans.pb(0); for(int i = 0; i < n; i++){ temp += w[i]; ans.pb(temp); } reverse(ans.begin(), ans.end()); return ans; }

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

roads.cpp: In function 'vl minimum_closure_costs(int, vi, vi, vi)':
roads.cpp:9:12: error: statement cannot resolve address of overloaded function
    9 | #define pb push_back;
      |            ^
roads.cpp:15:6: note: in expansion of macro 'pb'
   15 |  ans.pb(0);
      |      ^~
roads.cpp:15:9: warning: statement has no effect [-Wunused-value]
   15 |  ans.pb(0);
      |        ~^~
roads.cpp:16:21: error: 'n' was not declared in this scope
   16 |  for(int i = 0; i < n; i++){
      |                     ^
roads.cpp:17:11: error: 'w' was not declared in this scope
   17 |   temp += w[i];
      |           ^
roads.cpp:9:12: error: statement cannot resolve address of overloaded function
    9 | #define pb push_back;
      |            ^
roads.cpp:18:7: note: in expansion of macro 'pb'
   18 |   ans.pb(temp);
      |       ^~
roads.cpp:18:10: warning: statement has no effect [-Wunused-value]
   18 |   ans.pb(temp);
      |         ~^~~~~
roads.cpp:21:9: error: could not convert 'ans' from 'vector<int>' to 'vector<long long int>'
   21 |  return ans;
      |         ^~~
      |         |
      |         vector<int>