답안 #466214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
466214 2021-08-18T11:15:09 Z AmirElarbi 어르신 집배원 (BOI14_postmen) C++14
55 / 100
500 ms 57504 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];
bool 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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 11980 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 7 ms 12068 KB Output is correct
4 Correct 10 ms 12232 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 12 ms 12364 KB Output is correct
7 Correct 18 ms 13264 KB Output is correct
8 Correct 8 ms 12252 KB Output is correct
9 Correct 50 ms 19148 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12164 KB Output is correct
12 Correct 56 ms 19564 KB Output is correct
# 결과 실행 시간 메모리 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 12140 KB Output is correct
6 Correct 10 ms 12364 KB Output is correct
7 Correct 14 ms 13260 KB Output is correct
8 Correct 10 ms 12236 KB Output is correct
9 Correct 54 ms 19128 KB Output is correct
10 Correct 12 ms 12204 KB Output is correct
11 Correct 10 ms 12364 KB Output is correct
12 Correct 56 ms 19460 KB Output is correct
13 Correct 66 ms 21036 KB Output is correct
14 Correct 100 ms 18240 KB Output is correct
15 Correct 114 ms 20244 KB Output is correct
16 Correct 64 ms 20960 KB Output is correct
17 Correct 126 ms 16196 KB Output is correct
18 Correct 135 ms 19520 KB Output is correct
# 결과 실행 시간 메모리 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 7 ms 12108 KB Output is correct
6 Correct 10 ms 12328 KB Output is correct
7 Correct 15 ms 13236 KB Output is correct
8 Correct 8 ms 12236 KB Output is correct
9 Correct 50 ms 19212 KB Output is correct
10 Correct 10 ms 12236 KB Output is correct
11 Correct 10 ms 12236 KB Output is correct
12 Correct 58 ms 19564 KB Output is correct
13 Correct 64 ms 20980 KB Output is correct
14 Correct 106 ms 18240 KB Output is correct
15 Correct 114 ms 20216 KB Output is correct
16 Correct 82 ms 20960 KB Output is correct
17 Correct 123 ms 16164 KB Output is correct
18 Correct 103 ms 19476 KB Output is correct
19 Correct 448 ms 57504 KB Output is correct
20 Execution timed out 629 ms 43868 KB Time limit exceeded
21 Halted 0 ms 0 KB -