Submission #1166935

#TimeUsernameProblemLanguageResultExecution timeMemory
1166935zh_hCity Mapping (NOI18_citymapping)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "citymapping.h" #define pb push_back; using namespace std; void find_roads(int N, int Q, vector<int> A, vector<int> B, vector<int> W) { // get N, Q // pick a lucky number: 1 // find the difference of 1 and all other nodes vector<pair<long long, int>> dis1; // {distance, node} for (int i = 2; i <= N; i ++) { dis1.pb({get_distance(1, i), i}); } sort(dis1.begin(), dis1.end()); // get longest distance node int longest_dis_node = dis1[N-2].second; vector<pair<long long, int>> dis2; for (int i = 1; i <= N; i ++) { if (i == longest_dis_node) {continue;} dis2.pb({get_distance(longest_dis_node, i), i}); } sort(dis2.begin(), dis2.end()); int cur = 0; for (int i = 0; i < dis2.size(); i ++) { A.pb(longest_dis_node); B.pb(dis2[i].second); W.pb(dis2[i].first-cur); cur = dis2[i].first; } }

Compilation message (stderr)

citymapping.cpp: In function 'void find_roads(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
citymapping.cpp:3:12: error: statement cannot resolve address of overloaded function
    3 | #define pb push_back;
      |            ^
citymapping.cpp:13:14: note: in expansion of macro 'pb'
   13 |         dis1.pb({get_distance(1, i), i});
      |              ^~
citymapping.cpp:13:39: error: expected ';' before '}' token
   13 |         dis1.pb({get_distance(1, i), i});
      |                                       ^
      |                                       ;
citymapping.cpp:3:12: error: statement cannot resolve address of overloaded function
    3 | #define pb push_back;
      |            ^
citymapping.cpp:23:14: note: in expansion of macro 'pb'
   23 |         dis2.pb({get_distance(longest_dis_node, i), i});
      |              ^~
citymapping.cpp:23:54: error: expected ';' before '}' token
   23 |         dis2.pb({get_distance(longest_dis_node, i), i});
      |                                                      ^
      |                                                      ;
citymapping.cpp:3:12: error: statement cannot resolve address of overloaded function
    3 | #define pb push_back;
      |            ^
citymapping.cpp:29:11: note: in expansion of macro 'pb'
   29 |         A.pb(longest_dis_node);
      |           ^~
citymapping.cpp:3:12: error: statement cannot resolve address of overloaded function
    3 | #define pb push_back;
      |            ^
citymapping.cpp:30:11: note: in expansion of macro 'pb'
   30 |         B.pb(dis2[i].second);
      |           ^~
citymapping.cpp:3:12: error: statement cannot resolve address of overloaded function
    3 | #define pb push_back;
      |            ^
citymapping.cpp:31:11: note: in expansion of macro 'pb'
   31 |         W.pb(dis2[i].first-cur);
      |           ^~