QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#136086#5254. DifferencesTadijaSebezRE 0ms0kbC++14935b2023-08-07 02:41:312023-08-07 02:41:33

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-07 02:41:33]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-08-07 02:41:31]
  • 提交

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...

output:


result: