답안 #58953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58953 2018-07-19T21:28:53 Z Benq 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
224 ms 14384 KB
#include "network.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int dist(int a, int b) { 
	if (a == b) return 0; 
	return ping(a,b)+1; 
}

vi v[1001];

void findRoute (int N, int a, int b) {
	int tot;
	FOR(i,1,N+1) if (i != b) v[dist(a,i)].pb(i);
	tot = dist(a,b);
	v[tot].pb(b);

	vi ans;
	int cur = b, d = tot;
	while (cur != a) {
		ans.pb(cur); d --;
		while (1) {
			int x = v[d].back(); v[d].pop_back();
			if (dist(x,cur) != 1) continue;
			cur = x; break;
		}
	}

	reverse(all(ans));
	for (int i: ans) travelTo(i);
}

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]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 4256 KB Output is correct
2 Correct 144 ms 4328 KB Output is correct
3 Correct 205 ms 4472 KB Output is correct
4 Correct 138 ms 4472 KB Output is correct
5 Correct 224 ms 4508 KB Output is correct
6 Correct 121 ms 4564 KB Output is correct
7 Correct 2 ms 4564 KB Output is correct
8 Correct 3 ms 4564 KB Output is correct
9 Correct 3 ms 4564 KB Output is correct
10 Correct 3 ms 4564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 159 ms 4564 KB Output is correct
2 Correct 34 ms 4564 KB Output is correct
3 Correct 135 ms 4564 KB Output is correct
4 Correct 125 ms 4564 KB Output is correct
5 Correct 141 ms 4564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 4564 KB Output is correct
2 Correct 44 ms 4564 KB Output is correct
3 Correct 169 ms 4564 KB Output is correct
4 Correct 104 ms 4564 KB Output is correct
5 Correct 167 ms 4564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 4616 KB Output is correct
2 Correct 35 ms 4616 KB Output is correct
3 Correct 199 ms 8684 KB Output is correct
4 Correct 119 ms 10640 KB Output is correct
5 Correct 186 ms 14384 KB Output is correct