Submission #1061050

# Submission time Handle Problem Language Result Execution time Memory
1061050 2024-08-16T05:59:03 Z thinknoexit Monster Game (JOI21_monster) C++17
10 / 100
146 ms 1412 KB
#include "monster.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
bool res[1010][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) cnt[i] += res[i][j];
        }
    }
    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 (res[v[1].second][v[0].second]) swap(v[0], v[1]);
    // check (n-2, n-1)
    if (res[v[n - 1].second][v[n - 2].second]) swap(v[n - 1], v[n - 2]);
    if (!(n & 1)) {
        // check(n/2 - 1, n/2)
        if (res[v[n / 2].second][v[n / 2 - 1].second]) swap(v[n / 2], v[n / 2 - 1]);
    }
    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 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 95 ms 848 KB Output is correct
17 Correct 106 ms 616 KB Output is correct
18 Correct 97 ms 616 KB Output is correct
19 Correct 101 ms 624 KB Output is correct
20 Correct 123 ms 844 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 110 ms 616 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 108 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 95 ms 848 KB Output is correct
17 Correct 106 ms 616 KB Output is correct
18 Correct 97 ms 616 KB Output is correct
19 Correct 101 ms 624 KB Output is correct
20 Correct 123 ms 844 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 110 ms 616 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 108 ms 620 KB Output is correct
33 Incorrect 146 ms 1400 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 1412 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -