Submission #24322

# Submission time Handle Problem Language Result Execution time Memory
24322 2017-06-05T08:14:28 Z Bruteforceman Computer Network (BOI14_network) C++11
100 / 100
156 ms 6188 KB
#include "network.h"
#include "bits/stdc++.h"
using namespace std;

vector <int> g[2000];
map <pair <int, int>, int> mem;

int dist(int x, int y) {
	if(x > y) swap(x, y);
	if(x == y) return 0;
	if(mem.find(make_pair(x, y)) == mem.end()) return mem[make_pair(x, y)] = ping(x, y) + 1;
	else return mem[make_pair(x, y)];
}
void findRoute (int N, int a, int b)
{
	for(int i = 1; i <= N; i++) {
		g[dist(a, i)].push_back(i);
	}
	vector <int> rout;
	rout.push_back(b);
	for(int i = dist(a, b)-1; i >= 1; i--) {
		for(auto j : g[i]) {
			if(dist(j, rout.back()) == 1) {
				rout.push_back(j);
				break;
			}
		}
	}
	reverse(rout.begin(), rout.end());
	for(auto i : rout) {
		travelTo(i);
	}
}

Compilation message

grader.c: In function 'int main()':
grader.c:48:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
                                       ^
grader.c:51:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^
# Verdict Execution time Memory Grader output
1 Correct 126 ms 6188 KB Output is correct
2 Correct 123 ms 6188 KB Output is correct
3 Correct 106 ms 6188 KB Output is correct
4 Correct 133 ms 6188 KB Output is correct
5 Correct 106 ms 6188 KB Output is correct
6 Correct 109 ms 6188 KB Output is correct
7 Correct 0 ms 6056 KB Output is correct
8 Correct 0 ms 6056 KB Output is correct
9 Correct 0 ms 6056 KB Output is correct
10 Correct 0 ms 6056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 6188 KB Output is correct
2 Correct 26 ms 6056 KB Output is correct
3 Correct 149 ms 6188 KB Output is correct
4 Correct 99 ms 6188 KB Output is correct
5 Correct 126 ms 6188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 6188 KB Output is correct
2 Correct 23 ms 6056 KB Output is correct
3 Correct 143 ms 6188 KB Output is correct
4 Correct 126 ms 6188 KB Output is correct
5 Correct 149 ms 6188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 6188 KB Output is correct
2 Correct 33 ms 6056 KB Output is correct
3 Correct 156 ms 6188 KB Output is correct
4 Correct 123 ms 6188 KB Output is correct
5 Correct 139 ms 6188 KB Output is correct