-
Notifications
You must be signed in to change notification settings - Fork 0
/
bekar.cpp
66 lines (65 loc) · 1.22 KB
/
bekar.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
#include<stdio.h>
#include<bits/stdc++.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
freopen("test.txt","r",stdin);
string str [50];
int t;
scanf("%d",&t);
int z=0;
while(t--)
{
cin>>str[z++];
int len=str[0].size();
for(int i=1;i<len;i++)
{
cin>>str[z++];
}
/* for(int i=0;i<len;i++)
{
cout<<str[i]<<endl;
}*/
long long int dp[55][55];
//memset(dp,-1,sizeof(dp));
/* for(int i=0;i<55;i++)
{
for(int j=0;j<55;j++)
{
dp[i][j]=-1;
}
}*/
int n=len;
int ct;
int maxi=0;
int max_index=0;
int j;
for(int k = 0; k < n; k++) {
ct=0;
for(int i = 0; i < n; i++)
{
if(k != i && str[k][i] =='N')
{
for( j = 0; j < n; j++)
{
if(i != j) {
if(str[k][j]!='N' && str[i][j]!='N')
break;
}
}
if(j < n) ct++;
}
}
if(ct > maxi)
{
maxi = ct, max_index = k;
}
}
printf("%d %d\n", max_index, maxi);
//cout<<maxi<<" "<<max_index<<endl;
z=0;
}
return 0;
}