Submission #1193730

#TimeUsernameProblemLanguageResultExecution timeMemory
1193730omarrrrCity 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 using namespace std; 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:18:20: error: 'pair' was not declared in this scope
   18 |     vector<pair<ll,pair<ll,ll>>>v;
      |                    ^~~~
citymapping.cpp:2:1: note: 'std::pair' is defined in header '<utility>'; did you forget to '#include <utility>'?
    1 | #include "citymapping.h"
  +++ |+#include <utility>
    2 | 
citymapping.cpp:18:5: error: 'vector' was not declared in this scope
   18 |     vector<pair<ll,pair<ll,ll>>>v;
      |     ^~~~~~
citymapping.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "citymapping.h"
  +++ |+#include <vector>
    2 | 
citymapping.cpp:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
citymapping.cpp:18:17: note: in expansion of macro 'll'
   18 |     vector<pair<ll,pair<ll,ll>>>v;
      |                 ^~
citymapping.cpp:24:13: error: 'v' was not declared in this scope
   24 |             v.pb({get_distance(i,j),{i,j}});
      |             ^
citymapping.cpp:29:10: error: 'v' was not declared in this scope
   29 |     sort(v.begin(),v.end());
      |          ^
citymapping.cpp:29:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   29 |     sort(v.begin(),v.end());
      |     ^~~~
      |     short