# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
781623 | Andrey | Easter Eggs (info1cup17_eastereggs) | C++14 | 17 ms | 368 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> haha[513];
vector<int> bruh(513);
vector<int> wut(0);
int br,p;
void dfs(int a, int t) {
if(p >= br/2) {
return;
}
wut.push_back(a);
if(bruh[a] == 1) {
bruh[a] = 2;
p++;
}
for(int v: haha[a]) {
if(v != t && p < br/2) {
dfs(v,a);
}
}
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
for(int i = 0; i < 513; i++) {
haha[i].clear();
}
int a,b,c;
for(int i = 0; i < n-1; i++) {
a = bridges[i].first;
b = bridges[i].second;
haha[a].push_back(b);
haha[b].push_back(a);
}
for(int i = 1; i <= n; i++) {
bruh[i] = 1;
}
br = n;
p = 0;
while(br > 1) {
wut.clear();
p = 0;
dfs(1,-1);
if(query(wut)) {
c = 2;
}
else {
c = 1;
}
br = 0;
for(int i = 1; i <= n; i++) {
if(bruh[i] != 0) {
if(bruh[i] == c) {
br++;
bruh[i] = 1;
}
else {
bruh[i] = 0;
}
}
}
}
for(int i = 1; i <= n; i++) {
if(bruh[i] == 1) {
return i;
}
}
}
컴파일 시 표준 에러 (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... |