Submission #149237

#TimeUsernameProblemLanguageResultExecution timeMemory
149237お前はもう死んでいる (#200)Bulb Game (FXCUP4_bulb)C++17
0 / 100
2 ms376 KiB
#include "bulb.h" using namespace std; int dive(int u, vector<int> &l) { while (u >= 0) u = l[u]; return u == -1; } int FindWinner(int t, vector<int> l, vector<int> r) { int n = l.size(); if (!dive(0, l)) return 0; for (int u = 0; u >= 0; u = l[u]) if (!dive(r[u], l)) { bool ok1 = true, ok2 = true; swap(l[u], r[u]); for (int v = 0; v >= 0; v = l[v]) if (!dive(r[v], l)) { ok1 = false; break; } swap(l[u], r[u]); if (r[u] >= 0) { swap(l[r[u]], r[r[u]]); for (int v = 0; v >= 0; v = l[v]) if (!dive(r[v], l)) { ok2 = false; break; } swap(l[r[u]], r[r[u]]); } else ok2 = false; return ok1 || ok2; } return 1; }

Compilation message (stderr)

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:13:6: warning: unused variable 'n' [-Wunused-variable]
  int n = l.size();
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...