# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
756313 | 2023-06-11T13:33:49 Z | anaduguleanu | Easter Eggs (info1cup17_eastereggs) | C++14 | 16 ms | 364 KB |
#include <bits/stdc++.h> #include "grader.h" #define MAX 512 using namespace std; vector <int> graph[MAX + 10]; vector <int> nodes; void dfs(int node, int parent) { nodes.push_back(node); for (auto next : graph[node]) if (next != parent) dfs(next, node); } int check(int pos) { vector <int> nodesQuery; for (int i = 1; i <= pos; i++) nodesQuery.push_back(nodes[i]); return query(nodesQuery); } int findEgg (int N, vector <pair <int, int>> bridges) { for (int i = 1; i <= N; i++) graph[i].clear(); nodes.clear(); for (auto it : bridges) { graph[it.first].push_back(it.second); graph[it.second].push_back(it.first); } nodes.push_back(0); dfs(1, -1); int left = 1; int right = nodes.size() - 1; int ans; while (left <= right) { int mid = (left + right) / 2; if (check(mid) == 1) { right = mid - 1; ans = mid; } else left = mid + 1; } return nodes[ans]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
2 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
3 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
4 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 344 KB | Number of queries: 9 |
2 | Correct | 10 ms | 348 KB | Number of queries: 9 |
3 | Correct | 16 ms | 336 KB | Number of queries: 9 |
4 | Correct | 12 ms | 344 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 16 ms | 364 KB | Number of queries: 10 |
2 | Correct | 13 ms | 352 KB | Number of queries: 9 |
3 | Partially correct | 14 ms | 352 KB | Number of queries: 10 |
4 | Partially correct | 14 ms | 340 KB | Number of queries: 10 |