제출 #1087003

#제출 시각아이디문제언어결과실행 시간메모리
1087003shidou26어르신 집배원 (BOI14_postmen)C++14
0 / 100
5 ms12124 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define all(V) v.begin(), v.end() typedef long long ll; typedef pair<int, int> ii; typedef pair<ll, int> li; const int N = 5e5 + 3; int n, m; int eu[N], ev[N]; vector<int> adj[N]; int vst[N], used[N]; stack<int> nodes; void prepare() { } void input() { cin >> n >> m; for(int i = 1; i <= m; i++) { int u, v; cin >> u >> v; eu[i] = u; ev[i] = v; adj[u].push_back(i); adj[v].push_back(i); } } void dfs(int u) { vst[u] = 1; nodes.push(u); while(!adj[u].empty()) { int id = adj[u].back(); adj[u].pop_back(); if(!used[id]) { used[id] = true; int v = eu[id] + ev[id] - u; if(!vst[v]) dfs(v); else if(vst[v] == 1) { int node; do { node = nodes.top(); nodes.pop(); cout << node << " "; vst[node] = 2; }while(node != v); cout << endl; } } } } void process() { for(int i = 1; i <= n; i++) { if(!adj[i].empty()) dfs(i); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #define task "kurumi" if(fopen(task".INP", "r")) { freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } prepare(); int testcase = 1; // cin >? testcase; for(int i = 1; i <= testcase; i++) { input(); process(); } return 0; }

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

postmen.cpp: In function 'int main()':
postmen.cpp:70:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |         freopen(task".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
postmen.cpp:71:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |         freopen(task".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...