Submission #466231

# Submission time Handle Problem Language Result Execution time Memory
466231 2021-08-18T11:28:32 Z AmirElarbi Senior Postmen (BOI14_postmen) C++17
55 / 100
500 ms 57460 KB
#include <bits/stdc++.h>
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e7
#define unsigned u
#define eps 1e-18
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MAX_A 100005
#define V 450
#define re register
#define maxi(a,b) ((a) > (b) ? (a) : (b))
using namespace std;
const int maxn = 5e5 + 5;
struct edge { int fi, se; };
ve<edge> adj[maxn];
bool vis[maxn], tv[maxn];
int parent[maxn];
void dfs(int u){
    if(tv[u]){
        while(tv[u]){
            cout << u << " ";
            tv[u] = 0;
            u = parent[u];
        }
        cout << endl;
    }
    while(!adj[u].empty()){
        edge x =adj[u].back();
        adj[u].pop_back();
        if(!vis[x.se]){
            vis[x.se] = 1;
            tv[u] = 1;
            parent[u] = x.fi;
            dfs(x.fi);
        }
    }
}
int main(){
    optimise;
    int n,m,a,b;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        cin >> a >>b;
        adj[a].pb({b,i});
        adj[b].pb({a,i});
    }
    dfs(1);
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12072 KB Output is correct
2 Correct 7 ms 11988 KB Output is correct
3 Correct 7 ms 11980 KB Output is correct
4 Correct 10 ms 12224 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 9 ms 12364 KB Output is correct
7 Correct 14 ms 13316 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 49 ms 19136 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 9 ms 12236 KB Output is correct
12 Correct 60 ms 19476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 9 ms 11980 KB Output is correct
3 Correct 7 ms 11980 KB Output is correct
4 Correct 10 ms 12236 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 10 ms 12432 KB Output is correct
7 Correct 14 ms 13260 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 49 ms 19192 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 9 ms 12236 KB Output is correct
12 Correct 60 ms 19516 KB Output is correct
13 Correct 63 ms 20992 KB Output is correct
14 Correct 102 ms 18272 KB Output is correct
15 Correct 115 ms 20240 KB Output is correct
16 Correct 60 ms 21032 KB Output is correct
17 Correct 155 ms 16236 KB Output is correct
18 Correct 115 ms 19416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 7 ms 12000 KB Output is correct
3 Correct 7 ms 11980 KB Output is correct
4 Correct 10 ms 12236 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 9 ms 12364 KB Output is correct
7 Correct 14 ms 13236 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 50 ms 19224 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 9 ms 12236 KB Output is correct
12 Correct 60 ms 19556 KB Output is correct
13 Correct 62 ms 21004 KB Output is correct
14 Correct 105 ms 18372 KB Output is correct
15 Correct 113 ms 20284 KB Output is correct
16 Correct 75 ms 21060 KB Output is correct
17 Correct 128 ms 16196 KB Output is correct
18 Correct 108 ms 19524 KB Output is correct
19 Correct 421 ms 57460 KB Output is correct
20 Execution timed out 628 ms 44000 KB Time limit exceeded
21 Halted 0 ms 0 KB -