Submission #548812

# Submission time Handle Problem Language Result Execution time Memory
548812 2022-04-14T12:24:49 Z Mazaalai City Mapping (NOI18_citymapping) C++17
0 / 100
1 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 = {2e9, 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
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB get_distance() arguments out of range.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB get_distance() arguments out of range.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB get_distance() arguments out of range.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB get_distance() arguments out of range.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB get_distance() arguments out of range.
2 Halted 0 ms 0 KB -