제출 #939282

#제출 시각아이디문제언어결과실행 시간메모리
939282fdnfksdCity Mapping (NOI18_citymapping)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "citymapping.h" #define pb push_back #define pli pair<ll,ll> #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; using ll=long long; const ll maxn=2e5; const ll inf=1e18; const ll mod=1e9+7; pli cc[maxn]; ll dis[1005][1005]; ll d[maxn]; void find_roads(int N, int Q, int A[], int B[], int W[]) { ll n=N,q=Q; if(q==(ll)5e5) { for(int i=1;i<=n;i++) { for(int j=i+1;j<=n;j++) { dis[i][j]=get_distance(i,j); dis[j][i]=dis[i][j]; } } for(int i=2;i<=n;i++) { ll luu=0; for(int j=1;j<=n;j++) { if(i==j) continue; if(dis[i][1]==dis[j][1]+dis[i][j]) { if(luu=0) luu=j; else { if(dis[i][luu]>dis[i][j]) luu=j; } } } A[i-1]=i; B[i-1]=luu; W[i-1]=dis[i][luu]; } } else { ll luu=1; for(int i=1;i<=n;i++) { d[i]=get_distance(i,1); if(d[i]>d[luu]) luu=i; } vector<pli>cc; for(int i=1;i<=n;i++) { cc.pb({get_distance(i,cc),(ll)i}); } sort(cc.begin(),cc.end()); for(int i=1;i<cc.size();i++) { A[i]=cc[i].se; B[i]=cc[i-1].se; W[i]=cc[i].fi-cc[i-1].fi; } } }

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

citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:26:27: error: 'get_distance' was not declared in this scope
   26 |                 dis[i][j]=get_distance(i,j);
      |                           ^~~~~~~~~~~~
citymapping.cpp:38:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   38 |                     if(luu=0) luu=j;
      |                        ~~~^~
citymapping.cpp:55:18: error: 'get_distance' was not declared in this scope
   55 |             d[i]=get_distance(i,1);
      |                  ^~~~~~~~~~~~
citymapping.cpp:61:20: error: 'get_distance' was not declared in this scope
   61 |             cc.pb({get_distance(i,cc),(ll)i});
      |                    ^~~~~~~~~~~~
citymapping.cpp:61:45: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   61 |             cc.pb({get_distance(i,cc),(ll)i});
      |                                             ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from citymapping.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
citymapping.cpp:64:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         for(int i=1;i<cc.size();i++)
      |                     ~^~~~~~~~~~