Submission #1053761

#TimeUsernameProblemLanguageResultExecution timeMemory
1053761BraulinhoCluedo (IOI10_cluedo)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <set>
#include <cstdlib> // For rand()

// Stub implementation of Theory function
// Replace this with the actual Theory function when available
int Theory(int murderer, int location, int weapon) {
    const int correct_murderer = 2;
    const int correct_location = 3;
    const int correct_weapon = 4;
    
    if (murderer == correct_murderer && location == correct_location && weapon == correct_weapon) {
        return 0;
    }
    
    if (murderer != correct_murderer) return 1;
    if (location != correct_location) return 2;
    if (weapon != correct_weapon) return 3;
    
    return -1;
}

void Solve() {
    std::set<int> possible_murderers = {1, 2, 3, 4, 5, 6};
    std::set<int> possible_locations = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    std::set<int> possible_weapons = {1, 2, 3, 4, 5, 6};

    while (true) {
        for (int murderer : possible_murderers) {
            for (int location : possible_locations) {
                for (int weapon : possible_weapons) {
                    int result = Theory(murderer, location, weapon);
                    if (result == 0) {
                        std::cout << "Correct combination found: " 
                                  << "Murderer " << murderer << ", "
                                  << "Location " << location << ", "
                                  << "Weapon " << weapon << std::endl;
                        return;
                    } else if (result == 1) {
                        possible_murderers.erase(murderer);
                    } else if (result == 2) {
                        possible_locations.erase(location);
                    } else if (result == 3) {
                        possible_weapons.erase(weapon);
                    }
                }
            }
        }
        
        if (possible_murderers.empty() || possible_locations.empty() || possible_weapons.empty()) {
            break;
        }
    }
}

int main() {
    Solve();
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccNP6AJm.o: in function `Theory(int, int, int)':
grader.c:(.text+0x0): multiple definition of `Theory(int, int, int)'; /tmp/ccX3ecrj.o:cluedo.cpp:(.text+0x320): first defined here
/usr/bin/ld: /tmp/ccNP6AJm.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccX3ecrj.o:cluedo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status