Submission #1061046

# Submission time Handle Problem Language Result Execution time Memory
1061046 2024-08-16T05:53:24 Z thinknoexit Monster Game (JOI21_monster) C++17
0 / 100
134 ms 1464 KB
#include "monster.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
bool res[1010][1010];
vector<int> adj[1010], rev[1010];
int cnt[1010];
vector<int> Solve(int N) {
    n = N;
    for (int i = 0;i < n;i++) {
        for (int j = i + 1;j < n;j++) {
            res[i][j] = Query(i, j);
            res[j][i] = !res[i][j];
        }
    }
    for (int i = 0;i < n;i++) {
        for (int j = 0;j < n;j++) {
            if (i != j) {
                if (res[i][j]) cnt[i]++, adj[i].push_back(j);
                else rev[j].push_back(i);
            }
        }
    }
    vector<pair<int, int>> v;
    for (int i = 0;i < n;i++) v.push_back({ cnt[i], i });
    sort(v.begin(), v.end());
    // check (0, 1)
    if (adj[v[1].second][0] == v[0].second) swap(v[0], v[1]);
    // check (n-2, n-1)
    if (rev[v[n - 2].second][0] == v[n - 1].second) swap(v[n - 1], v[n - 2]);
    vector<int> ans(n);
    for (int i = 0;i < n;i++) {
        ans[v[i].second] = i;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 1464 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -