Submission #1088206

# Submission time Handle Problem Language Result Execution time Memory
1088206 2024-09-14T06:18:28 Z vahagng Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int N = 514;

vector<vector<int>>comps;
vector<int>comp;
vector<int>adj[N];
bool visited[N];

void dfs(int node){
    visited[node] = true;
    comp.push_back(node);
    for(auto i : adj[node]){
        if(visited[i]) continue;
        dfs(i);
    }
}

int findEgg (int n, vector < pair < int, int > > bridges)
{
    for(auto i : bridges){
        adj[i.first].push_back(i.second);
        adj[i.second].push_back(i.first);
    }
    for(int i = 1; i <= n; i++){
        if(!visited[i]){
            dfs(i);
            comps.push_back(comp);
            comp.clear();
        }
    }
    vector<int>a;
    for(auto i : comps){
        if(query(i)) {
            a = i;
            break;
        }
    }
    for(auto i : a){
        if(query({i})) return i;
    }
    return N;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -