Submission #772148

#TimeUsernameProblemLanguageResultExecution timeMemory
772148Dan4LifeCluedo (IOI10_cluedo)C++17
100 / 100
12 ms280 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...