# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987640 | ThylOne | Monster Game (JOI21_monster) | C++17 | 1 ms | 344 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 pb push_back
vector<int> solve(vector<int> id){
int pivot_pos = ((int)id.size())%((int)id.size());
vector<int> left,right;
for(int i = 0;i<id.size();i++){
if(i==pivot_pos)continue;
if(Query(id[pivot_pos],id[i])){
left.pb(id[i]);
}else{
right.pb(id[i]);
}
}
int l_back = left.back();
int r_begin = *(right.begin());
left[left.size()-1] = r_begin;
right[0] = l_back;
vector<int> ans;
for(int v:left)ans.pb(v);
ans.pb(id[pivot_pos]);
for(int v:right)ans.pb(v);
return ans;
}
std::vector<int> Solve(int N) {
std::vector<int> ans(N);
vector<int> id(N);
for(int i = 0;i<N;i++)
ans[i] = i;
return solve(id);
}
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... |