This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int mxn = 3e5+5;
#define FAST ios_base::sync_with_stdio(0);cout.tie(0)
typedef long long ll;
bool vis[4001];
int main()
{
// input;
// output;
FAST;
int n, m, k;
cin >> n >> m >> k;
vector<bitset<4105> >v;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
bitset<4105>tmp;
// cout << tmp << '\n';
for(int r = 0; r < m; r++)
{
if(s[r]=='A') tmp[r] = '1';
}
v.push_back(tmp);
}
int ans = -1;
for(int i = 0; i < n; i++)
{
int cnt = 0;
if(vis[i]) continue;
for(int r = 0; r < n; r++)
{
if(i==r) continue;
bitset<4105>tmp = v[i]^v[r];
int x = tmp.count();
if(x==k) cnt++;
else {
vis[r] = 1;
break;
}
}
if(cnt==n-1)
{
ans = i+1;
break;
}
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |