이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// subtask 1
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define INF 1e9
using namespace std;
typedef long long ll;
ll link[200005];
ll sz[200005];
ll find(ll x) {
while (x != link[x]) x = link[x];
return x;
}
void unite(ll a, ll b) {
a = find(a);
b = find(b);
if (sz[a] < sz[b]) swap(a, b);
sz[a] += sz[b];
link[b] = a;
}
void solve()
{
int n, m, u; cin >> n >> m >> u;
for (int i = 1; i <= n; i++) {
link[i] = i; sz[i] = 1;
}
ll t = 0;
for (int i = 1; i <= m; i++) {
int a, b; cin >> a >> b >> t;
unite(a, b);
}
while (u--) {
int a, b; cin >> a >> b; ll p; cin >> p;
if (find(a) != find(b)) {
cout << "NE" << "\n";
}
else if (p < t) {
cout << "NE" << "\n";
}
else cout << "TAIP" << "\n";
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;// cin>>t;
while (t--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |