Submission #772148

# Submission time Handle Problem Language Result Execution time Memory
772148 2023-07-03T17:08:01 Z Dan4Life Cluedo (IOI10_cluedo) C++17
100 / 100
12 ms 280 KB
#include "cluedo.h"
#include "grader.h"
void Solve() {
    int possibleMurderers[] = {1, 2, 3, 4, 5, 6};
    int possibleLocations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    int possibleWeapons[] = {1, 2, 3, 4, 5, 6};

    int guessMurderer, guessLocation, guessWeapon;
    int result;

    for (int i = 0; i < 20; i++) {
        guessMurderer = possibleMurderers[0];
        guessLocation = possibleLocations[0];
        guessWeapon = possibleWeapons[0];

        result = Theory(guessMurderer, guessLocation, guessWeapon);

        if (result == 0) {
            return;
        } else if (result == 1) {
            // Eliminate the incorrect murderer
            possibleMurderers[0] = possibleMurderers[1];
            possibleMurderers[1] = possibleMurderers[2];
            possibleMurderers[2] = possibleMurderers[3];
            possibleMurderers[3] = possibleMurderers[4];
            possibleMurderers[4] = possibleMurderers[5];
        } else if (result == 2) {
            // Eliminate the incorrect location
            possibleLocations[0] = possibleLocations[1];
            possibleLocations[1] = possibleLocations[2];
            possibleLocations[2] = possibleLocations[3];
            possibleLocations[3] = possibleLocations[4];
            possibleLocations[4] = possibleLocations[5];
            possibleLocations[5] = possibleLocations[6];
            possibleLocations[6] = possibleLocations[7];
            possibleLocations[7] = possibleLocations[8];
            possibleLocations[8] = possibleLocations[9];
            possibleLocations[9] = possibleLocations[10];
        } else if (result == 3) {
            // Eliminate the incorrect weapon
            possibleWeapons[0] = possibleWeapons[1];
            possibleWeapons[1] = possibleWeapons[2];
            possibleWeapons[2] = possibleWeapons[3];
            possibleWeapons[3] = possibleWeapons[4];
            possibleWeapons[4] = possibleWeapons[5];
        }
    }
}

Compilation message

cluedo.cpp: In function 'void Solve()':
cluedo.cpp:38:56: warning: array subscript 10 is above array bounds of 'int [10]' [-Warray-bounds]
   38 |             possibleLocations[9] = possibleLocations[10];
      |                                    ~~~~~~~~~~~~~~~~~~~~^
cluedo.cpp:5:9: note: while referencing 'possibleLocations'
    5 |     int possibleLocations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
      |         ^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
8 Correct 11 ms 208 KB Output is correct
9 Correct 10 ms 208 KB Output is correct
10 Correct 8 ms 208 KB Output is correct
11 Correct 7 ms 208 KB Output is correct
12 Correct 7 ms 208 KB Output is correct
13 Correct 7 ms 208 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 8 ms 208 KB Output is correct
16 Correct 7 ms 208 KB Output is correct
17 Correct 12 ms 224 KB Output is correct
18 Correct 10 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 224 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 11 ms 208 KB Output is correct
7 Correct 4 ms 280 KB Output is correct
8 Correct 10 ms 208 KB Output is correct
9 Correct 7 ms 208 KB Output is correct
10 Correct 11 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 10 ms 208 KB Output is correct
13 Correct 12 ms 208 KB Output is correct
14 Correct 6 ms 208 KB Output is correct
15 Correct 12 ms 208 KB Output is correct
16 Correct 12 ms 208 KB Output is correct
17 Correct 11 ms 208 KB Output is correct
18 Correct 4 ms 208 KB Output is correct