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>
#define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
char a[4100][4100];
int n , m , k;
bool solve(int res)
{
int prev=k,cnt=0;
for(int i = 0 ; i < n ; i ++)
{
if(i==res) continue;
for(int j = 0 ; j < m ; j ++)
{
if(a[i][j]!=a[res][j]) cnt++;
if(cnt>k) return false;
}
if(prev!=cnt) return false;
prev=cnt;
cnt=0;
}
return true;
}
int32_t main() {
ZAZO
cin >> n >> m >> k;
for(int i = 0 ; i < n ; i ++)
{
for(int j = 0 ; j < m ; j ++)
{
cin>>a[i][j];
}
}
for(int i = 0 ; i < n ; i ++)
{
if(solve(i)){
cout<<i+1;
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... |