Submission #586456

#TimeUsernameProblemLanguageResultExecution timeMemory
586456krit3379City Mapping (NOI18_citymapping)C++17
32 / 100
44 ms8280 KiB
#include<bits/stdc++.h> #include "citymapping.h" using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 1005 long long dis[N][N],dis1[N],ma,id,last,last_node; vector<pair<long long,long long>> v; void find_roads(int n,int q,int a[], int b[],int w[]){ int i,j; if(q==500000){ for(i=1;i<=n;i++)for(j=i+1;j<=n;j++)dis[i][j]=dis[j][i]=get_distance(i,j); } else if(q==12000){ for(i=2;i<=n;i++)dis1[i]=get_distance(1,i); for(i=1;i<=n;i++)if(dis1[i]>ma)ma=dis1[i],id=i; for(i=1;i<=n;i++)if(i!=id)v.push_back({get_distance(id,i),i}); sort(v.begin(),v.end()); last=0; last_node=id; for(i=0;i<v.size();i++){ a[i]=last_node; b[i]=v[i].second; w[i]=v[i].first-last; last=v[i].first; last_node=v[i].second; } } }

Compilation message (stderr)

citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:24:18: 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]
   24 |         for(i=0;i<v.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...