# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1226014 | LIA | Cluedo (IOI10_cluedo) | C++17 | 0 ms | 0 KiB |
#include "cluedo.h"
#include <string.h>
#define ll int
#define vll vector<ll>
#define vvll vector<vll>
#define all(A) A.begin(), A.end()
#define pll pair<ll,ll>
#define vpll vector<pll>
ll inf = 1e18;
#define loop(i,s,e) for(ll i = s; i<e ;++i)
#define vb vector<bool>
bool found = false;
bool can[4][11];
void rec(ll l1, ll l2, ll l3) {
if (found) return;
ll r = Theory(l1 , l2 ,l3);
if (r==0) {
found = 1;
return;
}
ll prob;
if (r==1) prob = l1;
if (r==2) prob = l2;
if (r==3) prob = l3;
can[r][prob] = 1;
if (found) return;
if (r== 1) {
if (found) return;
loop(i,1,7) {
if (found) return;
if (can[r][i] == false)rec(i,l2,l3);
}
}
if (r== 2) {
if (found) return;
loop(i,1,11){
if (found) return;
if (can[r][i] == false) rec(l1,i,l3);
}
}
if (r== 3) {
if (found) return;
loop(i,1,7){
if (found) return;
if (can[r][i] == false) rec(l1,l2,i);
}
}
}
void Solve() {
for (int m = 1; m <= 6; ++m) {
for (int l = 1; l <= 10; ++l) {
for (int w = 1; w <= 6; ++w) {
int r = Theory(m, l, w);
if (r == 0) {
return; // Found!
}
}
}
}
}