Submission #466210

# Submission time Handle Problem Language Result Execution time Memory
466210 2021-08-18T11:13:43 Z AmirElarbi Senior Postmen (BOI14_postmen) C++14
55 / 100
500 ms 58916 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;
vii adj[500005];
bool vis[500005];
int tv[500005];
int n,m,used;
int parent[500005];
void dfs(int u){
    if(tv[u]){
        while(tv[u]){
            cout << u << " ";
            tv[u] = 0;
            u = parent[u];
        }
        cout << endl;
    }
    while(!adj[u].empty()){
        ii 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;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int a,b;
        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 11980 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 7 ms 12016 KB Output is correct
4 Correct 10 ms 12252 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 10 ms 12364 KB Output is correct
7 Correct 18 ms 13260 KB Output is correct
8 Correct 9 ms 12236 KB Output is correct
9 Correct 56 ms 19140 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12236 KB Output is correct
12 Correct 61 ms 19556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 8 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 12364 KB Output is correct
7 Correct 15 ms 13200 KB Output is correct
8 Correct 9 ms 12268 KB Output is correct
9 Correct 52 ms 19184 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12236 KB Output is correct
12 Correct 60 ms 19468 KB Output is correct
13 Correct 63 ms 21324 KB Output is correct
14 Correct 112 ms 18528 KB Output is correct
15 Correct 110 ms 20404 KB Output is correct
16 Correct 65 ms 21248 KB Output is correct
17 Correct 132 ms 16444 KB Output is correct
18 Correct 102 ms 19652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 7 ms 12072 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 13200 KB Output is correct
8 Correct 8 ms 12252 KB Output is correct
9 Correct 51 ms 19244 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12236 KB Output is correct
12 Correct 57 ms 19524 KB Output is correct
13 Correct 65 ms 21292 KB Output is correct
14 Correct 111 ms 18544 KB Output is correct
15 Correct 121 ms 20368 KB Output is correct
16 Correct 79 ms 21272 KB Output is correct
17 Correct 154 ms 16544 KB Output is correct
18 Correct 107 ms 19780 KB Output is correct
19 Correct 484 ms 58916 KB Output is correct
20 Execution timed out 644 ms 45040 KB Time limit exceeded
21 Halted 0 ms 0 KB -