# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1070964 | 2024-08-22T21:59:50 Z | raduv | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> const int MAXN = 512; using namespace std; vector<int> adj[MAXN + 1]; vector<int> islands; bitset <MAXN + 1> frecv; void dfs(int node){ frecv[node] = 1; islands.push_back(node); for(auto n : adj[node] ){ if(!frecv[n]) dfs(n); } } int findEgg(int n, vector<pair<int, int>> bridges){ int i, st, dr, mij; frecv.reset(); for( i = 0; i <= MAXN; i++ ) adj[i].clear(); islands.clear(); for( auto [u, v] : bridges ){ adj[u].push_back(v); adj[v].push_back(u); } st = 0; dr = n; while(dr - st > 1){ mij = (dr + st) / 2; vector <int> qry; for( i = 0; i < mij; i++ ){ qry.push_back(islands[i]); } if(query(qry)) dr = mij; else st = mij; } return st; }