#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
int popcount_u128(__uint128_t value) {
// Cast and split into two 64-bit halves
uint64_t lower = (uint64_t)value; // Lower 64 bits
uint64_t upper = (uint64_t)(value >> 64); // Upper 64 bits
// Use __builtin_popcountll for each half and sum the results
return __builtin_popcountll(lower) + __builtin_popcountll(upper);
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n,m,k; cin >> n >> m >> k;
const int MX=4101;
vector<bitset<MX>> a_c(n);
vector<bitset<MX>> g_t(n);
for (int i = 0; i < n; i++)
{
int j=0;
while(j<m){
char c; cin >> c;
if(c=='A') a_c[i][j]=1;
else a_c[i][j]=0;
j++;
}
}
vector<vector<int>> dist(n,vector<int>(n,0));
for (int i = 0; i < n; i++)
{
for (int j = i+1; j < n; j++)
{
a_c[i] = a_c[i] ^ a_c[j];
dist[i][j] = a_c[i].count();
dist[j][i] = dist[i][j];
a_c[i] = a_c[i] ^ a_c[j];
}
}
for (int i = 0; i < n; i++)
{
bool b=true;
for (int j = 0; j < n; j++)
{
if(i==j) continue;
if(dist[i][j]!=k) { b=false; break; }
}
if(b==true){
cout << i+1 << "\n";
break;
}
}
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... |