Submission #583284

# Submission time Handle Problem Language Result Execution time Memory
583284 2022-06-25T07:50:23 Z rxlfd314 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 464 KB
// https://oj.uz/problem/view/info1cup17_eastereggs
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> adj[512], bruh;
void dfs(int f = 0, int pf = -1) {
        bruh.push_back(f);
        for (int nf : adj[f]) {
                if (nf != pf) {
                        dfs(nf, f);
                }
        }
}
int findEgg(int n, vector<pair<int, int>> bridges) {
        for (int i = 0; i < n; adj[i++].clear());
        for (pair<int, int> i : bridges) {
                adj[i.second - 1].push_back(i.first - 1);
                adj[i.first - 1].push_back(i.second - 1);
        }
        bruh.clear();
        dfs();
        int lo = 0, hi = n - 1;
        while (lo <= hi) {
                int mid = lo + hi >> 1;
                if (query(vector<int>(bruh.begin(), bruh.begin() + mid))) {
                        hi = mid - 1;
                } else {
                        lo = mid + 1;
                }
        }
        return bruh[hi + 1] + 1;
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:24:30: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |                 int mid = lo + hi >> 1;
      |                           ~~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -