# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
940430 | Sundavar | Monster Game (JOI21_monster) | C++17 | 106 ms | 420 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> Solve(int N) {
std::vector<int> T(N);
vector<int> cnt(N);
vector<int> amb1, amb2;
for(int i = 0; i < N; i++){
for(int j = 0; j < i; j++) if(j != i)
if(Query(i,j)) cnt[i]++;
else cnt[j]++;
}
for(int i = 0; i < N; i++){
if(cnt[i] == 1) amb1.push_back(i);
if(cnt[i] == N-2) amb2.push_back(i);
}
(Query(amb1[0], amb1[1]) ? cnt[amb1[0]] : cnt[amb1[1]])--;
(Query(amb2[0], amb2[1]) ? cnt[amb2[1]] : cnt[amb2[0]])++;
for (int i = 0; i < N; i++) T[i] = cnt[i];
return T;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |