Submission #420017

# Submission time Handle Problem Language Result Execution time Memory
420017 2021-06-07T22:40:54 Z vkgainz Monster Game (JOI21_monster) C++17
10 / 100
232 ms 288 KB
#include <bits/stdc++.h>
#include <monster.h>
using namespace std;

bool Query(int a, int b);

std::vector<int> Solve(int N) {
    vector<int> T(N);
    if(N == 1) return T;
    vector<int> win(N);
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            if(Query(i, j)) ++win[i];
            else ++win[j];
        }
    }
    for(int i = 0; i < N; i++) {
        if(win[i] < N - 2 && win[i] > 1)
            T[i] = win[i];
    }
    if(N == 2) {
        for(int i = 0; i < N; i++)
            T[i] = 1 - win[i];
        return T;
    }
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            if(win[i] == 1 && win[j] == 1) {
                if(Query(i, j)) 
                    T[i] = 0, T[j] = 1;
                else 
                    T[i] = 1, T[j] = 0;
            }
        }
    }
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            if(win[i] == N - 2 && win[j] == N - 2)
                if(Query(i, j))
                    T[i] = N - 2, T[j] = N - 1;
                else
                    T[i] = N - 1, T[j] = N - 2;
        }
    }
    return T;
}

Compilation message

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:38:15: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   38 |             if(win[i] == N - 2 && win[j] == N - 2)
      |               ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 200 KB Output is correct
15 Correct 1 ms 200 KB Output is correct
16 Correct 168 ms 200 KB Output is correct
17 Correct 149 ms 200 KB Output is correct
18 Correct 183 ms 200 KB Output is correct
19 Correct 154 ms 200 KB Output is correct
20 Correct 216 ms 200 KB Output is correct
21 Correct 0 ms 200 KB Output is correct
22 Correct 1 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 197 ms 200 KB Output is correct
27 Correct 1 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 1 ms 200 KB Output is correct
30 Correct 2 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 203 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 200 KB Output is correct
15 Correct 1 ms 200 KB Output is correct
16 Correct 168 ms 200 KB Output is correct
17 Correct 149 ms 200 KB Output is correct
18 Correct 183 ms 200 KB Output is correct
19 Correct 154 ms 200 KB Output is correct
20 Correct 216 ms 200 KB Output is correct
21 Correct 0 ms 200 KB Output is correct
22 Correct 1 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 197 ms 200 KB Output is correct
27 Correct 1 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 1 ms 200 KB Output is correct
30 Correct 2 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 203 ms 200 KB Output is correct
33 Incorrect 221 ms 288 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 232 ms 284 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -