Submission #1060869

# Submission time Handle Problem Language Result Execution time Memory
1060869 2024-08-16T03:45:45 Z 12345678 Monster Game (JOI21_monster) C++17
10 / 100
107 ms 856 KB
#include "monster.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=205;

int n, dp[nx][nx], cnt[nx];

std::vector<int> Solve(int N) {
    n=N;
    for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) dp[i][j]=Query(i, j), dp[j][i]=!dp[i][j], cnt[i]+=dp[i][j], cnt[j]+=dp[j][i];
    vector<pair<int ,int>> v;
    for (int i=0; i<n; i++) v.push_back({cnt[i], i});
    sort(v.begin(), v.end());
    vector<int> res(n), ans(n);
    for (int i=0; i<n; i++) res[i]=v[i].second;
    if (!dp[res[0]][res[1]]) swap(res[0], res[1]);
    if (!dp[res[n-2]][res[n-1]]) swap(res[n-2], res[n-1]);
    for (int i=0; i<n; i++) ans[res[i]]=i;
    /*
    cout<<"res ";
    for (auto x:res) cout<<x<<' ';
    cout<<'\n';
    cout<<"ans ";
    for (auto x:ans) cout<<x<<' ';
    cout<<'\n';
    */
    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 Correct 0 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 1 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 86 ms 576 KB Output is correct
17 Correct 76 ms 580 KB Output is correct
18 Correct 86 ms 600 KB Output is correct
19 Correct 107 ms 596 KB Output is correct
20 Correct 104 ms 600 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 91 ms 600 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 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 105 ms 600 KB Output is correct
# 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 Correct 0 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 1 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 86 ms 576 KB Output is correct
17 Correct 76 ms 580 KB Output is correct
18 Correct 86 ms 600 KB Output is correct
19 Correct 107 ms 596 KB Output is correct
20 Correct 104 ms 600 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 91 ms 600 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 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 105 ms 600 KB Output is correct
33 Incorrect 1 ms 600 KB Wrong Answer [1]
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -