Submission #105972

# Submission time Handle Problem Language Result Execution time Memory
105972 2019-04-16T03:13:02 Z xiaowuc1 Computer Network (BOI14_network) C++14
100 / 100
175 ms 8176 KB
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <vector>

#include "network.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef vector<vector<ll>> matrix;

void findRoute(int N, int a, int b) {
	map<int, int> distToB;
	for(int i = 1; i <= N; i++) {
		if(i == b) distToB[i] = 0;
		else distToB[i] = ping(i, b) + 1;
	}
	int curr = a;
	while(curr != b) {
		if(distToB[curr] == 1) {
			travelTo(b);
			break;
		}
		bool found = false;
		for(auto out: distToB) {
			if(distToB[curr] == 1 + out.second) {
				if(ping(curr, out.first) == 0) {
					travelTo(out.first);
					curr = out.first;
					found = true;
					break;
				}
			}
		}
		assert(found);
	}
}

Compilation message

grader.c: In function 'int main()':
grader.c:48:11: 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:18: 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 174 ms 4344 KB Output is correct
2 Correct 138 ms 7672 KB Output is correct
3 Correct 90 ms 7064 KB Output is correct
4 Correct 89 ms 7120 KB Output is correct
5 Correct 123 ms 6776 KB Output is correct
6 Correct 107 ms 6788 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 4396 KB Output is correct
2 Correct 33 ms 2936 KB Output is correct
3 Correct 157 ms 7928 KB Output is correct
4 Correct 84 ms 6264 KB Output is correct
5 Correct 175 ms 8176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 4240 KB Output is correct
2 Correct 24 ms 2936 KB Output is correct
3 Correct 137 ms 7852 KB Output is correct
4 Correct 90 ms 6264 KB Output is correct
5 Correct 134 ms 8124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 4292 KB Output is correct
2 Correct 28 ms 2936 KB Output is correct
3 Correct 125 ms 7900 KB Output is correct
4 Correct 94 ms 6256 KB Output is correct
5 Correct 121 ms 7980 KB Output is correct