# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681942 | 2023-01-14T23:13:33 Z | Mher777 | Easter Eggs (info1cup17_eastereggs) | C++17 | 2 ms | 592 KB |
#include <iostream> #include <iomanip> #include <array> #include <string> #include <algorithm> #include <cmath> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <vector> #include <stack> #include <queue> #include <deque> #include <bitset> #include <list> #include <iterator> #include <numeric> #include <complex> #include <utility> #include <random> #include <fstream> #include "grader.h" using namespace std; const int N = 600; vector<int> g[N]; vector<int> a; vector<bool> used(N); void dfs(int u) { used[u] = 1; for (int i = 0; i < g[u].size(); i++) { if (!used[g[u][i]]) { used[g[u][i]] = true; a.push_back(g[u][i]); dfs(g[u][i]); } } } int findEgg (int n, vector<pair<int,int>> b) { for (int i = 0; i < b.size(); i++) { if (b[i].second < b[i].first) swap(b[i].first, b[i].second); g[b[i].first].push_back(b[i].second); } for (int i = 1; i <= n; i++) { if (!used[i]) { vector<int> v1; a.clear(); a.push_back(i); dfs(i); if (query(a) == -1) continue; int l = 0, r = a.size() - 1, mid = (l + r) / 2; while (l <= r) { mid = (l + r) / 2; for (int i = 0; i <= mid; i++) { v1.push_back(a[i]); } if (query(v1) == 1) { a = v1; if (r - l + 1 == 1) { return v1[l]; } r = mid; } else { l = mid + 1; r = (l + a.size() - 1) / 2; } v1.clear(); } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 592 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 464 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |