# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053761 | Braulinho | Cluedo (IOI10_cluedo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}