QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706576#6701. BaoBao Loves Readingfutarian#WA 0ms3880kbC++14558b2024-11-03 12:22:402024-11-03 12:22:41

Judging History

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

  • [2024-11-03 12:22:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3880kb
  • [2024-11-03 12:22:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int Len = 1e5 + 5;
int a[Len],n,pre[Len],b[Len],sum[Len];
int main()
{
	int T;scanf("%d",&T);
	while(T --)
	{
		scanf("%d",&n);
		for(int i = 1 ; i <= n ; i ++) 
		{
			scanf("%d",&a[i]);
			pre[a[i]] = 0;
		}
		for(int i = 1 ; i <= n ; i ++)
		{
			if(pre[a[i]]) 
			{
				b[i] = i - pre[a[i]];
				sum[b[i]] ++;
			}
			pre[a[i]] = i;
		}
		for(int i = 1 ; i <= n ; i ++) sum[i] += sum[i - 1];
		for(int i = 1 ; i <= n ; i ++) printf("%d ",n - sum[i]);puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3880kb

input:

1
7
4 3 4 2 3 1 4

output:

7 6 5 4 4 4 4 

result:

wrong answer 1st lines differ - expected: '7 6 5 4 4 4 4', found: '7 6 5 4 4 4 4 '