QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506618#5455. TreeScriptHatodaAko#WA 24ms4044kbC++17419b2024-08-05 20:11:392024-08-05 20:11:40

Judging History

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

  • [2024-08-05 20:11:40]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:4044kb
  • [2024-08-05 20:11:39]
  • 提交

answer

#include <cstdio>
#include <set>
#include <algorithm>
using namespace std;

int n;
int a[200005];

void solve(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++){
		scanf("%d", &a[i]);
	}
	int res = 0;
	set<int> st;
	for(int i=n; i>=2; i--){
		st.insert(a[i]);
		st.erase(i);
		res = max(res, (int)st.size());
	}
	printf("%d\n", res);
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
0 1 2
7
0 1 2 2 1 4 1

output:

1
2

result:

ok 2 number(s): "1 2"

Test #2:

score: -100
Wrong Answer
time: 24ms
memory: 4044kb

input:

1000
197
0 1 1 2 1 4 1 5 8 3 5 1 4 7 12 14 4 7 10 9 12 11 16 10 21 19 22 17 25 13 28 9 5 15 26 26 33 25 15 1 35 6 32 17 37 8 19 43 19 27 29 9 30 6 31 27 35 35 37 13 28 38 57 31 38 8 22 14 33 9 18 62 52 37 10 19 22 60 54 12 38 59 64 65 80 82 28 60 85 78 27 25 71 14 52 6 59 14 87 32 33 41 59 41 88 38 ...

output:

46
40
4
36
16
20
69
77
14
32
34
41
118
91
11
12
61
212
13
88
170
8
53
63
55
35
168
17
31
123
4
113
26
9
84
32
8
17
9
28
36
28
20
7
19
23
97
97
24
33
28
5
27
61
133
42
26
67
23
50
88
69
5
69
47
28
18
42
113
38
30
122
111
29
59
100
3
8
51
1
1
145
108
24
12
22
81
169
45
64
57
70
35
39
14
18
32
18
42
49...

result:

wrong answer 1st numbers differ - expected: '4', found: '46'