제출 #1193309

#제출 시각아이디문제언어결과실행 시간메모리
1193309CrabCNHPipes (CEOI15_pipes)C++20
0 / 100
61 ms131072 KiB
#include <bits/stdc++.h> #define task "BriantheCrab" #define pii pair <int, int> #define fi first #define se second #define szf sizeof #define sz(s) (int)((s).size()) using namespace std; template <class T> void mini (T &t, T f) {if (t > f) t = f;} template <class T> void maxi (T &t, T f) {if (t < f) t = f;} const int maxN = 6e6 + 5; const int inf = 1e18 + 7; const int mod = 1e9 + 7; int n, m; int low[maxN], num[maxN]; bool used[maxN], bridge[maxN]; vector <int> adj[maxN]; pii edge[maxN]; int tDfs = 0; void dfs (int u) { low[u] = n + 1; num[u] = ++tDfs; for (auto curEdge : adj[u]) { if (used[curEdge] == 1) { continue; } used[curEdge] = 1; int v = edge[curEdge].fi ^ edge[curEdge].se ^ u; if (num[v] == 0) { dfs (v); mini (low[u], low[v]); if (low[v] > num[u]) { bridge[curEdge] = true; } } else { mini (low[u], num[v]); } } } void solve () { cin >> n >> m; for (int i = 1; i <= m; i ++) { int u, v; cin >> u >> v; adj[u].push_back (i); adj[v].push_back (i); edge[i] = {u, v}; } for (int i = 1; i <= n; i ++) { if (num[i] == 0) { dfs (i); } } for (int i = 1; i <= m; i ++) { if (bridge[i]) { cout << edge[i].fi << ' ' << edge[i].se << '\n'; } } return; } signed main () { cin.tie (nullptr) -> sync_with_stdio (false); if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } int t = 1; //cin >> t; while (t --) { solve (); } return 0; } // thfdgb

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

pipes.cpp:17:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   17 | const int inf = 1e18 + 7;
      |                 ~~~~~^~~
pipes.cpp: In function 'int main()':
pipes.cpp:74:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
pipes.cpp:75:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |         freopen (task".out", "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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...