# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
759727 | jay_jayjay | Easter Eggs (info1cup17_eastereggs) | C++14 | 30 ms | 360 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// {{{1
extern "C" int __lsan_is_turned_off() { return 1; }
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <iostream>
#include <deque>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3f
#ifdef DEBUG
#define dprintf(args...) fprintf(stderr,args)
#include <assert.h>
#endif
#ifndef DEBUG
#define dprintf(args...) 69
#define assert(args...) 42
#endif
// 1}}}
// pain im still so stupid
int query(vector<int> islands);
int findEgg(int n, vector<pair<int,int>> edges) {
for(auto&[a,b]:edges)a--,b--;
vector<vector<int>> adj(n);
for(auto [a,b]:edges) adj[a].push_back(b),adj[b].push_back(a);
vector<int> po;
auto dfs = [&](auto& self, int u, int p=-1) -> void {
po.push_back(u);
for(auto v:adj[u])if(v!=p)self(self,v,u);
};
dfs(dfs,0,0);
vector<int> q;
int l=0,r=n-1;
while(l<r) {
int m=l+(r-l)/2;
//printf("%d %d %d\n",l,m,r);
q.clear();
for(int i=0;i<=m;i++)
q.push_back(1+po[i])
//,printf("%d ",po[i])
;
//printf("\n");
int x=query(q);
if(x) r=m;
else l=m+1;
}
return ++po[l];
}
#undef DEBUG
#ifdef DEBUG
int main()
{
}
#endif
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |