Submission #827063

#TimeUsernameProblemLanguageResultExecution timeMemory
827063Mohammed_AtalahMonster Game (JOI21_monster)C++17
10 / 100
163 ms292 KiB
#include "monster.h" #include <bits/stdc++.h> using namespace std; namespace { bool example_variable; } // namespace std::vector<int> Solve(int N) { std::vector<int> T(N); vector<int> win(N); vector<int> order(N); vector<int> could_be_first; vector<int> could_be_last; for (int i = 0 ; i < N ; i ++) { for (int j = i + 1; j < N; j ++) { if (i == j) continue; if (Query(i, j)) { win[i]++; } else { win[j]++; } } // cout << i << " " << win << endl; if (win[i] != 1 && win[i] != N - 2) { order[win[i]] = i; } else if (win[i] == 1) { could_be_first.push_back(i); } else { could_be_last.push_back(i); } } if (N == 4) { if (Query(could_be_first[0], could_be_last[0])) { order[0] = could_be_first[1]; order[1] = could_be_first[0]; order[2] = could_be_last[0]; order[3] = could_be_last[1]; } else if (Query(could_be_first[0], could_be_last[1])) { order[0] = could_be_first[1]; order[1] = could_be_first[0]; order[2] = could_be_last[1]; order[3] = could_be_last[0]; } else if (Query(could_be_first[1], could_be_last[0])) { order[0] = could_be_first[0]; order[1] = could_be_first[1]; order[2] = could_be_last[0]; order[3] = could_be_last[1]; } else if (Query(could_be_first[1], could_be_last[1])) { order[0] = could_be_first[0]; order[1] = could_be_first[1]; order[2] = could_be_last[1]; order[3] = could_be_last[0]; } } else { if (Query(could_be_first[0], order[2])) { order[1] = could_be_first[0]; order[0] = could_be_first[1]; } else { order[1] = could_be_first[1]; order[0] = could_be_first[0]; } if (Query(order[N - 3], could_be_last[0])) { order[N - 2] = could_be_last[0]; order[N - 1] = could_be_last[1]; } else { order[N - 2] = could_be_last[1]; order[N - 1] = could_be_last[0]; } } for (int i = 0; i < N ; i ++) { T[order[i]] = i; } return T; }

Compilation message (stderr)

monster.cpp:6:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
    6 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...