Submission #864205

# Submission time Handle Problem Language Result Execution time Memory
864205 2023-10-22T08:47:40 Z vjudge1 Monster Game (JOI21_monster) C++17
10 / 100
116 ms 684 KB
#include <bits/stdc++.h>
#include "monster.h"
using namespace std;
vector<int> Solve(int n)
{
    vector<vector<bool> > w(n);
    vector<int> s(n, 0), an(n), eo, enm;
    int i, j;
    for (i = 0; i < n; i++)
    {
        w[i].resize(n);
        for (j = 0; j < n; j++)
        {
            if (j > i)
                w[i][j] = Query(i, j);
            else if (j == i)
                w[i][j] = 0;
            else
                w[i][j] = !w[j][i];
            if (w[i][j])
                s[i]++;
        }
    }
    for (i = 0; i < n; i++)
    {
        if (s[i] == 1)
            eo.push_back(i);
        else if (s[i] == n - 2)
            enm.push_back(i);
        else if (s[i] != 1 && s[i] != n - 2)
            an[i] = s[i];
    }
    if (w[eo[0]][eo[1]])
    {
        an[eo[0]] = 0;
        an[eo[1]] = 1;
    }
    else
    {
        an[eo[0]] = 1;
        an[eo[1]] = 0;
    }
    if (w[enm[0]][enm[1]])
    {
        an[enm[0]] = n - 2;
        an[enm[1]] = n - 1;
    }
    else
    {
        an[enm[0]] = n - 1;
        an[enm[1]] = n - 2;
    }
    return an;
}
# 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 340 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 1 ms 344 KB Output is correct
16 Correct 79 ms 440 KB Output is correct
17 Correct 82 ms 440 KB Output is correct
18 Correct 94 ms 672 KB Output is correct
19 Correct 80 ms 600 KB Output is correct
20 Correct 89 ms 436 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 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 81 ms 680 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 82 ms 684 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 340 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 1 ms 344 KB Output is correct
16 Correct 79 ms 440 KB Output is correct
17 Correct 82 ms 440 KB Output is correct
18 Correct 94 ms 672 KB Output is correct
19 Correct 80 ms 600 KB Output is correct
20 Correct 89 ms 436 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 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 81 ms 680 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 82 ms 684 KB Output is correct
33 Incorrect 116 ms 456 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 464 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -