# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
930913 | 2024-02-20T19:31:56 Z | Denkata | Senior Postmen (BOI14_postmen) | C++14 | 7 ms | 15196 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 5e5+3; int i,j,p,q,n,m,k; int used[maxn],uk[maxn],came[maxn],usedge[maxn]; vector <pair <int,int>> v[maxn]; vector <vector <int>> ans; void dfs(int u) { if(used[u]){ p = u; while(used[p]) { cout<<p<<" "; used[p] = 0; p = came[p]; } cout<<endl; } while(uk[u]<v[u].size()) { q = v[u][uk[u]].second; int edge = v[u][uk[u]].first; uk[u]++; if(!usedge[edge]) { usedge[edge] = true; used[u] = 1; came[q] = u; dfs(q); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>m; for(i=1;i<=m;i++) { cin>>p>>q; v[p].push_back({i,q}); v[q].push_back({i,p}); } dfs(1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 14936 KB | Output is correct |
2 | Correct | 4 ms | 14936 KB | Output is correct |
3 | Correct | 4 ms | 14940 KB | Output is correct |
4 | Correct | 5 ms | 15196 KB | Output is correct |
5 | Incorrect | 3 ms | 14940 KB | Edge does not exist or used 7, 23 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 14940 KB | Output is correct |
2 | Correct | 3 ms | 14940 KB | Output is correct |
3 | Correct | 3 ms | 14940 KB | Output is correct |
4 | Correct | 6 ms | 15196 KB | Output is correct |
5 | Incorrect | 4 ms | 14940 KB | Edge does not exist or used 7, 23 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 14940 KB | Output is correct |
2 | Correct | 3 ms | 14936 KB | Output is correct |
3 | Correct | 3 ms | 14936 KB | Output is correct |
4 | Correct | 7 ms | 15192 KB | Output is correct |
5 | Incorrect | 4 ms | 14936 KB | Edge does not exist or used 7, 23 |
6 | Halted | 0 ms | 0 KB | - |