Submission #151240

#TimeUsernameProblemLanguageResultExecution timeMemory
151240jun6873Lokahian Relics (FXCUP4_lokahia)C++17
0 / 100
3 ms636 KiB
#include "lokahia.h" #include <bits/stdc++.h> using namespace std; int FindBase(int N) { srand(20001021); vector<int> ans; for (int i=0; i<N; i++) ans.push_back(i); int k; while (ans.size() > 1) { vector<int> nans; if (ans.size() % 2) nans.push_back(ans.back()); for (int i=0; i+1<ans.size(); i+=2) { if (ans[i] == ans[i+1]) nans.push_back(ans[i]); else if ((k = CollectRelics(ans[i], ans[i+1])) != -1) nans.push_back(k); } ans = nans; } if (ans.empty()) return -1; int cand = ans[0]; int cnt = 1; for (int i=0; i<N; i++) if (i != cand) cnt += (CollectRelics(cand, i) != -1); if (cnt > N/2) return cand; return -1; }

Compilation message (stderr)

lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:16:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i+1<ans.size(); i+=2) {
                       ~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...