Submission #1064806

# Submission time Handle Problem Language Result Execution time Memory
1064806 2024-08-18T17:58:28 Z sunboi Make them Meet (EGOI24_makethemmeet) C++17
10 / 100
1 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
vector<vector<int>> g;
vector<int> vis, depth;
 
void dfs(int v, int par){
    vis[v] = 1;
    if (par != -1) depth[v] = depth[par] + 1;
    
    for (int u : g[v]){
        if (u != par && vis[u] == 0){
            dfs(u, v);
        }
    }
}
 
 signed main(){
    int n, m; cin >> n >> m;
    
    g.clear();
    g.resize(n + 1);
    vis.clear();
    vis.resize(n + 1);
    depth.clear();
    depth.resize(n + 1);
    for (int i = 0; i < m; i++){
        int a, b; cin >> a >> b;
        
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int root = 0;
    /*for (int i = 0; i < n; i++){
        if ((long long)(g[i].size()) == 1) {
            root = i;
            break;
        }
    }*/
    depth[root] = 0;
    dfs(root, -1);
    
    cout << 3*10 << endl;
    for (int k = 0; k < 10; k++){
        for (int i = 0; i < n; i++){
        cout << depth[i] / 2 << ' ';
        }
        cout << endl;
      
        for (int i = 0; i < n; i++){
            cout << (depth[i] + 1) / 2 << ' ';
        }
        cout << endl;
        bool f = 0;
        for (int i = 0; i < n; i++){
            if (depth[i] == 0) {
                cout << n << ' ';
                continue;
            }
            if (depth[i] == 1 && !f){
                cout << n << ' ';
                f = 1;
                continue;
            }
            cout << i << ' ';
        }
        cout << endl;
    }
    
    return 0;
    
    
    
    
    
    
 }
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 376 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 344 KB If people start at 2 and 12, then they can avoid each other
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB If people start at 0 and 2, then they can avoid each other
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 376 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB If people start at 0 and 2, then they can avoid each other
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 376 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 0 ms 344 KB If people start at 2 and 12, then they can avoid each other
11 Halted 0 ms 0 KB -