제출 #1269216

#제출 시각아이디문제언어결과실행 시간메모리
1269216G_thang_dizz_lenhiDrivers (BOI24_drivers)C++20
0 / 100
1 ms324 KiB
#include<bits/stdc++.h> typedef int ii; typedef long long ll; using namespace std; const string name = ""; const ii MOD = 1e9 + 7; const ii N = 1e5 + 10; void INP(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); if (fopen((name + ".inp").c_str(),"r")){ freopen((name + ".inp").c_str(),"r",stdin); freopen((name + ".out").c_str(),"w",stdout); } else{ freopen(".inp", "r", stdin); } } struct node{ ii u, v, w; ii type; bool operator<(const node &other){ if (w != other.w) return w < other.w; return type < other.type; } }; ii n, m, q; vector<node> a; ii par[N]; bool res[N]; void init(){ for (ii i = 1;i <= n;i++) par[i] = i; } ii find_par(ii u){ return (u == par[u] ? u : par[u] = find_par(par[u])); } void connect(ii u,ii v){ u = find_par(u); v = find_par(v); if (u != v) par[u] = v; } int main(){ INP(); cin >> n >> m >> q; ii u, v, w, type; for (ii i = 0;i < m;i++){ cin >> u >> v >> w; a.push_back({u, v, w, 0}); } for (ii i = 1;i <= q;i++){ cin >> u >> v >> w; a.push_back({u, v, w, i}); } init(); sort(a.begin(), a.end()); for (ii i = 0;i < a.size();i++){ u = a[i].u; v = a[i].v; w = a[i].w; type = a[i].type; if (type == 0){ connect(u, v); } else{ res[type] = (find_par(u) == find_par(v)); } } for (ii i = 1;i <= q;i++){ if (res[i]){ cout << "TAIP\n"; } else{ cout << "NE\n"; } } return 0; } //NGT 1600-2000 cf //1/200 hard quests

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void INP()':
Main.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen((name + ".inp").c_str(),"r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen((name + ".out").c_str(),"w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:18:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         freopen(".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
#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...