Submission #548792

# Submission time Handle Problem Language Result Execution time Memory
548792 2022-04-14T12:00:53 Z Mazaalai City Mapping (NOI18_citymapping) C++17
22 / 100
5 ms 728 KB
#include "citymapping.h"

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long; 
ll get(int a, int b) {
	// cout << "ASK: " << a << ' ' << b << "\n";
	ll x =  get_distance(a, b);
	// cout << "GOT: " << x << '\n';
	return x;
}
void find_roads(int n, int q, int a[], int b[], int w[]) {
	// cout << "OPEN\n";
	vector <int> dist[n+5];
	int pt = 0;
	for (int i = 2; i <= n; i++) {
		int x = get(1, i);
		if (x == 1) {
			a[pt] = 1, b[pt] = i;
			w[pt] = 1;
			pt++;
		}
		dist[x].pb(i);
	}
	for (int i = 1; i < n; i++) {
		if (dist[i].size() == 0 || dist[i+1].size() == 0) continue;
		for (auto& el : dist[i])
		for (auto& el1 : dist[i+1]) {
			ll x = get(el, el1);
			if (x == 1) {
				a[pt] = el, b[pt] = el1;
				w[pt] = 1;
				pt++;
			}
		}
	}

	return;
}

/*
5 100000000 5 
1 4 1       
2 4 1
3 4 1
3 5 1
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2915 out of 500000 queries used.
2 Correct 1 ms 468 KB Correct: 3445 out of 500000 queries used.
3 Correct 4 ms 472 KB Correct: 67051 out of 500000 queries used.
4 Correct 5 ms 468 KB Correct: 97224 out of 500000 queries used.
5 Correct 2 ms 468 KB Correct: 20809 out of 500000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2915 out of 500000 queries used.
2 Correct 1 ms 468 KB Correct: 3445 out of 500000 queries used.
3 Correct 4 ms 472 KB Correct: 67051 out of 500000 queries used.
4 Correct 5 ms 468 KB Correct: 97224 out of 500000 queries used.
5 Correct 2 ms 468 KB Correct: 20809 out of 500000 queries used.
6 Runtime error 2 ms 728 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2119 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 2421 out of 12000 queries used.
3 Correct 1 ms 468 KB Correct: 2627 out of 12000 queries used.
4 Correct 1 ms 468 KB Correct: 2615 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 2323 out of 12000 queries used.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2119 out of 12000 queries used.
2 Correct 1 ms 468 KB Correct: 2421 out of 12000 queries used.
3 Correct 1 ms 468 KB Correct: 2627 out of 12000 queries used.
4 Correct 1 ms 468 KB Correct: 2615 out of 12000 queries used.
5 Correct 1 ms 468 KB Correct: 2323 out of 12000 queries used.
6 Runtime error 1 ms 724 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Correct: 2915 out of 500000 queries used.
2 Correct 1 ms 468 KB Correct: 3445 out of 500000 queries used.
3 Correct 4 ms 472 KB Correct: 67051 out of 500000 queries used.
4 Correct 5 ms 468 KB Correct: 97224 out of 500000 queries used.
5 Correct 2 ms 468 KB Correct: 20809 out of 500000 queries used.
6 Runtime error 2 ms 728 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -