#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld double
#define FOR(L , R) for(int i = L;i <= R;i++)
const int INF = 1e18;
const int sz = 2e5 + 5;
const int usz = 1e6 + 5;
const int mod = 998244353;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n , m , k;
cin >> n >> m >> k;
vector < string > a(n + 1);
for(int i = 1;i <= n;i++) cin >> a[i];
vector < vector < int > > cnt(m + 1 , vector < int > (2 , 0));
for(int i = 0;i < m;i++)
{
for(int j = 1;j <= n;j++)
{
if(a[j][i] == 'A') cnt[i + 1][0]++;
if(a[j][i] == 'C') cnt[i + 1][1]++;
}
}
for(int i = 1;i <= n;i++)
{
int cn = 0;
for(int j = 0;j < a[i].size();j++)
{
int dif = 0;
if(a[i][j] == 'A')
{
dif += cnt[j + 1][1];
}
else
{
dif += cnt[j + 1][0];
}
if(dif == k) cn++;
}
if(cn == m){
cout << i << endl;
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... |