# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
540121 | rk42745417 | Monster Game (JOI21_monster) | C++17 | 184 ms | 300 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;
#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const ll LINF = ll(4e18) + ll(2e15);
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
namespace {
bool example_variable;
} // namespace
vector<int> Solve(int n) {
vector<int> cnt(n);
for(int i = 0; i < n; i++)
for(int j = i + 1; j < n; j++) {
if(Query(i, j))
cnt[i]++;
else
cnt[j]++;
}
vector<int> ans(n);
for(int i = 0; i < n; i++) {
if(cnt[i] == 1 || cnt[i] == n - 2)
continue;
ans[i] = cnt[i];
}
{
int a = -1, b;
for(int i = 0; i < n; i++) {
if(cnt[i] == 1) {
if(~a)
b = i;
else
a = i;
}
}
if(Query(a, b))
ans[a] = 0, ans[b] = 1;
else
ans[a] = 1, ans[b] = 0;
}
{
int a = -1, b;
for(int i = 0; i < n; i++) {
if(cnt[i] == n - 2) {
if(~a)
b = i;
else
a = i;
}
}
if(Query(a, b))
ans[a] = n - 2, ans[b] = n - 1;
else
ans[a] = n - 1, ans[b] = n - 2;
}
return ans;
}
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... |