QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#269809 | #5254. Differences | teafrogsf | WA | 77ms | 24288kb | C++14 | 818b | 2023-11-30 01:56:59 | 2023-11-30 01:57:00 |
Judging History
answer
#include<cstdio>
#include<iostream>
#include<string>
#define f(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i=-(~i))
using namespace std;
const int neko=1e5+10;
using ll=long long;
int n,m,K;
string s[neko];
ll w[neko],sumw=0;
int cnt[neko][5];
int rd(int l,int r){return 1ll*rand()*rand()%(r-l+1)+l;}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
srand(19260817);
cin>>n>>m>>K;
f(i,1,n)
{
cin>>s[i];
}
f(i,1,n)w[i]=rd(1,1e9),sumw+=w[i];
f(i,1,n)
f(j,1,m)
cnt[j][s[i][j-1]-'A']+=w[i];
f(i,1,n)
{
ll now=0;
f(j,1,m)
f(k,0,3)if(s[i][j-1]!='A'+k)now+=cnt[j][k];
//cout<<i<<" "<<now<<endl;
if(now==K*(sumw-w[i]))return cout<<i<<endl,0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 77ms
memory: 24288kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
result:
wrong answer 1st lines differ - expected: '1397', found: ''