-
Notifications
You must be signed in to change notification settings - Fork 0
/
mstrmind.cpp
64 lines (51 loc) · 1001 Bytes
/
mstrmind.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
void print(vector<int> &g ) {
for ( int i = 0; i < g.size(); i++ ) {
cout << g[i] << " ";
}
printf("\n");
}
void del( vector<int> &g, vector< vector<int> > &pp, vector<int> &judge ) {
for ( int i = 0; i < 4; i++ ) {
if ( judge[i] != 1 ) {
remove(pp[i].begin(), pp[i].end(), g[i]);
} else {
pp[i][0] = g[i];
}
}
}
int main()
{
int known = 0;
vector<int> g;
vector<int> p;
for ( int i = 0; i < 6; i++ ) {
p.push_back(i + 1);
}
vector< vector<int> > pp;
for ( int i = 0; i < 4; i++ ) {
pp.push_back(p);
}
vector<int> judge;
while ( count(judge.begin(), judge.end(), 1 ) < 4 ) {
judge.clear();
for ( int i = 0; i < 4; i++ ) {
g.push_back(pp[i][0]);
}
print(g);
fflush(stdout);
for ( int i = 0; i < 4; i++ ) {
int j;
cin >> j;
judge.push_back(j);
}
del(g, pp, judge);
g.clear();
}
return 0;
}