제출 #939289

#제출 시각아이디문제언어결과실행 시간메모리
939289fdnfksdCity Mapping (NOI18_citymapping)C++14
0 / 100
41 ms10840 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-2]=i; B[i-2]=luu; W[i-2]=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,1),(ll)i}); } sort(cc.begin(),cc.end()); for(int i=1;i<cc.size();i++) { A[i-1]=cc[i].se; B[i-1]=cc[i-1].se; W[i-1]=cc[i].fi-cc[i-1].fi; } } }

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

citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:38:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   38 |                     if(luu=0) luu=j;
      |                        ~~~^~
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++)
      |                     ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...