Submission #1064835

# Submission time Handle Problem Language Result Execution time Memory
1064835 2024-08-18T18:21:10 Z sunboi Make them Meet (EGOI24_makethemmeet) C++17
3.20457 / 100
120 ms 5972 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 << 2*10000 << endl;
    for (int k = 0; k < 10000; k++){
        for (int i = 0; i < n; i++){
        cout << depth[i] / 2 << ' ';
        }
        cout << endl;
      
        for (int i = 0; i < n; i++){
            if (depth[i] == 0) cout << 1 << ' ';
            else cout << (depth[i] + 1) / 2 << ' ';
        }
        cout << endl;
        
    }
    
    return 0;
    
    
    
    
    
    
 }
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 344 KB Partially correct
2 Incorrect 21 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 348 KB Partially correct
2 Incorrect 22 ms 344 KB If people start at 0 and 2, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 28 ms 344 KB Partially correct
2 Partially correct 23 ms 348 KB Partially correct
3 Partially correct 23 ms 604 KB Partially correct
4 Partially correct 72 ms 2900 KB Partially correct
5 Partially correct 120 ms 5972 KB Partially correct
6 Partially correct 116 ms 5932 KB Partially correct
7 Partially correct 83 ms 3664 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 344 KB Partially correct
2 Incorrect 21 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 344 KB Partially correct
2 Incorrect 21 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -