Submission #748015

# Submission time Handle Problem Language Result Execution time Memory
748015 2023-05-25T09:42:19 Z onebit1024 City Mapping (NOI18_citymapping) C++17
32 / 100
2 ms 512 KB
#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

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 time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2995 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2995 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Correct: 2971 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 2977 out of 12000 queries used.
3 Correct 1 ms 464 KB Correct: 2998 out of 12000 queries used.
4 Correct 1 ms 460 KB Correct: 2977 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 2971 out of 12000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Correct: 2971 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 2977 out of 12000 queries used.
3 Correct 1 ms 464 KB Correct: 2998 out of 12000 queries used.
4 Correct 1 ms 460 KB Correct: 2977 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 2971 out of 12000 queries used.
6 Correct 1 ms 468 KB Correct: 2992 out of 12000 queries used.
7 Correct 1 ms 468 KB Correct: 2986 out of 12000 queries used.
8 Correct 1 ms 512 KB Correct: 2998 out of 12000 queries used.
9 Correct 2 ms 464 KB Correct: 2989 out of 12000 queries used.
10 Correct 1 ms 468 KB Correct: 2980 out of 12000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2995 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -