Submission #963859

# Submission time Handle Problem Language Result Execution time Memory
963859 2024-04-15T20:22:04 Z guechotjrhh City Mapping (NOI18_citymapping) C++14
32 / 100
2 ms 604 KB
#include "citymapping.h"
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define pi pair<ll,ll>
#define x first
#define y second
void find_roads(int N, int Q, int A[], int B[], int W[]) {
	ll u = 0, mi = 1;
	for (int i = 2; i <= N; i++) {
		ll x = get_distance(1, i);
		if (x > u) {
			u = x;
			mi = i;
		}
	}
	vector<pi> vec;
	for (int i = 1; i <= N; i++) {
		if (i != mi) vec.push_back({ get_distance(mi,i),i });
	}
	sort(vec.begin(), vec.end());
	A[0] = mi; B[0] = vec[0].y; W[0] = vec[0].x;
	for (int i = 1; i < N-1; i++) {
		A[i] = vec[i].y; B[i] = vec[i - 1].y; W[i] = vec[i].x - vec[i - 1].x;
	}
	return;
}
/*
5 500000 1
1 4 8
4 2 1
4 3 7
3 5 3
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 604 KB Correct: 1980 out of 12000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 604 KB Correct: 1980 out of 12000 queries used.
6 Correct 1 ms 604 KB Correct: 1994 out of 12000 queries used.
7 Correct 1 ms 604 KB Correct: 1990 out of 12000 queries used.
8 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
9 Correct 1 ms 604 KB Correct: 1992 out of 12000 queries used.
10 Correct 1 ms 600 KB Correct: 1986 out of 12000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -