제출 #939280

#제출 시각아이디문제언어결과실행 시간메모리
939280fdnfksdCity 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; void find_roads(int N, int Q, int A[], int B[], int W[]) { 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 cc=1; ll luu=1; for(int i=1;i<=n;i++) { d[i]=get_distance(i,cc); if(d[i]>d[luu]) luu=i; } vector<pli>cc; for(int i=1;i<=n;i++) { cc.pb({get_distance(i,cc),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:16:8: error: 'q' was not declared in this scope
   16 |     if(q==(ll)5e5)
      |        ^
citymapping.cpp:18:24: error: 'n' was not declared in this scope
   18 |         for(int i=1;i<=n;i++)
      |                        ^
citymapping.cpp:22:17: error: 'dis' was not declared in this scope; did you mean 'div'?
   22 |                 dis[i][j]=get_distance(i,j);
      |                 ^~~
      |                 div
citymapping.cpp:26:24: error: 'n' was not declared in this scope
   26 |         for(int i=2;i<=n;i++)
      |                        ^
citymapping.cpp:32:20: error: 'dis' was not declared in this scope; did you mean 'div'?
   32 |                 if(dis[i][1]==dis[j][1]+dis[i][j])
      |                    ^~~
      |                    div
citymapping.cpp:34:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   34 |                     if(luu=0) luu=j;
      |                        ~~~^~
citymapping.cpp:43:20: error: 'dis' was not declared in this scope; did you mean 'div'?
   43 |             W[i-1]=dis[i][luu];
      |                    ^~~
      |                    div
citymapping.cpp:50:24: error: 'n' was not declared in this scope
   50 |         for(int i=1;i<=n;i++)
      |                        ^
citymapping.cpp:52:13: error: 'd' was not declared in this scope
   52 |             d[i]=get_distance(i,cc);
      |             ^
citymapping.cpp:55:20: error: conflicting declaration 'std::vector<std::pair<long long int, long long int> > cc'
   55 |         vector<pli>cc;
      |                    ^~
citymapping.cpp:48:12: note: previous declaration as 'll cc'
   48 |         ll cc=1;
      |            ^~
citymapping.cpp:56:24: error: 'n' was not declared in this scope
   56 |         for(int i=1;i<=n;i++)
      |                        ^
citymapping.cpp:4:12: error: request for member 'push_back' in 'cc', which is of non-class type 'll' {aka 'long long int'}
    4 | #define pb push_back
      |            ^~~~~~~~~
citymapping.cpp:58:16: note: in expansion of macro 'pb'
   58 |             cc.pb({get_distance(i,cc),i});
      |                ^~
citymapping.cpp:60:17: error: request for member 'begin' in 'cc', which is of non-class type 'll' {aka 'long long int'}
   60 |         sort(cc.begin(),cc.end());
      |                 ^~~~~
citymapping.cpp:60:28: error: request for member 'end' in 'cc', which is of non-class type 'll' {aka 'long long int'}
   60 |         sort(cc.begin(),cc.end());
      |                            ^~~
citymapping.cpp:61:26: error: request for member 'size' in 'cc', which is of non-class type 'll' {aka 'long long int'}
   61 |         for(int i=1;i<cc.size();i++)
      |                          ^~~~
citymapping.cpp:63:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   63 |             A[i]=cc[i].se;
      |                    ^
citymapping.cpp:64:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   64 |             B[i]=cc[i-1].se;
      |                    ^
citymapping.cpp:65:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   65 |             W[i]=cc[i].fi-cc[i-1].fi;
      |                    ^
citymapping.cpp:65:29: error: invalid types 'll {aka long long int}[int]' for array subscript
   65 |             W[i]=cc[i].fi-cc[i-1].fi;
      |                             ^