Submission #1166936

#TimeUsernameProblemLanguageResultExecution timeMemory
1166936zh_hCity Mapping (NOI18_citymapping)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.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:2:12: error: statement cannot resolve address of overloaded function
    2 | #define pb push_back;
      |            ^
citymapping.cpp:12:14: note: in expansion of macro 'pb'
   12 |         dis1.pb({get_distance(1, i), i});
      |              ^~
citymapping.cpp:12:18: error: 'get_distance' was not declared in this scope
   12 |         dis1.pb({get_distance(1, i), i});
      |                  ^~~~~~~~~~~~
citymapping.cpp:2:12: error: statement cannot resolve address of overloaded function
    2 | #define pb push_back;
      |            ^
citymapping.cpp:22:14: note: in expansion of macro 'pb'
   22 |         dis2.pb({get_distance(longest_dis_node, i), i});
      |              ^~
citymapping.cpp:22:18: error: 'get_distance' was not declared in this scope
   22 |         dis2.pb({get_distance(longest_dis_node, i), i});
      |                  ^~~~~~~~~~~~
citymapping.cpp:2:12: error: statement cannot resolve address of overloaded function
    2 | #define pb push_back;
      |            ^
citymapping.cpp:28:11: note: in expansion of macro 'pb'
   28 |         A.pb(longest_dis_node);
      |           ^~
citymapping.cpp:2:12: error: statement cannot resolve address of overloaded function
    2 | #define pb push_back;
      |            ^
citymapping.cpp:29:11: note: in expansion of macro 'pb'
   29 |         B.pb(dis2[i].second);
      |           ^~
citymapping.cpp:2:12: error: statement cannot resolve address of overloaded function
    2 | #define pb push_back;
      |            ^
citymapping.cpp:30:11: note: in expansion of macro 'pb'
   30 |         W.pb(dis2[i].first-cur);
      |           ^~