Submission #609251

# Submission time Handle Problem Language Result Execution time Memory
609251 2022-07-27T13:02:01 Z DeMen100ns Monster Game (JOI21_monster) C++17
0 / 100
1 ms 208 KB
/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/

#include <monster.h>
#include <bits/stdc++.h>
using namespace std;

namespace {

};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int randint(int l, int r){
    return uniform_int_distribution<int>(l, r)(rng);
}

int check(int id, int n){
    int ct = 0;
    for(int i = 0; i < n; ++i){
        if (id == i) continue;
        ct += Query(id, i);
    }
    return ct;
}

std::vector<int> Solve(int n)
{
    std::vector<int> v, ans(n), p(n);

    for(int i = 0; i < n; ++i) p.push_back(i);
    shuffle(p.begin(), p.end(), rng);

    v.push_back(p[0]);

    for(int i = 1; i < n; ++i){
        int l = -1, r = v.size();
        if (l + 1 < r){
            int mid = (l + r) >> 1;
            if (Query(p[i], v[mid])){
                l = mid;
            } else r = mid;
        }
        v.insert(v.begin() + r, p[i]);
    }
    int ct = 0;
    for(int i = 0; i < n; ++i){
        if (check(v[i], n) == 1){
            swap(v[ct], v[i]);
            ++ct;
        }
        if (ct == 2) break;
    }
    if (!Query(v[0], v[1])) swap(v[0], v[1]);
    for(int i = 1; i < n - 1; ++i){
        for(int j = i + 1; j < n; ++j){
            if (Query(v[i], v[j])){
                swap(v[i + 1], v[j]);
                break;
            }
        }
    }

    for(int i = 0; i < n; ++i){
        ans[v[i]] = i;
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -