# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
514775 | amukkalir | Easter Eggs (info1cup17_eastereggs) | C++17 | 26 ms | 356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//in repentance and rest is your strenght, in quietness and trust is your salvation
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define pb push_back
const int nax = 512;
vector<int> adj[nax+5];
int f[nax+5];
bool vis[nax+5];
int cr = 1;
void bfs() {
queue<int> q;
q.push(1);
while(!q.empty()) {
int u = q.front(); q.pop();
vis[u] = true;
f[cr++] = u;
for(int v : adj[u]) {
if(!vis[v]) q.push(v);
}
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
if(N == 0) return 0;
for(int i=1; i<=N; i++) {
adj[i].clear();
f[i] = 0;
vis[i] = false;
}
cr = 1;
for(int i=0; i<bridges.size(); i++) {
int u = bridges[i].first;
int v = bridges[i].second;
adj[u].pb(v);
adj[v].pb(u);
}
bfs();
int ans = 0;
int lo = 1, hi = N;
while(lo <= hi) {
if(ans == 0 && lo == hi) {
ans = f[lo];
break;
}
int mid = (lo+hi)/2;
vector<int> vec;
for(int i=1; i<=mid; i++) vec.pb(f[i]);
if(query(vec)) {
ans = f[mid];
hi = mid-1;
} else {
lo = mid+1;
}
}
return ans;
}
컴파일 시 표준 에러 (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... |