# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864297 | vjudge1 | Monster Game (JOI21_monster) | C++17 | 91 ms | 1616 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 <bits/stdc++.h>
#include "monster.h"
using namespace std;
vector<int> Solve(int n)
{
int wins[n]={0};
bool outcome[n][n];
vector<int> strength(n);
for (int i=0; i<n; i++)
for (int j=i+1; j<n; j++)
{
outcome[i][j]=Query(i, j);
if (outcome[i][j]==true)
wins[i]=wins[i]+1;
else
wins[j]=wins[j]+1;
}
for (int i=0; i<n; i++)
strength[i]=wins[i];
for (int i=0; i<n; i++)
for (int j=j+1; j<n; j++)
{
if (wins[i]==n-2 && wins[j]==n-2)
{
strength[i]=n-1;
strength[j]=n-2;
if (outcome[i][j]==true)
swap(strength[i], strength[j]);
}
if (wins[i]==1 && wins[1]==1)
{
strength[i]=2;
strength[j]=1;
if (outcome[i][j]==true)
swap(strength[i], strength[j]);
}
}
return strength;
}
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... |