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;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 4005;
const int oo = 1e18 + 7, mod = 1e9 + 7;
int n, m, K;
int a[N][N];
int ha[256];
int tol[N];
void process(){
ha[0] = 1, ha[6] = 2, ha['T' - 'A'] = 3, ha[2] = 4;
cin >> n >> m >> K;
//cout << n << " " << m << " " << K << "\n";
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
char c;
cin >> c;
a[i][j] = ha[c - 'A'];
//cout << a[i][j] << "\n";
}
}
for(int i = 1; i <= n; i++){
for(int j = i + 1; j <= n; j++){
int sum = 0;
for(int k = 1; k <= m; k++) sum += (a[i][k] != a[j][k]);
//cout << i << " " << j << " " << sum << "\n";
if(sum == K){
tol[i]++, tol[j]++;
}
}
}
for(int i = 1; i <= n; i++) if(tol[i] == (n - 1)) cout << i << "\n";
int cnt = 0;
for(int i = 1; i <= n; i++){
if(tol[i] * 2 >= n) cnt++;
}
assert(cnt <= n/2);
}
signed main(){
ios_base::sync_with_stdio(0);
process();
}
# | 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... |