# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
141359 | 2019-08-07T14:02:17 Z | Ruxandra985 | Easter Eggs (info1cup17_eastereggs) | C++14 | 20 ms | 380 KB |
#include <cstdio> #include <vector> #include <algorithm> #include "grader.h" using namespace std; vector <int> w[600]; vector <int> eul,isl; int poz; void euler (int nod ,int tata){ int vecin; eul.push_back(nod); for (int i = 0 ; i < w[nod].size() ; i++){ vecin = w[nod][i]; if (vecin!=tata){ euler (vecin,nod); } } } int findEgg (int n , vector <pair <int,int> > v){ int st,dr,mid,sol,x,y; for (int i=1;i<=n;i++) w[i].clear(); for (int i=0;i<v.size();i++){ x = v[i].first; y = v[i].second; w[x].push_back(y); w[y].push_back(x); } eul.clear(); euler(1,0); /// eul e un vector cu parc euler , dim 2*n st = 0; dr = eul.size()-1; while (st<dr){ mid = (st + dr)/2; /// iei de la st la mid isl.clear(); for (int i=0;i<=mid;i++) isl.push_back(eul[i]); sol = query(isl); if (sol == 0) st = mid + 1; else dr = mid; } return eul[st]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Number of queries: 4 |
2 | Correct | 3 ms | 248 KB | Number of queries: 4 |
3 | Correct | 3 ms | 248 KB | Number of queries: 4 |
4 | Correct | 3 ms | 380 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 376 KB | Number of queries: 8 |
2 | Correct | 15 ms | 248 KB | Number of queries: 9 |
3 | Correct | 20 ms | 248 KB | Number of queries: 9 |
4 | Correct | 19 ms | 376 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 372 KB | Number of queries: 9 |
2 | Correct | 17 ms | 376 KB | Number of queries: 9 |
3 | Correct | 20 ms | 376 KB | Number of queries: 9 |
4 | Correct | 15 ms | 248 KB | Number of queries: 9 |