# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1142502 | SmuggingSpun | Monster Game (JOI21_monster) | C++20 | 58 ms | 408 KiB |
#include "monster.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>Solve(int n){
if(n <= 100){
vector<int>ans(n, 0);
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
ans[Query(i, j) ? i : j]++;
}
}
for(int i = 0, small = -1, large = -1; i < n; i++){
if(ans[i] == 1){
if(small == -1){
small = i;
}
else{
ans[i] = 1 ^ (ans[small] = (Query(small, i) ? 0 : 1));
}
}
else if(ans[i] == n - 2){
if(large == -1){
large = i;
}
else{
ans[i] = (n - 2) ^ (n - 1) ^ (ans[large] = (Query(large, i) ? n - 2 : n - 1));
}
}
}
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... |