답안 #1111547

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1111547 2024-11-12T09:26:27 Z YSH2020 Drivers (BOI24_drivers) C++17
11 / 100
2000 ms 1268 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m, u; cin >> n >> m >> u;
	vector <vector<pair<int, int>>> edges;
	vector<pair<int, int>> empty;
	for (int i= 0; i < n+5; i++) edges.push_back(empty);
	for (int i = 0; i < m; i++) {
		int x, y, z; cin >> x >> y >> z;
		edges[x].push_back({y, z});
		edges[y].push_back({x, z});
	}
	while (u--) {
		int x, y, z; cin >> x >> y >> z;
		int visit[n+5]; for (int i=1; i<=n;i++) visit[i] = 0;
		queue<int> tmp;
		tmp.push(x);
		visit[x] = 1;
		while (visit[y] == 0 and tmp.size() > 0) {
			auto cur = tmp.front();
			tmp.pop();
			for (auto i:edges[cur]) {
				if (i.second <= z and visit[i.first] == 0) {tmp.push(i.first); visit[i.first] = 1;}
			}
		}
		if (visit[y] == 0) cout << "NE" << '\n';
		else cout << "TAIP" << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 4 ms 784 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Execution timed out 2075 ms 1064 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 336 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 14 ms 592 KB Output is correct
11 Correct 21 ms 592 KB Output is correct
12 Correct 18 ms 580 KB Output is correct
13 Correct 4 ms 784 KB Output is correct
14 Correct 15 ms 592 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 6 ms 336 KB Output is correct
19 Correct 533 ms 1268 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 7 ms 336 KB Output is correct
23 Correct 2 ms 504 KB Output is correct
24 Correct 374 ms 1008 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 4 ms 784 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Execution timed out 2075 ms 1064 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 4 ms 784 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Execution timed out 2075 ms 1064 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 4 ms 784 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Execution timed out 2075 ms 1064 KB Time limit exceeded
6 Halted 0 ms 0 KB -