답안 #1111534

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

int main() {
	int n, m, u; cin >> n >> m >> u;
	vector <vector<pair<int, int>>> edges{n+5};
	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);
		while (visit[y] == 0 and tmp.size() > 0) {
			auto cur = tmp.front();
			tmp.pop();
			if (visit[cur] == 1) continue;
			visit[cur] = 1;
			for (auto i:edges[cur]) {
				if (i.second <= z and visit[i.first] == 0) tmp.push(i.first);
			}
		}
		if (visit[y] == 0) cout << "NE" << '\n';
		else cout << "TAIF" << '\n';
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:6:41: warning: narrowing conversion of '(n + 5)' from 'int' to 'std::vector<std::vector<std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wnarrowing]
    6 |  vector <vector<pair<int, int>>> edges{n+5};
      |                                        ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -