QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142234 | #5254. Differences | wublabdubdub | WA | 76ms | 36800kb | C++14 | 1.5kb | 2023-08-18 19:16:31 | 2023-08-18 19:16:34 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<random>
using namespace std;
const long long inf=20221027;
const long long N=100002,M=100002;
mt19937 rnd(20221027);
char buf[1<<21],*p1,*p2;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
long long rd()
{
long long res=0,f=1;char ch;
for(ch=getchar();ch<'0'||ch>'9';ch=getchar())
if(ch=='-') f=-1;
for(;ch>='0'&&ch<='9';ch=getchar())
res=(res<<3)+(res<<1)+ch-'0';
return res*f;
}
void rdstr(string &s)
{
s=" ";
char ch=getchar();
while(ch<'A'||ch>'Z') ch=getchar();
while(ch>='A'&&ch<='Z')
{
s.push_back(ch);
ch=getchar();
}
return ;
}
void wt(int x)
{
if(x<0) return putchar('-'),wt(-x);
if(x>=10) wt(x/10);
putchar(x%10+'0');
return ;
}
int t[M][26];
int n,m,k;
string s[N];
long long val[N];
long long sum=0;
int main()
{
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
n=rd();m=rd();k=rd();
for(int i=1;i<=n;i++) rdstr(s[i]),val[i]=i;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
t[j][s[i][j]-'A']+=val[i];
}
sum+=val[i];
}
// for(int i=1;i<=m;i++)
// {
// for(int j=0;j<=4;j++)
// {
// cout<<t[i][j]<<" ";
// }
// cout<<endl;
// }
for(int i=1;i<=n;i++)
{
int res=0;
for(int j=1;j<=m;j++)
{
res+=t[j][s[i][j]-'A']-val[i];
}
if(res==(sum-val[i])*(m-k))
{
cout<<i<<"\n";
return 0;
}
}
// fclose(stdin);
// fclose(stdout);
return (0-0);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 76ms
memory: 36800kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
result:
wrong answer 1st lines differ - expected: '1397', found: ''