제출 #1102988

#제출 시각아이디문제언어결과실행 시간메모리
1102988THXuanDrivers (BOI24_drivers)C++14
10 / 100
668 ms5780 KiB
// 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...