Submission #528768

#TimeUsernameProblemLanguageResultExecution timeMemory
528768c28dnv9q3Monster Game (JOI21_monster)C++17
10 / 100
237 ms264 KiB
#include "monster.h" #include <vector> #include <cstdio> #include <cstdlib> using namespace std; vector<int> Solve(int N) { vector<int> v(N); //bool b = Query(0, 1); //for (int i = 0; i < N; i++) // v[i] = i; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { if (Query(i, j)) v[i] = v[i] + 1; else v[j] = v[j] + 1; } } int low = -1; for (int i = 0; i < N; i++) { if (v[i] == 1) { if (low < 0) { low = i; } else { if (Query(low, i)) v[low] = 0; else v[i] = 0; break; } } } int high = -1; for (int i = 0; i < N; i++) { if (v[i] == N - 2) { if (high < 0) { high = i; } else { if (Query(i, high)) v[high] = N - 1; else v[i] = N - 1; break; } } } /*for (int i = 0; i < N; i++) printf("%d ", v[i]); printf("\n");*/ return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...