Submission #748015

#TimeUsernameProblemLanguageResultExecution timeMemory
748015onebit1024City Mapping (NOI18_citymapping)C++17
32 / 100
2 ms512 KiB
#include "citymapping.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(c) c.begin(), c.end() #define endl "\n" const double PI=3.141592653589; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifndef ONLINE_JUDGE #define dbg(x...) cerr << "LINE(" << __LINE__ << ") -> " <<"[" << #x << "] = ["; _print(x) #else #define dbg(x...) #endif void find_roads(int n, int Q, int a[], int b[], int w[]) { vector<ll>dist1(n+1); for(int i = 2;i<=n;++i)dist1[i] = get_distance(i,1); int x = max_element(all(dist1))-dist1.begin(); vector<pair<ll,int>>k; for(int i = 1;i<=n;++i)k.pb({get_distance(x,i),i}); sort(all(k)); for(int i = 1;i<k.size();++i)a[i-1] = k[i-1].second,b[i-1] = k[i].second,w[i-1] = get_distance(a[i-1],b[i-1]); return; }

Compilation message (stderr)

citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:46:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |  for(int i = 1;i<k.size();++i)a[i-1] = k[i-1].second,b[i-1] = k[i].second,w[i-1] = get_distance(a[i-1],b[i-1]);
      |                ~^~~~~~~~~
#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...