Submission #598680

#TimeUsernameProblemLanguageResultExecution timeMemory
598680kingfran1907Speedrun (RMI21_speedrun)C++14
100 / 100
280 ms972 KiB
#include "speedrun.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1010; vector< int > graph[maxn]; vector< int > sol; bool bio[maxn]; int parr[maxn]; void dfs(int x, int parr) { sol.push_back(x); ::parr[x] = parr; for (int tren : graph[x]) { if (tren != parr) dfs(tren, x); } } void assignHints(int subtask, int N, int A[], int B[]) { for (int i = 1; i < N; i++) { graph[A[i]].push_back(B[i]); graph[B[i]].push_back(A[i]); } dfs(1, 0); setHintLen(20); for (int i = 0; i < sol.size(); i++) { int tren = sol[i]; int r = sol[(i + 1) % sol.size()]; int par = parr[tren]; for (int i = 0; i < 10; i++) setHint(tren, i + 1, r & (1 << i)); for (int i = 0; i < 10; i++) setHint(tren, i + 11, par & (1 << i)); } } void speedrun(int subtask, int N, int start) { memset(bio, false, sizeof bio); bio[start] = true; for (int t = 1; t < N; t++) { int nex = 0; for (int i = 0; i < 10; i++) nex |= getHint(i + 1) << i; while (!goTo(nex)) { int parr = 0; for (int i = 0; i < 10; i++) parr |= (getHint(i + 11) << i); assert(goTo(parr)); start = parr; } start = nex; } }

Compilation message (stderr)

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for (int i = 0; i < sol.size(); i++) {
      |                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...