Submission #16045

# Submission time Handle Problem Language Result Execution time Memory
16045 2015-08-10T11:57:10 Z kaTkaHr Computer Network (BOI14_network) C++
100 / 100
166 ms 5220 KB
#include "network.h"
#include<vector>

using namespace std;

const int MX = 1005;

vector<int> G[MX];

void findRoute (int N, int a, int b)
{
	int D = ping(a, b) + 1;
	for (int i = 1; i <= N; i++){
		if (i == b) G[0].push_back(b);
		else if( i != a ) G[ping(b, i) + 1].push_back(i);
		else G[D].push_back(i);
	}
	int nw = a;
	for (int i = 1;; i++){
		int nxt = -1;
		for (int j = 0; j < G[D - i].size(); j++){
			int c = G[D - i][j];
			if (ping(nw, c) == 0){
				nxt = c;
				if (nxt == b){
					travelTo(nxt);
					return;
				}
			}
		}
		nw = nxt;
		travelTo(nxt);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 136 ms 5220 KB Output is correct
2 Correct 111 ms 5220 KB Output is correct
3 Correct 115 ms 5220 KB Output is correct
4 Correct 135 ms 5220 KB Output is correct
5 Correct 121 ms 5220 KB Output is correct
6 Correct 108 ms 5220 KB Output is correct
7 Correct 0 ms 5220 KB Output is correct
8 Correct 0 ms 5220 KB Output is correct
9 Correct 0 ms 5220 KB Output is correct
10 Correct 0 ms 5220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 5220 KB Output is correct
2 Correct 35 ms 5220 KB Output is correct
3 Correct 136 ms 5220 KB Output is correct
4 Correct 77 ms 5220 KB Output is correct
5 Correct 166 ms 5220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 117 ms 5220 KB Output is correct
2 Correct 29 ms 5220 KB Output is correct
3 Correct 79 ms 5220 KB Output is correct
4 Correct 112 ms 5220 KB Output is correct
5 Correct 98 ms 5220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 5220 KB Output is correct
2 Correct 30 ms 5220 KB Output is correct
3 Correct 142 ms 5220 KB Output is correct
4 Correct 109 ms 5220 KB Output is correct
5 Correct 120 ms 5220 KB Output is correct