Submission #1193729

#TimeUsernameProblemLanguageResultExecution timeMemory
1193729omarrrrCity Mapping (NOI18_citymapping)C++20
Compilation error
0 ms0 KiB
#include "citymapping.h" #define ll long long #define F first #define Ss second #define pb push_back ll m[1001][1001],linkk[1005]; bool vis[1001]; void find_roads(int n, int Q, int A[], int B[], int W[]) { vector<pair<ll,pair<ll,ll>>>v; ll link[n+65]; for(ll i=1;i<=n;i++){ for(ll j=i+1;j<=n;j++){ ll d=get_distance(i,j); v.pb({get_distance(i,j),{i,j}}); m[i][j]=m[j][i]=d; } link[i]=0; } sort(v.begin(),v.end()); ll cnt=0,i=0; while(cnt<n-1){ if(link[v[i].Ss.F]<3 && link[v[i].Ss.Ss]<3){ link[v[i].Ss.F]++; link[v[i].Ss.Ss]++; A[cnt]=v[i].Ss.F; B[cnt]=v[i].Ss.Ss; W[cnt]=v[i].F; cnt++; } i++; } // cout<<cnt<<"\n"; return; }

Compilation message (stderr)

citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:17:20: error: 'pair' was not declared in this scope
   17 |     vector<pair<ll,pair<ll,ll>>>v;
      |                    ^~~~
citymapping.cpp:17:5: error: 'vector' was not declared in this scope
   17 |     vector<pair<ll,pair<ll,ll>>>v;
      |     ^~~~~~
citymapping.cpp:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
citymapping.cpp:17:17: note: in expansion of macro 'll'
   17 |     vector<pair<ll,pair<ll,ll>>>v;
      |                 ^~
citymapping.cpp:23:13: error: 'v' was not declared in this scope
   23 |             v.pb({get_distance(i,j),{i,j}});
      |             ^
citymapping.cpp:28:10: error: 'v' was not declared in this scope
   28 |     sort(v.begin(),v.end());
      |          ^
citymapping.cpp:28:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |     sort(v.begin(),v.end());
      |     ^~~~
      |     short