Submission #16049

# Submission time Handle Problem Language Result Execution time Memory
16049 2015-08-10T12:13:08 Z kriii Computer Network (BOI14_network) C++14
0 / 100
125 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) + 1;
	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(b,p[d][i]) + 1 == dist){
					travelTo(a=p[d][i]);
					ed = 1;
					break;
				}
			}
		}
		if (!ed) travelTo(a=p[d][0]);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 92 ms 5216 KB Output is correct
2 Incorrect 125 ms 5216 KB Output isn't correct - ping called with invalid arguments
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 5216 KB Output is correct
2 Incorrect 20 ms 5216 KB Output isn't correct - ping called with invalid arguments
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 109 ms 5216 KB Output is correct
2 Incorrect 25 ms 5216 KB Output isn't correct - ping called with invalid arguments
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 62 ms 5216 KB Output is correct
2 Incorrect 22 ms 5216 KB Output isn't correct - ping called with invalid arguments
3 Halted 0 ms 0 KB -