이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
namespace{using namespace std;}
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e3+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n,m,k;
string gne[MAX];
int diff(string& a,string& b) {
int ans=0;
for (int i=0;i<m;i++) {
if (a[i]!=b[i]) ans++;
}
return ans;
}
int main() {
speed;
cin>>n>>m>>k;
for (int i=1;i<=n;i++) {
cin>>gne[i];
}
int ans=-1;
for (int i=1;i<=n;i++) {
bool flag=true;
for (int j=1;j<=n;j++) {
if (i==j) continue;
if (diff(gne[i],gne[j])!=k) {
flag=false;
break;
}
}
if (flag) {
ans=i;
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... |