QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#414132#7990. 广播AcetaminophenWA 1ms3980kbC++111.0kb2024-05-18 15:36:512024-05-18 15:36:52

Judging History

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

  • [2024-05-18 15:36:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3980kb
  • [2024-05-18 15:36:51]
  • 提交

answer

#include <bits/stdc++.h> 
using namespace std;
#define ll long long 
int a[100005][20]={0};
int ori[100005]={0};
int p[100005]={0},pp=0;
int ans[100005]={0};
map<int,map<int,int>>m;//posi,k
int main(){ 
	int n=0;scanf("%d",&n);
	int pre=0;
	getchar();
	for(int i=1;i<=n;i++){
		char s;
		scanf("%c",&s);
		if(s=='0'){
			ori[i]=0;
		}else if(s=='1'){
			ori[i]=1;
			pre++;
		}else{
			ori[i]=-1;
			p[++pp]=i;
		}
	}
	for(int i=n;i>=1;i--){
		for(int k=18;k>=0;k--){
			if(i-(1<<k)>0){
				a[i][k]=ori[i-(1<<k)];
			}
		}
	}
	int last=1;
	int jd=0;
	for(int k=1;k<=n;k++){
		jd=0;
		for(int i=last;i<=pp;i++){
			if(p[i]>k){
				if(jd==0){
					jd=1;
					last=i;
				}
				int kk=k;
				int now=-1;
				int posi=p[i];
				for(int j=log2(kk)+1;j>=0;j--){
					if((1<<j)<=kk){
						now=a[posi][j];
						posi-=(1<<j);
						kk-=(1<<j);
						if(kk==0)break;
					}
				}
				if(now==1||m[p[i]-k][k]==1){
					ans[k]++;
					m[p[i]][k]=1;
				}
			}
		}
		printf("%d\n",ans[k]+pre);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3980kb

input:

4 2
2 1 3 2
4 2

output:

0
0
0
0

result:

wrong answer 1st lines differ - expected: '1', found: '0'