This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("bmi,avx2,popcnt")
#include <bits/stdc++.h>
#define lli long long int
#define ld long double
#define pb push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
using namespace std;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const int N = 4102;
const int INF = 1e9 + 500;
const int MOD = 1e9 + 7;
array<bitset<N>, N> s;
array<array<int, N>, N> dif;
int n, m, k;
bitset<N> tmp;
bitset<N> vis;
void solve() {
cin >> n >> m >> k;
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
char t;
cin >> t;
s[i][j] = (t == 'A');
}
}
REP(i, n) REP(j, n) dif[i][j] = -1;
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < n; j++) {
if(dif[i][j] == -1) {
tmp = s[i] ^ s[j];
dif[i][j] = dif[j][i] = (int)tmp.count();
}
if(dif[i][j] != k) {
vis[i] = vis[j] = 1;
}
}
if(!vis[i]) {
cout << i + 1 << "\n";
return;
}
}
}
signed main() {
fastio();
solve();
}
# | 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... |