Submission #16052

# Submission time Handle Problem Language Result Execution time Memory
16052 2015-08-10T12:17:43 Z kriii Computer Network (BOI14_network) C++14
100 / 100
153 ms 5216 KB
#include "network.h"
#include <vector>
using namespace std;

vector<int> p[1001];

void findRoute (int N, int a, int b)
{
	int dist = ping(a,b);
	for (int i=1;i<=N;i++) if (i != a){
		p[ping(a,i)+1].push_back(i);
	}

	for (int d=1;d<=dist;d++){
		bool ed = 0;
		for (int i=1;i<p[d].size();i++){
			if (ping(a,p[d][i]) == 0){
				if (d + ping(p[d][i],b) == dist){
					travelTo(a=p[d][i]);
					ed = 1;
					break;
				}
			}
		}
		if (!ed) travelTo(a=p[d][0]);
	}
	travelTo(b);
}
# Verdict Execution time Memory Grader output
1 Correct 122 ms 5216 KB Output is correct
2 Correct 130 ms 5216 KB Output is correct
3 Correct 106 ms 5216 KB Output is correct
4 Correct 87 ms 5216 KB Output is correct
5 Correct 102 ms 5216 KB Output is correct
6 Correct 61 ms 5216 KB Output is correct
7 Correct 0 ms 5216 KB Output is correct
8 Correct 0 ms 5216 KB Output is correct
9 Correct 0 ms 5216 KB Output is correct
10 Correct 0 ms 5216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 5216 KB Output is correct
2 Correct 20 ms 5216 KB Output is correct
3 Correct 147 ms 5216 KB Output is correct
4 Correct 114 ms 5216 KB Output is correct
5 Correct 132 ms 5216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 5216 KB Output is correct
2 Correct 26 ms 5216 KB Output is correct
3 Correct 100 ms 5216 KB Output is correct
4 Correct 81 ms 5216 KB Output is correct
5 Correct 135 ms 5216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 126 ms 5216 KB Output is correct
2 Correct 21 ms 5216 KB Output is correct
3 Correct 153 ms 5216 KB Output is correct
4 Correct 90 ms 5216 KB Output is correct
5 Correct 88 ms 5216 KB Output is correct