Submission #748012

# Submission time Handle Problem Language Result Execution time Memory
748012 2023-05-25T09:39:21 Z onebit1024 City Mapping (NOI18_citymapping) C++17
13 / 100
2 ms 576 KB
#include "citymapping.h"
#include <bits/stdc++.h>
using namespace std;

// #define int 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<int>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<int,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<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 1 ms 468 KB Correct: 2971 out of 12000 queries used.
2 Correct 2 ms 576 KB Correct: 2977 out of 12000 queries used.
3 Correct 2 ms 464 KB Correct: 2998 out of 12000 queries used.
4 Correct 2 ms 468 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 1 ms 468 KB Correct: 2971 out of 12000 queries used.
2 Correct 2 ms 576 KB Correct: 2977 out of 12000 queries used.
3 Correct 2 ms 464 KB Correct: 2998 out of 12000 queries used.
4 Correct 2 ms 468 KB Correct: 2977 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 2971 out of 12000 queries used.
6 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
7 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 -