-
Notifications
You must be signed in to change notification settings - Fork 16
/
BUGLIFE.cpp
68 lines (64 loc) · 1.17 KB
/
BUGLIFE.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
65
66
67
68
#include<cstdio>
int main(){
char a[20][20];
int cnt=1, x, y, n, m, t;
scanf("%d", &t);
while(cnt <= t){
scanf("%d%d", &n, &m);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==j)
a[i][j] = 'o';
else
a[i][j] = 'n';
}
}
while(m--){
scanf("%d%d", &x, &y);
x--;
y--;
a[x][y] = 'v';
a[y][x] = 'v';
}
/*
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
printf("%c", a[i][j]);
printf("\n");
}
printf("\n\n");*/
bool flag = true;
for(int i=0;i<n;i++){
if(a[i][i] == 'o')
a[i][i] = 'm';
for(int j=0;j<n;j++){
if(a[i][j] == 'v'){
if(a[i][i] == 'm' && a[j][j] == 'o')
a[j][j] = 'f';
else if(a[i][i] == 'f' && a[j][j] == 'o')
a[j][j] = 'm';
else if((a[i][i] == 'm' && a[j][j] != 'f') || (a[i][i] == 'f' && a[j][j] != 'm')){
flag = false;
break;
}
}
}
if(!flag)
break;
}
/*
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
printf("%c", a[i][j]);
printf("\n");
}
printf("\n\n");*/
printf("Scenario #%d:\n", cnt);
cnt++;
if(flag)
printf("No suspicious bugs found!\n");
else
printf("Suspicious bugs found!\n");
}
return 0;
}