제출 #1284927

#제출 시각아이디문제언어결과실행 시간메모리
1284927quanlmExperimental Charges (NOI19_charges)C++20
14 / 100
15 ms1280 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define oo 1e18 #define pb push_back #define ii pair<int, int> #define iii pair<int, ii> #define TASK "TEST" int n, q; int par[100005]; int acs(int u) { if (u == par[u]) return u; return par[u] = acs(par[u]); } void join(int u, int v) { int x = acs(u), y = acs(v); if (x != y) par[x] = y; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); freopen(TASK".ANS", "w", stdout); } cin >> n >> q; for (int i = 1; i <= n; i++) par[i] = i; while (q--) { char type; cin >> type; if (type == 'A') { int a, b; cin >> a >> b; } else if (type == 'R') { int a, b; cin >> a >> b; join(a, b); } else { int a, b; cin >> a >> b; cout << (acs(a) == acs(b) ? 'R' : '?') << '\n'; } // for (int i = 1; i <= n; i++) cout << e[i] << ' '; // cout << '\n'; } }

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

charges.cpp: In function 'int main()':
charges.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen(TASK".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
charges.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(TASK".ANS", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...