답안 #548814

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548814 2022-04-14T12:25:17 Z Mazaalai City Mapping (NOI18_citymapping) C++17
13 / 100
2 ms 468 KB
#include "citymapping.h"
#define ff first
#define ss second
#define ALL(x) x.begin(),x.end()
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long; 
using PII = pair <ll, int>;
ll get(int a, int b) {
	// cout << "ASK: " << a << ' ' << b << '\n';
	ll x = get_distance(a, b);
	return x;
}
int pt = 0;
vector <vector <int> > ans;
void find_roads(int n, int q, int a[], int b[], int w[]) {
	PII edge;
	edge = {0, 0};
	for (int i = 2; i <= n; i++) {
		ll x = get(1, i);
		if (edge.ff < x) edge = {x, i};
	}
	vector <PII> vals;
	int ed = edge.ss;
	for (int i = 1; i <= n; i++) {
		if (i == edge.ss) continue;
		int x = get(ed, i);
		vals.pb({x, i});
	}
	sort(ALL(vals));
	ans.pb({ed, vals[0].ss, (int)vals[0].ff});
	for (int i = 0; i+1 < n-1; i++) {
		ans.pb({vals[i].ss, vals[i+1].ss, (int)(vals[i+1].ff - vals[i].ff)});
	}
	for (auto el : ans) {
		int x = el[0], y = el[1], z = el[2];
		a[pt] = x;
		b[pt] = y;
		w[pt] = z;
		pt++;
	}
}

/*
5 100000000 5 
1 4 1       
2 4 1
3 4 1
3 5 1
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 468 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 468 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 1980 out of 12000 queries used.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 468 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 468 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 1980 out of 12000 queries used.
6 Incorrect 2 ms 468 KB Reported list of edges differ from actual.
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 468 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -