QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#136086 | #5254. Differences | TadijaSebez | RE | 0ms | 0kb | C++14 | 935b | 2023-08-07 02:41:31 | 2023-08-07 02:41:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=10000050;
char s[N];
const int M=100050;
bool taken[M],cand[M];
int sum[M][4];
int main(){
int n,m,k;
scanf("%i %i %i",&n,&m,&k);
for(int i=0;i<n;i++){
scanf("%s",s+i*m);
cand[i]=true;
}
mt19937 rng(time(0));
while(true){
for(int j=0;j<m;j++){
for(int i=0;i<4;i++){
sum[j][i]=0;
}
}
int tot=0;
for(int i=0;i<n;i++){
taken[i]=rng()&1;
if(taken[i]){
for(int j=0;j<m;j++){
sum[j][s[i*m+j]-'A']++;
}
tot++;
}
}
int cands=0;
for(int i=0;i<n;i++){
if(cand[i]){
int diff=0;
for(int j=0;j<m;j++){
diff+=tot-sum[j][s[i*m+j]-'A'];
}
int need=tot;
if(taken[i])need--;
if(diff!=need*k){
cand[i]=false;
}else{
cands++;
}
}
}
if(cands==1)break;
}
for(int i=0;i<n;i++){
if(cand[i])printf("%i\n",i+1);
}
return 0;
}
详细
Test #1:
score: 0
Runtime Error
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...