Submission #916362

#TimeUsernameProblemLanguageResultExecution timeMemory
916362andrei_iorgulescuEaster Eggs (info1cup17_eastereggs)C++14
100 / 100
17 ms1004 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; int n; bool pot[1000]; vector<int>g[1000]; int nrk,cate; vector<int>noduri; bool viz[1000]; bool innoduri[1000]; void dfs(int nod) { viz[nod] = true; if (nrk == cate / 2) return; noduri.push_back(nod); if (pot[nod] == true) nrk++; for (auto vecin : g[nod]) if (!viz[vecin]) dfs(vecin); } int findEgg (int N, vector<pair<int,int>>bridges) { n = N; for (int i = 1; i <= n; i++) g[i].clear(); for (int i = 1; i <= n; i++) pot[i] = true; for (auto it : bridges) { g[it.first].push_back(it.second); g[it.second].push_back(it.first); } cate = n; while (cate > 1) { for (int i = 1; i <= n; i++) viz[i] = false; nrk = 0; noduri.clear(); dfs(1); int x = query(noduri); for (int i = 1; i <= n; i++) innoduri[i] = false; for (auto it : noduri) innoduri[it] = true; if (x == 1) { for (int i = 1; i <= n; i++) if (innoduri[i] == false) pot[i] = false; } else { for (int i = 1; i <= n; i++) if (innoduri[i] == true) pot[i] = false; } cate = 0; for (int i = 1; i <= n; i++) if (pot[i] == true) cate++; } for (int i = 1; i <= n; i++) if (pot[i] == true) return i; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:72:1: warning: control reaches end of non-void function [-Wreturn-type]
   72 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...