이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 5005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t,dp[li][li],vis[li];
int cev;
string s[li];
vector<int> v[li],v1;
int main(void){
cin>>n>>m>>k;
FOR{
cin>>s[i];
}
for(int i=1;i*i<=n;i++){
for(int j=1;j<=n;j++){
cev=0;
if(j==i)continue;
for(int jj=0;jj<m;jj++){
if(s[2][jj]!=s[j][jj])cev++;
}
if(cev==k){v[i].pb(j);}
}
v[i].pb(i);
}
for(int i=2;i*i<=n;i++){
if(v[i].size()<v[1].size())swap(v[i],v[1]);
}
for(int i=0;i<(int)v[1].size();i++){
int yes=0;
for(int j=1;j<=n;j++){
if(j==v[1][i])continue;
cev=0;
for(int jj=0;jj<m;jj++){
if(s[v[1][i]][jj]!=s[j][jj])cev++;
}
if(cev==k)yes++;
}
if(yes==n-1){printf("%d\n",v[1][i]);return 0;}
}
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... |