QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706595#6701. BaoBao Loves Readingfutarian#WA 1ms3948kbC++14653b2024-11-03 12:29:332024-11-03 12:29:33

Judging History

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

  • [2024-11-03 12:29:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3948kb
  • [2024-11-03 12:29:33]
  • 提交

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);
	for(int j = 1 ; j <= T ; j ++)
	{
		scanf("%d",&n);sum[0] = 0;
		for(int i = 1 ; i <= n ; i ++) 
		{
			scanf("%d",&a[i]);
			sum[i] = b[i] = 0;
			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]);
		printf("%d",n - sum[n]);
		if(j != T) puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3944kb

input:

1
7
4 3 4 2 3 1 4

output:

7 6 5 4 4 4 4

result:

ok single line: '7 6 5 4 4 4 4'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3948kb

input:

100
73
45 45 2 2 2 45 35 45 16 35 16 45 35 2 16 16 45 2 45 45 16 35 35 16 35 35 2 2 2 35 45 35 45 35 16 35 2 2 16 35 16 45 45 16 45 2 16 16 35 16 45 16 45 45 16 16 35 35 35 35 45 45 45 35 16 16 16 2 16 16 35 16 2
83
78 52 7 35 33 82 51 27 45 34 17 51 55 25 26 11 52 41 25 41 13 46 33 83 83 7 40 51 33...

output:

51 36 30 22 19 18 16 13 7 7 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
80 77 75 74 71 68 66 66 64 64 62 59 58 57 55 53 52 49 49 48 48 47 46 46 46 44 43 43 41 41 41 40 40 40 38 37 37 36 36 36 35 35 35 35 35 34 34 32 32...

result:

wrong answer 1st lines differ - expected: '51 30 17 4 4 4 4 4 4 4 4 4 4 4...4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4', found: '51 36 30 22 19 18 16 13 7 7 5 ...4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4'