Submission #36578

# Submission time Handle Problem Language Result Execution time Memory
36578 2017-12-11T03:12:19 Z minkank Computer Network (BOI14_network) C++14
100 / 100
139 ms 6004 KB
#include <bits/stdc++.h>
#include "network.h"
using namespace std;

typedef pair<int, int> ii;
#define st first
#define nd second

void findRoute(int N, int S, int T) {
	vector<ii> path;
	vector<int> res;
	path.push_back(ii(0, S));
	for(int i = 1; i <= N; ++i) if(i != S) path.push_back(ii(ping(S, i), i));
	sort(path.begin(), path.end());
	int last = -1;
	for(int i = path.size() - 1; i >= 0; --i) {
		if(path[i].nd == T) {
			last = i;
			continue;
		}
		if(last != -1) {
			int val = ping(path[i].nd, path[last].nd);
			if(val == -1) continue;
			if(val + path[i].st + 1 == path[last].st) last = i, res.push_back(path[i].nd);
		}
	}
	for(int i = res.size() - 1; i >= 0; --i) travelTo(res[i]); travelTo(T); 
}

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 129 ms 6004 KB Output is correct
2 Correct 129 ms 6004 KB Output is correct
3 Correct 103 ms 6004 KB Output is correct
4 Correct 109 ms 6004 KB Output is correct
5 Correct 133 ms 6004 KB Output is correct
6 Correct 99 ms 6004 KB Output is correct
7 Correct 0 ms 6004 KB Output is correct
8 Correct 0 ms 6004 KB Output is correct
9 Correct 0 ms 6004 KB Output is correct
10 Correct 0 ms 6004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 6004 KB Output is correct
2 Correct 23 ms 6004 KB Output is correct
3 Correct 139 ms 6004 KB Output is correct
4 Correct 113 ms 6004 KB Output is correct
5 Correct 123 ms 6004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 6004 KB Output is correct
2 Correct 23 ms 6004 KB Output is correct
3 Correct 129 ms 6004 KB Output is correct
4 Correct 96 ms 6004 KB Output is correct
5 Correct 139 ms 6004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 6004 KB Output is correct
2 Correct 23 ms 6004 KB Output is correct
3 Correct 116 ms 6004 KB Output is correct
4 Correct 96 ms 6004 KB Output is correct
5 Correct 129 ms 6004 KB Output is correct