Submission #466224

# Submission time Handle Problem Language Result Execution time Memory
466224 2021-08-18T11:24:41 Z AmirElarbi Senior Postmen (BOI14_postmen) C++14
55 / 100
500 ms 57440 KB
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#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], 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 11980 KB Output is correct
4 Correct 10 ms 12236 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12364 KB Output is correct
7 Correct 15 ms 13328 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 49 ms 19140 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 9 ms 12236 KB Output is correct
12 Correct 59 ms 19516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12008 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 7 ms 11980 KB Output is correct
4 Correct 10 ms 12296 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 13320 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 50 ms 19140 KB Output is correct
10 Correct 10 ms 12196 KB Output is correct
11 Correct 10 ms 12204 KB Output is correct
12 Correct 58 ms 19476 KB Output is correct
13 Correct 72 ms 21044 KB Output is correct
14 Correct 96 ms 18256 KB Output is correct
15 Correct 110 ms 20360 KB Output is correct
16 Correct 59 ms 21060 KB Output is correct
17 Correct 118 ms 16264 KB Output is correct
18 Correct 100 ms 19396 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 7 ms 11980 KB Output is correct
4 Correct 10 ms 12236 KB Output is correct
5 Correct 8 ms 12136 KB Output is correct
6 Correct 9 ms 12364 KB Output is correct
7 Correct 14 ms 13284 KB Output is correct
8 Correct 8 ms 12200 KB Output is correct
9 Correct 50 ms 19264 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12236 KB Output is correct
12 Correct 56 ms 19460 KB Output is correct
13 Correct 69 ms 20992 KB Output is correct
14 Correct 103 ms 18252 KB Output is correct
15 Correct 110 ms 20364 KB Output is correct
16 Correct 62 ms 21136 KB Output is correct
17 Correct 116 ms 16196 KB Output is correct
18 Correct 100 ms 19416 KB Output is correct
19 Correct 418 ms 57440 KB Output is correct
20 Execution timed out 613 ms 43996 KB Time limit exceeded
21 Halted 0 ms 0 KB -