-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy path1089. 狼人杀-简单版.cpp
33 lines (33 loc) · 993 Bytes
/
1089. 狼人杀-简单版.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
#include <bits/stdc++.h>
using namespace std;
using gg = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
gg ni;
cin >> ni;
vector<gg> input(ni + 1);
for (gg i = 1; i <= ni; ++i) {
cin >> input[i];
}
for (gg i = 1; i <= ni; ++i) { // i号玩家是狼人
for (gg j = i + 1; j <= ni; ++j) { // j号玩家是狼人
gg lier = 0, wolflier = 0;
for (gg k = 1; k <= ni; ++k) {
if (input[k] > 0 xor (abs(input[k]) != i and
abs(input[k]) != j)) { // k号玩家在撒谎
++lier;
if (k == i or k == j) { //狼人在撒谎
++wolflier;
}
}
}
if (lier == 2 and wolflier == 1) { //找到了一组解
cout << i << " " << j;
return 0;
}
}
}
cout << "No Solution";
return 0;
}