# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
498734 | 2021-12-26T09:22:00 Z | ahmedfouadnew | Easter Eggs (info1cup17_eastereggs) | C++17 | 27 ms | 368 KB |
#include <bits/stdc++.h> #include "grader.h" //#include "grader.cpp" #define pb push_back #define f first #define s second using namespace std; vector<int>adj[606]; int n; vector<int>vv; void dfs(int u,int p) { vv.pb(u); for(int v:adj[u]) { if(v==p) continue; dfs(v,u); vv.pb(u); } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i=0;i<=N;i++) { adj[i].clear(); } vv.clear(); n=N; for(int i=0;i<bridges.size();i++) { adj[bridges[i].f].pb(bridges[i].s); adj[bridges[i].s].pb(bridges[i].f); } dfs(1,0); reverse(vv.begin(),vv.end()); int s=0,e=vv.size()-1; while(s<e) { int mid=s+(e-s)/2; set<int>st; for(int i=s;i<=e;i++) { st.insert(vv[i]); } if(st.size()==1) return vv[s]; st.clear(); for(int ii=s;ii<=mid;ii++) st.insert(vv[ii]); vector<int>qr(st.begin(),st.end()); if(query(qr)) { e=mid; } else { s=mid+1; } } return vv[s]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 200 KB | Number of queries: 5 |
2 | Partially correct | 2 ms | 200 KB | Number of queries: 5 |
3 | Partially correct | 1 ms | 200 KB | Number of queries: 5 |
4 | Partially correct | 2 ms | 200 KB | Number of queries: 5 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 328 KB | Number of queries: 9 |
2 | Partially correct | 14 ms | 328 KB | Number of queries: 10 |
3 | Partially correct | 21 ms | 368 KB | Number of queries: 10 |
4 | Partially correct | 20 ms | 328 KB | Number of queries: 10 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 27 ms | 328 KB | Number of queries: 10 |
2 | Partially correct | 22 ms | 328 KB | Number of queries: 10 |
3 | Partially correct | 24 ms | 328 KB | Number of queries: 10 |
4 | Partially correct | 19 ms | 328 KB | Number of queries: 10 |