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>
#define ll long long
using namespace std;
int n,m,k;
ll conststring[5000],Sum,pos[70][5000];
string xau[5000];
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
#define rand rd
ll Rand(ll l,ll h)
{
assert(l <= h);
return l + rd() * 1LL * rd() % (h - l + 1);
}
void Solve()
{
for(int i=1;i<=n;i++)
{
ll tong=0;
for(int j=1;j<=m;j++)
{
tong+=pos[xau[i][j]-'A'][j]-conststring[i];
}
if(tong==(Sum-conststring[i])*(m-k))
{
cout<<i;
return;
}
}
}
void Input()
{
cin>>n>>m>>k;
Sum=0;
for(int i=1;i<=n;i++)
{
cin>>xau[i];
xau[i]=" "+xau[i];
conststring[i]=abs(Rand(78,1000000));
Sum+=conststring[i];
for(int j=1;j<=m;j++)
{
pos[xau[i][j]-'A'][j]+=conststring[i];
}
}
}
int main()
{
Input();
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... |