답안 #198680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198680 2020-01-27T09:33:34 Z arnold518 꿈 (IOI13_dreaming) C++14
47 / 100
147 ms 17780 KB
#include "dreaming.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 1e5;
const int INF = 987654321;

int N, M, L;
vector<pii> adj[MAXN+10];

bool vis[MAXN+10];
int DA[MAXN+10], DB[MAXN+10], ans;

void dfs(int now, int bef, int *dist, int dep, vector<int> &V)
{
	dist[now]=dep; vis[now]=true; V.push_back(now);
	for(auto nxt : adj[now])
	{
		if(nxt.first==bef) continue;
		dfs(nxt.first, now, dist, dep+nxt.second, V);
	}
}

int travelTime(int _N, int _M, int _L, int _A[], int _B[], int _T[])
{
	int i, j;
	N=_N; M=_M; L=_L;
	for(i=0; i<M; i++)
	{
		int u=_A[i]+1, v=_B[i]+1, w=_T[i];
		adj[u].push_back({v, w});
		adj[v].push_back({u, w});
	}

	vector<int> S;
	for(i=1; i<=N; i++)
	{
		if(vis[i]) continue;
		int u, v; vector<int> V;

		V.clear(); dfs(i, i, DA, 0, V);
		u=i; for(auto it : V) if(DA[u]<DA[it]) u=it;
		
		V.clear(); dfs(u, u, DA, 0, V);
		v=u; for(auto it : V) if(DA[v]<DA[it]) v=it;

		V.clear(); dfs(v, v, DB, 0, V);

		ans=max(ans, DB[u]);

		int now=INF;
		for(auto it : V) now=min(now, max(DA[it], DB[it]));
		S.push_back(now);
	}
	ans=max(ans, S[0]+S[1]+L);
	return ans;
}

Compilation message

dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:30:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 15092 KB Output is correct
2 Correct 80 ms 14964 KB Output is correct
3 Correct 53 ms 10868 KB Output is correct
4 Correct 21 ms 4472 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 22 ms 5496 KB Output is correct
7 Correct 7 ms 2684 KB Output is correct
8 Correct 36 ms 6904 KB Output is correct
9 Correct 48 ms 8696 KB Output is correct
10 Correct 7 ms 2808 KB Output is correct
11 Correct 89 ms 10360 KB Output is correct
12 Correct 123 ms 12656 KB Output is correct
13 Correct 7 ms 2808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 15092 KB Output is correct
2 Correct 80 ms 14964 KB Output is correct
3 Correct 53 ms 10868 KB Output is correct
4 Correct 21 ms 4472 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 22 ms 5496 KB Output is correct
7 Correct 7 ms 2684 KB Output is correct
8 Correct 36 ms 6904 KB Output is correct
9 Correct 48 ms 8696 KB Output is correct
10 Correct 7 ms 2808 KB Output is correct
11 Correct 89 ms 10360 KB Output is correct
12 Correct 123 ms 12656 KB Output is correct
13 Correct 7 ms 2808 KB Output is correct
14 Correct 7 ms 2680 KB Output is correct
15 Correct 7 ms 2680 KB Output is correct
16 Correct 7 ms 2684 KB Output is correct
17 Correct 7 ms 2680 KB Output is correct
18 Correct 7 ms 2680 KB Output is correct
19 Correct 7 ms 2680 KB Output is correct
20 Correct 7 ms 2808 KB Output is correct
21 Correct 8 ms 2684 KB Output is correct
22 Correct 7 ms 2808 KB Output is correct
23 Correct 7 ms 2680 KB Output is correct
24 Correct 7 ms 2808 KB Output is correct
25 Correct 7 ms 2680 KB Output is correct
26 Correct 7 ms 2680 KB Output is correct
27 Correct 7 ms 2680 KB Output is correct
28 Correct 7 ms 2680 KB Output is correct
29 Correct 7 ms 2680 KB Output is correct
30 Correct 7 ms 2680 KB Output is correct
31 Correct 7 ms 2680 KB Output is correct
32 Correct 7 ms 2680 KB Output is correct
33 Correct 6 ms 2680 KB Output is correct
34 Correct 7 ms 2680 KB Output is correct
35 Correct 7 ms 2680 KB Output is correct
36 Correct 7 ms 2680 KB Output is correct
37 Correct 6 ms 2680 KB Output is correct
38 Correct 7 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 15092 KB Output is correct
2 Correct 80 ms 14964 KB Output is correct
3 Correct 53 ms 10868 KB Output is correct
4 Correct 21 ms 4472 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 22 ms 5496 KB Output is correct
7 Correct 7 ms 2684 KB Output is correct
8 Correct 36 ms 6904 KB Output is correct
9 Correct 48 ms 8696 KB Output is correct
10 Correct 7 ms 2808 KB Output is correct
11 Correct 89 ms 10360 KB Output is correct
12 Correct 123 ms 12656 KB Output is correct
13 Correct 7 ms 2808 KB Output is correct
14 Correct 7 ms 2680 KB Output is correct
15 Correct 7 ms 2680 KB Output is correct
16 Correct 7 ms 2684 KB Output is correct
17 Correct 7 ms 2680 KB Output is correct
18 Correct 7 ms 2680 KB Output is correct
19 Correct 7 ms 2680 KB Output is correct
20 Correct 7 ms 2808 KB Output is correct
21 Correct 8 ms 2684 KB Output is correct
22 Correct 7 ms 2808 KB Output is correct
23 Correct 7 ms 2680 KB Output is correct
24 Correct 7 ms 2808 KB Output is correct
25 Correct 7 ms 2680 KB Output is correct
26 Correct 7 ms 2680 KB Output is correct
27 Correct 7 ms 2680 KB Output is correct
28 Correct 7 ms 2680 KB Output is correct
29 Correct 7 ms 2680 KB Output is correct
30 Correct 7 ms 2680 KB Output is correct
31 Correct 7 ms 2680 KB Output is correct
32 Correct 7 ms 2680 KB Output is correct
33 Correct 6 ms 2680 KB Output is correct
34 Correct 7 ms 2680 KB Output is correct
35 Correct 7 ms 2680 KB Output is correct
36 Correct 7 ms 2680 KB Output is correct
37 Correct 6 ms 2680 KB Output is correct
38 Correct 7 ms 2680 KB Output is correct
39 Correct 87 ms 16420 KB Output is correct
40 Correct 82 ms 16244 KB Output is correct
41 Correct 49 ms 11764 KB Output is correct
42 Correct 15 ms 4728 KB Output is correct
43 Correct 7 ms 2680 KB Output is correct
44 Correct 7 ms 2680 KB Output is correct
45 Correct 7 ms 2684 KB Output is correct
46 Correct 7 ms 2684 KB Output is correct
47 Correct 6 ms 2680 KB Output is correct
48 Correct 7 ms 2680 KB Output is correct
49 Correct 7 ms 2680 KB Output is correct
50 Correct 7 ms 2680 KB Output is correct
51 Correct 7 ms 2680 KB Output is correct
52 Correct 7 ms 2680 KB Output is correct
53 Correct 7 ms 2680 KB Output is correct
54 Correct 7 ms 2680 KB Output is correct
55 Correct 7 ms 2680 KB Output is correct
56 Correct 7 ms 2680 KB Output is correct
57 Correct 136 ms 10604 KB Output is correct
58 Correct 138 ms 10640 KB Output is correct
59 Correct 141 ms 10480 KB Output is correct
60 Correct 140 ms 10552 KB Output is correct
61 Correct 118 ms 10740 KB Output is correct
62 Correct 122 ms 10720 KB Output is correct
63 Correct 119 ms 10224 KB Output is correct
64 Correct 120 ms 10228 KB Output is correct
65 Correct 106 ms 10512 KB Output is correct
66 Correct 117 ms 10612 KB Output is correct
67 Correct 136 ms 10480 KB Output is correct
68 Correct 127 ms 10480 KB Output is correct
69 Correct 137 ms 10820 KB Output is correct
70 Correct 142 ms 10836 KB Output is correct
71 Correct 7 ms 2680 KB Output is correct
72 Correct 8 ms 2936 KB Output is correct
73 Correct 9 ms 2936 KB Output is correct
74 Correct 9 ms 2936 KB Output is correct
75 Correct 9 ms 2936 KB Output is correct
76 Correct 9 ms 2936 KB Output is correct
77 Correct 8 ms 2936 KB Output is correct
78 Correct 9 ms 2936 KB Output is correct
79 Correct 9 ms 2936 KB Output is correct
80 Correct 135 ms 10608 KB Output is correct
81 Correct 142 ms 10352 KB Output is correct
82 Correct 132 ms 10612 KB Output is correct
83 Correct 123 ms 10608 KB Output is correct
84 Correct 9 ms 2808 KB Output is correct
85 Correct 8 ms 2808 KB Output is correct
86 Correct 9 ms 2808 KB Output is correct
87 Correct 8 ms 2936 KB Output is correct
88 Correct 8 ms 2936 KB Output is correct
89 Correct 10 ms 2936 KB Output is correct
90 Correct 9 ms 2936 KB Output is correct
91 Correct 9 ms 2936 KB Output is correct
92 Correct 9 ms 2936 KB Output is correct
93 Correct 9 ms 2936 KB Output is correct
94 Correct 6 ms 2680 KB Output is correct
95 Correct 7 ms 2680 KB Output is correct
96 Correct 7 ms 2680 KB Output is correct
97 Correct 7 ms 2680 KB Output is correct
98 Correct 7 ms 2680 KB Output is correct
99 Correct 7 ms 2680 KB Output is correct
100 Correct 9 ms 2680 KB Output is correct
101 Correct 7 ms 2680 KB Output is correct
102 Correct 7 ms 2684 KB Output is correct
103 Correct 8 ms 2680 KB Output is correct
104 Correct 13 ms 3704 KB Output is correct
105 Correct 22 ms 5752 KB Output is correct
106 Correct 8 ms 2684 KB Output is correct
107 Correct 43 ms 7416 KB Output is correct
108 Correct 47 ms 9464 KB Output is correct
109 Correct 7 ms 2808 KB Output is correct
110 Correct 94 ms 11640 KB Output is correct
111 Correct 113 ms 13684 KB Output is correct
112 Correct 8 ms 2936 KB Output is correct
113 Correct 147 ms 17780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 6264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 15092 KB Output is correct
2 Correct 80 ms 14964 KB Output is correct
3 Correct 53 ms 10868 KB Output is correct
4 Correct 21 ms 4472 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 22 ms 5496 KB Output is correct
7 Correct 7 ms 2684 KB Output is correct
8 Correct 36 ms 6904 KB Output is correct
9 Correct 48 ms 8696 KB Output is correct
10 Correct 7 ms 2808 KB Output is correct
11 Correct 89 ms 10360 KB Output is correct
12 Correct 123 ms 12656 KB Output is correct
13 Correct 7 ms 2808 KB Output is correct
14 Correct 7 ms 2808 KB Output is correct
15 Correct 8 ms 2808 KB Output is correct
16 Correct 9 ms 2808 KB Output is correct
17 Incorrect 8 ms 2680 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 15092 KB Output is correct
2 Correct 80 ms 14964 KB Output is correct
3 Correct 53 ms 10868 KB Output is correct
4 Correct 21 ms 4472 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 22 ms 5496 KB Output is correct
7 Correct 7 ms 2684 KB Output is correct
8 Correct 36 ms 6904 KB Output is correct
9 Correct 48 ms 8696 KB Output is correct
10 Correct 7 ms 2808 KB Output is correct
11 Correct 89 ms 10360 KB Output is correct
12 Correct 123 ms 12656 KB Output is correct
13 Correct 7 ms 2808 KB Output is correct
14 Correct 7 ms 2680 KB Output is correct
15 Correct 7 ms 2680 KB Output is correct
16 Correct 7 ms 2684 KB Output is correct
17 Correct 7 ms 2680 KB Output is correct
18 Correct 7 ms 2680 KB Output is correct
19 Correct 7 ms 2680 KB Output is correct
20 Correct 7 ms 2808 KB Output is correct
21 Correct 8 ms 2684 KB Output is correct
22 Correct 7 ms 2808 KB Output is correct
23 Correct 7 ms 2680 KB Output is correct
24 Correct 7 ms 2808 KB Output is correct
25 Correct 7 ms 2680 KB Output is correct
26 Correct 7 ms 2680 KB Output is correct
27 Correct 7 ms 2680 KB Output is correct
28 Correct 7 ms 2680 KB Output is correct
29 Correct 7 ms 2680 KB Output is correct
30 Correct 7 ms 2680 KB Output is correct
31 Correct 7 ms 2680 KB Output is correct
32 Correct 7 ms 2680 KB Output is correct
33 Correct 6 ms 2680 KB Output is correct
34 Correct 7 ms 2680 KB Output is correct
35 Correct 7 ms 2680 KB Output is correct
36 Correct 7 ms 2680 KB Output is correct
37 Correct 6 ms 2680 KB Output is correct
38 Correct 7 ms 2680 KB Output is correct
39 Correct 87 ms 16420 KB Output is correct
40 Correct 82 ms 16244 KB Output is correct
41 Correct 49 ms 11764 KB Output is correct
42 Correct 15 ms 4728 KB Output is correct
43 Correct 7 ms 2680 KB Output is correct
44 Correct 7 ms 2680 KB Output is correct
45 Correct 7 ms 2684 KB Output is correct
46 Correct 7 ms 2684 KB Output is correct
47 Correct 6 ms 2680 KB Output is correct
48 Correct 7 ms 2680 KB Output is correct
49 Correct 7 ms 2680 KB Output is correct
50 Correct 7 ms 2680 KB Output is correct
51 Correct 7 ms 2680 KB Output is correct
52 Correct 7 ms 2680 KB Output is correct
53 Correct 7 ms 2680 KB Output is correct
54 Correct 7 ms 2680 KB Output is correct
55 Correct 7 ms 2680 KB Output is correct
56 Correct 7 ms 2680 KB Output is correct
57 Correct 136 ms 10604 KB Output is correct
58 Correct 138 ms 10640 KB Output is correct
59 Correct 141 ms 10480 KB Output is correct
60 Correct 140 ms 10552 KB Output is correct
61 Correct 118 ms 10740 KB Output is correct
62 Correct 122 ms 10720 KB Output is correct
63 Correct 119 ms 10224 KB Output is correct
64 Correct 120 ms 10228 KB Output is correct
65 Correct 106 ms 10512 KB Output is correct
66 Correct 117 ms 10612 KB Output is correct
67 Correct 136 ms 10480 KB Output is correct
68 Correct 127 ms 10480 KB Output is correct
69 Correct 137 ms 10820 KB Output is correct
70 Correct 142 ms 10836 KB Output is correct
71 Correct 7 ms 2680 KB Output is correct
72 Correct 8 ms 2936 KB Output is correct
73 Correct 9 ms 2936 KB Output is correct
74 Correct 9 ms 2936 KB Output is correct
75 Correct 9 ms 2936 KB Output is correct
76 Correct 9 ms 2936 KB Output is correct
77 Correct 8 ms 2936 KB Output is correct
78 Correct 9 ms 2936 KB Output is correct
79 Correct 9 ms 2936 KB Output is correct
80 Correct 135 ms 10608 KB Output is correct
81 Correct 142 ms 10352 KB Output is correct
82 Correct 132 ms 10612 KB Output is correct
83 Correct 123 ms 10608 KB Output is correct
84 Correct 9 ms 2808 KB Output is correct
85 Correct 8 ms 2808 KB Output is correct
86 Correct 9 ms 2808 KB Output is correct
87 Correct 8 ms 2936 KB Output is correct
88 Correct 8 ms 2936 KB Output is correct
89 Correct 10 ms 2936 KB Output is correct
90 Correct 9 ms 2936 KB Output is correct
91 Correct 9 ms 2936 KB Output is correct
92 Correct 9 ms 2936 KB Output is correct
93 Correct 9 ms 2936 KB Output is correct
94 Correct 6 ms 2680 KB Output is correct
95 Correct 7 ms 2680 KB Output is correct
96 Correct 7 ms 2680 KB Output is correct
97 Correct 7 ms 2680 KB Output is correct
98 Correct 7 ms 2680 KB Output is correct
99 Correct 7 ms 2680 KB Output is correct
100 Correct 9 ms 2680 KB Output is correct
101 Correct 7 ms 2680 KB Output is correct
102 Correct 7 ms 2684 KB Output is correct
103 Correct 8 ms 2680 KB Output is correct
104 Correct 13 ms 3704 KB Output is correct
105 Correct 22 ms 5752 KB Output is correct
106 Correct 8 ms 2684 KB Output is correct
107 Correct 43 ms 7416 KB Output is correct
108 Correct 47 ms 9464 KB Output is correct
109 Correct 7 ms 2808 KB Output is correct
110 Correct 94 ms 11640 KB Output is correct
111 Correct 113 ms 13684 KB Output is correct
112 Correct 8 ms 2936 KB Output is correct
113 Correct 147 ms 17780 KB Output is correct
114 Incorrect 41 ms 6264 KB Output isn't correct
115 Halted 0 ms 0 KB -