# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
918112 | 2024-01-29T13:10:16 Z | raul2008487 | Easter Eggs (info1cup17_eastereggs) | C++17 | 29 ms | 5960 KB |
#include <bits/stdc++.h> #include "grader.h" #define ll int #define vl vector<ll> #define fi first #define se second #define pb push_back using namespace std; const int sz = 2e5+5; vl adj[sz]; vl et; void dfs(ll node, ll p){ et.pb(node); for(auto edge: adj[node]){ if(edge == p){continue;} dfs(edge, node); } } int findEgg (int N, vector < pair < int, int > > bridges) { ll i, j; for(i=0;i<sz;i++){ adj[i].clear(); } et.clear(); et.pb(-1); for(i=0;i<bridges.size();i++){ adj[bridges[i].fi].push_back(bridges[i].se); adj[bridges[i].se].push_back(bridges[i].fi); } dfs(1, 0); ll lo = 1, hi = N, mid, best = 0; while(lo <= hi){ mid = (lo + hi) >> 1; vl t; for(i = 1; i<=mid; i++){ t.pb(et[i]); } if(query(t)){ best = et[mid]; hi = mid - 1; } else{ lo = mid + 1; } } return best; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 5 ms | 4952 KB | Number of queries: 5 |
2 | Partially correct | 4 ms | 4952 KB | Number of queries: 5 |
3 | Partially correct | 4 ms | 4952 KB | Number of queries: 5 |
4 | Partially correct | 4 ms | 4952 KB | Number of queries: 5 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 5468 KB | Number of queries: 9 |
2 | Correct | 14 ms | 5672 KB | Number of queries: 9 |
3 | Correct | 20 ms | 5420 KB | Number of queries: 9 |
4 | Correct | 20 ms | 5436 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 20 ms | 5960 KB | Number of queries: 10 |
2 | Correct | 21 ms | 5932 KB | Number of queries: 9 |
3 | Partially correct | 21 ms | 5424 KB | Number of queries: 10 |
4 | Partially correct | 29 ms | 5424 KB | Number of queries: 10 |