QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#522984#8904. Рекорды и антирекордыDaiRuiChen007100 ✓95ms18956kbC++171.1kb2024-08-17 17:45:302024-08-17 17:45:33

Judging History

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

  • [2024-08-17 17:45:33]
  • 评测
  • 测评结果:100
  • 用时:95ms
  • 内存:18956kb
  • [2024-08-17 17:45:30]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
int n,a[MAXN],pre[MAXN],suf[MAXN],f[MAXN],w[MAXN];
struct FenwickTree1 {
	int tr[MAXN],s;
	void init() { fill(tr,tr+n+1,0); }
	void add(int x,int v) { for(;x<=n;x+=x&-x) tr[x]=max(tr[x],v); }
	int qry(int x) { for(s=0,x=min(x,n);x;x&=x-1) s=max(s,tr[x]); return s; }
}	T1;
struct FenwickTree2 {
	int tr[MAXN],s;
	void init() { fill(tr,tr+n+1,0); }
	void add(int x,int v) { for(;x;x&=x-1) tr[x]=max(tr[x],v); }
	int qry(int x) { for(s=0,x=max(x,1);x<=n;x+=x&-x) s=max(s,tr[x]); return s; }
}	T2;
void solve() {
	scanf("%d",&n); int ans=0;
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	set <int> S{0,n+1}; f[0]=f[n+1]=0;
	for(int i=1;i<=n;++i) {
		auto it=--S.upper_bound(a[i]);
		w[i]=f[a[i]]=++f[*it],pre[i]=*it,suf[i]=*++it,S.insert(a[i]);
	}
	T1.init(),T2.init();
	for(int i=n;i>=1;--i) {
		ans=max(ans,w[i]+T1.qry(pre[i])+T2.qry(pre[i]));
		ans=max(ans,w[i]+T1.qry(suf[i])+T2.qry(suf[i]));
		T1.add(a[i],T1.qry(a[i])+1),T2.add(a[i],T2.qry(a[i])+1);
	}
	printf("%d\n",ans);
}
signed main() {
	int Q; scanf("%d",&Q);
	while(Q--) solve();
	return 0;
}

详细

Subtask #1:

score: 21
Accepted

Test #1:

score: 21
Accepted
time: 0ms
memory: 8224kb

input:

120
5
3 1 4 2 5
5
3 4 2 5 1
5
5 4 2 1 3
5
1 2 5 4 3
5
2 4 3 1 5
5
3 1 5 2 4
5
1 4 2 3 5
5
5 1 4 3 2
5
1 5 3 2 4
5
3 1 2 5 4
5
3 1 5 4 2
5
1 2 3 4 5
5
1 5 2 4 3
5
3 5 2 1 4
5
2 1 5 4 3
5
1 5 3 4 2
5
3 1 4 5 2
5
2 1 4 5 3
5
1 3 5 4 2
5
5 3 4 2 1
5
2 1 3 5 4
5
2 3 1 5 4
5
2 4 3 5 1
5
4 3 2 5 1
5
4 5 2 ...

output:

5
5
5
5
5
4
5
5
5
4
4
5
5
5
4
5
5
4
5
5
4
4
5
5
4
5
4
5
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
5
5
4
5
5
5
4
5
5
5
5
4
5
5
5
5
5
5
4
5
5
5
5
5
5
4
5
4
5
5
5
5
4
5
5
4
5
4
5
4
5
5
4
4
4
4
5
5
4
4
5
5
5
4
5
4
5
5
5
4
5
4
5
5
4
4
5
5
5
4
5
5
5
5

result:

ok 120 numbers

Test #2:

score: 21
Accepted
time: 1ms
memory: 7920kb

input:

120
16
11 8 4 12 3 6 10 9 7 15 14 2 16 5 1 13
16
9 1 13 14 3 7 5 15 4 11 2 12 8 6 16 10
16
3 12 11 10 5 13 4 8 9 2 7 16 6 14 15 1
16
9 4 7 2 3 8 1 13 5 12 16 14 11 10 6 15
16
14 5 11 10 6 12 7 9 1 16 15 3 4 8 13 2
16
3 13 16 10 5 11 8 4 15 2 9 7 14 1 6 12
16
4 16 7 11 15 5 9 14 8 13 6 3 1 2 12 10
16...

output:

10
10
12
9
11
10
11
12
10
11
9
10
10
9
12
11
12
10
9
10
10
8
11
10
10
11
11
11
9
11
9
10
11
11
11
12
11
10
13
11
11
11
11
10
10
12
10
10
11
9
10
11
10
11
11
12
12
10
11
11
11
10
9
10
12
10
12
11
11
10
11
11
9
11
11
9
11
11
11
11
10
10
11
11
10
10
12
10
8
12
13
10
9
12
11
10
11
11
11
13
11
10
9
10
11...

result:

ok 120 numbers

Test #3:

score: 21
Accepted
time: 1ms
memory: 5888kb

input:

120
16
10 7 5 9 12 6 3 1 13 15 2 8 11 16 14 4
13
11 1 10 8 7 9 5 4 6 2 13 3 12
14
2 5 10 12 13 14 6 7 1 3 9 4 8 11
9
7 9 8 6 2 5 4 3 1
11
9 8 1 6 7 4 3 2 11 5 10
12
12 1 3 7 11 5 9 8 6 2 4 10
12
10 8 2 6 4 1 3 5 12 11 7 9
14
9 3 12 10 13 4 5 14 11 7 6 8 1 2
16
1 15 10 3 6 5 4 14 2 9 8 7 11 13 16 12
...

output:

11
10
9
8
9
10
10
9
12
7
11
10
9
9
8
8
6
7
5
7
7
6
5
8
5
9
9
6
8
9
7
9
11
7
8
9
7
10
6
8
7
8
9
8
9
10
7
6
7
8
7
7
7
9
9
12
7
8
8
10
9
9
6
12
7
8
6
12
8
8
6
6
6
8
8
6
6
7
6
11
11
10
7
9
12
10
8
7
5
7
8
10
11
5
10
8
8
7
8
7
5
5
11
6
12
5
6
10
5
7
10
6
10
7
9
9
8
10
8
9

result:

ok 120 numbers

Test #4:

score: 21
Accepted
time: 1ms
memory: 7920kb

input:

120
14
4 12 10 13 8 1 6 14 11 9 7 5 2 3
11
9 11 5 4 3 1 2 8 7 10 6
12
10 6 4 2 12 11 9 3 7 8 1 5
13
10 2 6 12 11 5 9 7 13 3 8 1 4
12
6 2 8 11 1 7 4 3 9 5 12 10
11
6 10 2 11 4 9 1 8 3 5 7
15
11 5 6 1 2 13 12 4 15 7 10 8 9 3 14
12
3 9 1 5 10 2 4 12 8 6 11 7
11
10 2 8 7 9 4 3 11 6 1 5
13
4 2 9 12 7 3 1...

output:

10
8
8
9
8
7
10
7
9
9
8
9
9
8
9
11
7
8
11
8
9
10
11
10
9
9
10
6
13
10
10
6
6
8
10
8
9
8
7
8
7
11
8
9
8
9
12
10
9
7
12
8
10
7
11
10
7
10
9
12
8
10
8
10
8
7
10
8
10
9
9
9
8
10
7
9
10
8
12
7
8
8
7
8
11
9
9
8
10
10
11
9
9
8
10
9
7
9
9
11
12
8
9
11
10
11
8
9
9
8
11
9
8
12
9
10
8
10
8
8

result:

ok 120 numbers

Test #5:

score: 21
Accepted
time: 1ms
memory: 7924kb

input:

32
4
1 4 3 2
4
4 1 3 2
4
4 3 2 1
4
1 3 2 4
4
1 2 3 4
4
3 4 2 1
3
1 2 3
4
1 3 4 2
4
3 1 4 2
2
2 1
4
2 4 1 3
4
2 1 4 3
3
2 3 1
4
3 2 4 1
4
2 3 1 4
4
4 1 2 3
4
1 4 2 3
4
4 2 1 3
4
2 1 3 4
4
3 1 2 4
4
2 4 3 1
2
1 2
4
3 2 1 4
4
4 2 3 1
3
3 1 2
3
3 2 1
4
4 3 1 2
4
2 3 4 1
4
3 4 1 2
4
1 2 4 3
3
1 3 2
3
2 1 3

output:

4
4
4
4
4
4
3
4
4
2
4
3
3
4
4
4
4
4
4
4
4
2
4
4
3
3
4
4
3
4
3
3

result:

ok 32 numbers

Test #6:

score: 21
Accepted
time: 1ms
memory: 5876kb

input:

120
16
16 1 14 12 7 2 6 8 9 10 11 13 15 5 4 3
16
3 5 16 7 12 15 9 4 6 8 10 2 11 13 14 1
15
1 15 2 5 14 3 13 12 11 10 9 8 7 6 4
11
11 9 3 6 2 4 8 7 10 5 1
15
15 2 3 11 12 10 7 5 6 4 8 13 1 9 14
14
3 4 13 6 14 5 10 12 9 11 8 7 2 1
13
1 3 10 13 9 12 11 8 7 6 4 5 2
13
3 13 12 10 8 4 9 7 5 6 11 2 1
13
2 ...

output:

16
14
14
9
13
12
11
12
11
10
15
11
11
16
15
11
10
12
14
13
10
12
11
8
10
14
10
13
14
13
12
10
9
11
12
10
10
11
15
14
13
13
9
10
10
16
15
10
12
11
12
15
8
13
13
11
12
13
9
16
11
11
15
11
12
9
15
16
14
10
14
10
16
15
15
13
12
11
15
10
16
11
10
11
14
9
13
13
16
14
12
11
11
16
11
15
14
14
14
12
16
14
15...

result:

ok 120 numbers

Test #7:

score: 21
Accepted
time: 1ms
memory: 5876kb

input:

120
10
9 5 8 10 7 6 4 3 2 1
15
2 14 11 3 7 8 6 9 10 12 5 13 15 4 1
12
4 5 12 11 8 7 6 9 3 2 1 10
10
10 5 8 9 7 6 4 3 2 1
12
10 2 9 6 4 3 5 7 8 12 11 1
15
2 15 12 13 3 11 7 14 10 9 8 6 5 4 1
14
13 12 11 10 8 7 6 5 4 14 9 3 1 2
10
4 6 1 5 7 8 3 9 10 2
16
15 13 1 8 2 5 3 4 6 7 9 10 11 12 14 16
14
14 1 ...

output:

10
15
12
10
11
14
12
9
16
13
12
15
9
12
11
12
16
13
10
16
15
10
12
13
11
11
16
10
16
10
13
13
12
12
14
13
12
12
13
14
15
10
10
9
11
12
12
12
10
15
8
16
12
10
16
12
10
12
15
11
14
12
13
15
15
16
13
16
14
11
11
14
12
12
10
11
11
13
9
11
12
10
16
14
9
14
12
11
11
16
14
10
11
11
16
11
10
15
10
11
10
15
...

result:

ok 120 numbers

Test #8:

score: 21
Accepted
time: 1ms
memory: 8216kb

input:

120
16
4 8 13 14 16 15 12 11 10 9 7 5 6 3 2 1
16
1 3 5 15 10 14 12 6 9 8 7 11 4 13 2 16
16
4 15 10 8 14 11 12 16 9 13 7 6 5 3 2 1
16
15 12 1 10 8 2 9 3 7 6 13 11 14 16 5 4
16
4 16 1 5 11 12 10 13 9 8 14 15 7 6 3 2
16
5 6 7 15 14 12 11 13 10 16 9 8 4 3 2 1
16
2 5 7 8 12 10 13 11 14 15 16 9 6 4 1 3
16...

output:

15
15
14
14
15
16
15
15
16
16
16
16
16
16
16
15
15
16
14
16
16
15
16
15
14
15
16
16
15
15
15
15
15
16
16
16
15
15
15
16
16
16
15
16
16
14
15
15
16
14
16
14
12
14
16
15
16
15
16
14
16
16
16
16
16
14
15
16
14
16
16
15
15
16
14
14
14
15
15
14
15
16
16
16
15
16
15
16
16
16
15
14
16
15
16
16
15
16
15
14
...

result:

ok 120 numbers

Test #9:

score: 21
Accepted
time: 1ms
memory: 7980kb

input:

120
6
6 5 4 3 2 1
4
4 3 2 1
14
14 13 12 11 10 9 8 7 6 5 4 3 2 1
15
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
8
1 2 3 4 5 6 7 8
8
1 2 3 4 5 6 7 8
7
1 2 3 4 5 6 7
5
1 2 3 4 5
12
12 11 10 9 8 7 6 5 4 3 2 1
10
10 9 8 7 6 5 4 3 2 1
16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
13
1 2 3 4 5 6 7 8 9 10 11 12 13
8
8 ...

output:

6
4
14
15
8
8
7
5
12
10
16
13
8
7
8
13
15
4
10
8
11
7
12
14
16
8
8
8
5
15
7
15
9
5
2
16
3
6
9
2
6
12
4
4
9
13
3
10
10
4
14
9
4
7
14
4
7
10
15
7
8
12
9
4
7
7
16
12
10
6
7
15
2
5
12
13
6
14
5
10
16
8
3
16
8
3
11
5
12
16
6
3
2
4
16
6
7
4
13
15
8
10
2
7
12
4
14
11
11
12
11
5
16
12
8
9
9
4
9
11

result:

ok 120 numbers

Test #10:

score: 21
Accepted
time: 1ms
memory: 7924kb

input:

120
16
2 14 8 7 16 11 9 15 1 5 10 4 6 12 13 3
16
14 16 5 13 9 10 15 7 4 8 1 12 2 6 11 3
16
15 14 11 12 13 9 10 7 8 3 4 16 5 6 2 1
16
3 16 14 5 15 12 10 2 4 11 6 7 9 1 8 13
16
1 13 2 14 6 15 3 7 16 11 9 5 8 12 10 4
16
16 2 12 14 11 13 9 10 5 6 8 7 1 3 15 4
16
8 2 6 16 15 5 1 13 10 7 12 4 14 3 11 9
16...

output:

11
9
11
12
11
11
10
14
11
10
13
10
11
11
10
11
10
11
11
11
11
9
13
11
11
10
11
10
12
10
11
10
10
11
11
11
10
10
12
10
11
11
11
12
9
12
12
11
12
12
12
12
11
10
10
12
12
10
10
11
12
14
10
12
13
11
12
11
12
10
11
11
11
12
10
11
12
12
12
9
9
12
11
12
11
13
12
11
12
12
11
11
12
10
14
10
11
13
10
12
12
12...

result:

ok 120 numbers

Subtask #2:

score: 22
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 22
Accepted
time: 1ms
memory: 7928kb

input:

10
200
143 118 102 41 39 3 167 56 189 32 139 175 16 135 145 160 147 68 14 33 161 96 9 11 137 158 25 19 120 184 34 128 28 187 164 75 106 47 151 194 49 141 59 179 72 20 36 154 134 123 73 193 80 17 133 186 53 2 185 196 107 48 74 63 55 79 61 168 104 31 183 42 117 87 144 171 172 76 77 30 112 180 84 8 119...

output:

42
39
43
39
41
39
39
42
39
43

result:

ok 10 numbers

Test #12:

score: 22
Accepted
time: 1ms
memory: 7996kb

input:

10
199
187 117 118 194 126 44 35 40 111 162 85 155 106 12 109 191 170 60 138 159 128 82 174 80 176 57 88 11 16 141 185 46 59 181 102 87 52 148 157 151 121 56 99 67 115 193 101 133 39 81 145 140 34 183 107 38 139 152 76 165 136 71 2 127 25 61 14 172 137 73 83 153 19 166 77 15 129 130 160 4 42 36 122 ...

output:

39
40
37
44
39
43
36
40
44
40

result:

ok 10 numbers

Test #13:

score: 22
Accepted
time: 0ms
memory: 7968kb

input:

10
196
50 3 166 63 113 192 68 26 154 60 187 147 30 101 61 69 33 13 45 81 153 94 72 108 137 84 67 46 56 62 188 171 75 141 139 110 150 77 146 38 14 29 143 18 10 156 57 195 112 35 111 27 24 40 167 90 121 6 22 159 131 107 78 172 180 103 82 97 48 182 100 132 54 138 114 190 120 152 181 115 32 136 92 74 19...

output:

42
11
26
23
16
28
23
33
14
13

result:

ok 10 numbers

Test #14:

score: 22
Accepted
time: 0ms
memory: 8004kb

input:

10
200
3 4 199 197 5 6 196 194 9 190 191 188 11 187 185 184 182 12 15 179 16 177 178 175 20 176 174 172 170 169 165 164 163 160 21 23 158 151 24 27 30 32 33 155 146 144 143 34 142 35 138 136 36 39 37 134 130 121 127 40 120 42 117 43 44 118 114 51 116 46 113 111 48 52 55 68 110 109 106 105 104 65 72 ...

output:

177
177
183
178
184
178
186
183
182
180

result:

ok 10 numbers

Test #15:

score: 22
Accepted
time: 1ms
memory: 8228kb

input:

10
198
198 1 197 196 2 190 194 188 184 3 4 183 181 180 178 8 174 173 9 10 12 13 172 170 166 14 15 16 23 165 24 163 162 25 159 160 27 157 155 30 32 34 154 35 150 37 38 46 48 153 149 148 49 50 145 141 51 137 135 52 54 134 55 131 58 60 130 129 63 127 65 123 122 66 67 68 119 118 69 116 112 71 110 72 73 ...

output:

189
185
183
184
191
176
189
184
181
183

result:

ok 10 numbers

Test #16:

score: 22
Accepted
time: 1ms
memory: 5864kb

input:

10
198
197 196 2 194 193 3 191 189 188 6 8 9 185 183 13 16 181 19 20 180 21 24 22 179 176 30 175 174 172 168 167 33 34 166 165 164 35 38 163 39 161 40 159 158 154 153 41 42 43 44 49 51 152 52 53 149 55 144 143 141 58 138 60 136 134 133 132 61 62 63 65 66 76 131 75 130 79 129 128 82 83 127 123 122 85...

output:

195
195
187
178
197
195
197
190
186
193

result:

ok 10 numbers

Test #17:

score: 22
Accepted
time: 1ms
memory: 5976kb

input:

10
191
191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 1...

output:

191
196
199
200
191
192
190
197
191
197

result:

ok 10 numbers

Test #18:

score: 22
Accepted
time: 1ms
memory: 8228kb

input:

10
198
5 3 6 10 8 17 20 22 27 28 196 195 190 187 186 181 185 180 176 175 174 173 172 166 169 164 162 161 159 155 157 153 154 151 152 150 149 145 144 143 142 140 139 134 131 130 129 126 125 124 123 122 121 119 113 115 112 110 108 107 105 104 102 100 98 93 89 95 88 84 81 79 78 76 74 72 71 70 68 66 64 ...

output:

182
179
178
177
170
174
169
177
177
175

result:

ok 10 numbers

Test #19:

score: 22
Accepted
time: 1ms
memory: 7940kb

input:

10
200
199 200 196 197 18 198 191 192 193 194 195 190 188 187 185 186 183 184 182 178 180 181 175 176 177 174 171 172 173 169 170 164 165 166 167 163 162 25 161 160 158 159 155 156 157 75 153 154 152 146 147 149 150 151 145 144 143 140 141 142 138 139 137 134 135 132 133 130 131 123 124 125 126 127 ...

output:

106
106
106
104
48
104
106
103
103
106

result:

ok 10 numbers

Subtask #3:

score: 14
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #20:

score: 14
Accepted
time: 1ms
memory: 6020kb

input:

1
2000
1168 10 583 1288 787 1181 996 1193 73 1105 553 42 176 1540 207 1483 848 280 1013 94 59 1626 735 419 474 1167 599 1805 452 964 105 1930 56 579 1749 1123 1502 945 476 1161 125 828 925 847 1810 577 870 87 1188 781 519 622 1514 484 897 471 1209 1945 496 969 1389 613 1526 44 1182 593 568 1091 1566...

output:

125

result:

ok 1 number(s): "125"

Test #21:

score: 14
Accepted
time: 1ms
memory: 8028kb

input:

1
1983
1441 1154 1855 262 1157 1453 863 319 1782 1956 847 1465 1529 970 629 499 529 676 1058 746 1173 152 1302 1191 1193 1938 517 1547 398 313 734 1821 1029 783 1387 1483 856 1450 1059 422 23 1432 550 1707 191 1180 194 646 204 1088 760 1096 761 1145 1603 1597 538 1102 41 633 443 1581 1174 1418 1370 ...

output:

129

result:

ok 1 number(s): "129"

Test #22:

score: 14
Accepted
time: 0ms
memory: 8032kb

input:

1
2000
2000 1998 1 1997 1996 1995 1994 2 4 1991 5 6 1990 8 1989 11 12 1987 1982 15 18 1980 19 20 21 1977 1976 22 24 25 1974 1973 26 1972 28 29 1971 1970 30 1969 1968 31 1966 1965 37 38 1963 44 45 46 1962 47 1961 1950 1949 1948 1947 1946 1944 1939 1938 1937 50 1936 1932 51 54 1930 56 1928 1923 1922 1...

output:

1982

result:

ok 1 number(s): "1982"

Test #23:

score: 14
Accepted
time: 0ms
memory: 8088kb

input:

1
1988
3 1986 9 1985 1984 1977 1975 10 1973 1970 11 1968 12 14 1967 15 16 17 1964 18 20 22 1963 23 26 28 1962 29 1959 31 1958 35 1957 38 39 43 1956 1955 1954 45 46 48 49 51 1950 53 55 1949 1948 1947 1946 1943 1942 1940 57 1939 58 1938 1937 59 1933 61 1932 63 1930 1923 68 71 1921 73 75 1920 76 1919 7...

output:

1978

result:

ok 1 number(s): "1978"

Test #24:

score: 14
Accepted
time: 1ms
memory: 8316kb

input:

1
1899
1899 2 1896 3 1894 1891 1890 1886 4 1885 1882 1880 5 6 7 9 13 17 18 1879 1878 20 1877 21 24 27 30 1876 1875 31 1871 1870 1869 1868 1867 1864 1863 1862 1859 32 1858 1856 1855 1852 33 34 1849 1847 35 36 37 1845 38 40 42 44 1843 1841 46 1840 48 49 53 54 1836 55 1835 1834 1831 1829 56 59 62 63 65...

output:

1895

result:

ok 1 number(s): "1895"

Test #25:

score: 14
Accepted
time: 0ms
memory: 8028kb

input:

2
500
1 2 3 491 4 5 492 493 6 7 8 494 495 9 496 10 497 498 499 500 251 252 253 11 12 13 14 254 15 16 255 17 256 257 18 19 20 21 258 259 22 260 23 24 261 262 263 264 25 26 27 265 266 267 268 269 270 28 29 30 271 272 273 274 31 32 33 34 35 275 36 37 38 276 39 277 40 278 41 279 42 43 44 45 46 280 281 4...

output:

267
269

result:

ok 2 number(s): "267 269"

Test #26:

score: 14
Accepted
time: 1ms
memory: 8028kb

input:

1
2000
1 2 3 1981 1982 4 5 6 1983 7 1984 1985 8 1986 9 1987 1988 10 1989 1990 11 1991 1992 12 13 1993 1994 14 1995 15 1996 1997 1998 16 17 18 1999 2000 19 20 1001 21 1002 1003 1004 22 1005 23 1006 24 1007 25 26 1008 27 1009 1010 1011 1012 1013 1014 28 29 30 1015 31 1016 1017 32 1018 1019 1020 1021 1...

output:

1043

result:

ok 1 number(s): "1043"

Test #27:

score: 14
Accepted
time: 1ms
memory: 8000kb

input:

1
2000
2000 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 1956 1955 1954 1953 1952 1951 1950 1949 1948 1947 1946 1945 1944 1943 194...

output:

2000

result:

ok 1 number(s): "2000"

Test #28:

score: 14
Accepted
time: 1ms
memory: 8084kb

input:

1
1930
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

1930

result:

ok 1 number(s): "1930"

Test #29:

score: 14
Accepted
time: 0ms
memory: 6012kb

input:

1
2000
2000 1998 1997 1996 1995 1994 1991 1990 1989 1987 1 2 4 5 6 8 11 12 15 18 19 20 21 22 24 25 26 28 29 30 31 37 38 44 45 46 47 50 51 54 56 58 59 60 63 64 67 68 70 76 77 78 79 82 85 86 88 90 91 92 93 94 96 102 104 108 111 114 116 118 119 120 121 123 124 131 132 133 135 143 144 145 147 148 149 15...

output:

1982

result:

ok 1 number(s): "1982"

Test #30:

score: 14
Accepted
time: 1ms
memory: 8036kb

input:

1
2000
5 3 2000 1994 1997 1998 1989 1992 9 13 11 14 1993 1984 1987 15 1988 1982 1979 1981 22 23 1975 32 1973 1958 1959 1960 1962 1963 1967 31 1970 1972 25 37 33 38 39 40 1954 1956 1953 1950 1951 1948 1949 1947 1942 1944 42 48 1946 1941 1940 46 1937 1939 43 1931 1934 1936 1926 52 49 1930 53 1921 55 6...

output:

1004

result:

ok 1 number(s): "1004"

Test #31:

score: 14
Accepted
time: 1ms
memory: 7980kb

input:

4
500
240 133 186 476 472 495 209 478 423 461 274 179 391 235 275 127 490 40 27 377 439 239 299 257 468 410 116 331 237 361 11 198 303 214 172 359 245 264 452 174 497 144 293 38 206 321 399 283 83 170 350 88 458 35 105 457 236 50 372 485 212 189 96 281 311 205 386 211 491 404 197 65 95 467 405 119 4...

output:

75
69
254
252

result:

ok 4 number(s): "75 69 254 252"

Subtask #4:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #32:

score: 10
Accepted
time: 2ms
memory: 7880kb

input:

872
6
4 5 6 2 1 3
6
4 5 6 3 1 2
6
6 3 1 4 2 5
6
4 6 5 2 3 1
6
3 5 2 4 1 6
6
1 6 5 4 3 2
5
5 1 4 3 2
6
1 5 2 6 3 4
5
1 3 2 4 5
5
3 5 1 2 4
6
5 4 1 2 6 3
6
2 1 3 4 5 6
4
2 1 4 3
6
4 3 5 1 6 2
6
5 3 1 4 6 2
6
5 2 3 6 4 1
6
4 5 1 6 2 3
6
1 2 6 5 3 4
6
2 5 1 4 3 6
6
3 5 2 6 4 1
6
2 5 3 6 1 4
5
1 3 5 2 4
...

output:

5
5
6
5
6
6
5
5
5
4
6
6
3
5
6
6
4
6
5
5
5
5
5
6
6
5
6
5
6
6
6
6
5
5
5
5
5
4
6
5
6
6
5
6
6
5
5
5
6
6
6
4
5
6
6
6
5
6
6
5
5
6
6
5
6
6
6
5
4
5
5
5
4
5
5
5
5
5
5
5
6
6
5
6
6
5
6
6
5
6
5
5
6
4
5
5
5
5
6
5
5
6
5
6
5
6
5
5
6
4
5
5
6
6
5
4
5
6
3
5
5
5
5
5
4
6
6
6
6
5
5
5
5
5
5
5
5
5
5
5
6
6
4
5
5
6
6
6
5
6
...

result:

ok 872 numbers

Test #33:

score: 10
Accepted
time: 0ms
memory: 6804kb

input:

1
10000
10000 9999 9998 9996 9993 9991 9990 9989 9987 9986 1 3 5 8 9 10 12 14 16 18 19 21 20 22 23 26 27 28 35 36 38 39 44 45 46 47 48 49 51 52 54 55 58 60 61 65 69 71 73 74 75 77 79 80 83 87 88 89 90 91 92 93 95 96 102 104 114 115 116 117 119 131 132 136 133 137 139 140 141 143 144 145 146 149 150 ...

output:

9934

result:

ok 1 number(s): "9934"

Test #34:

score: 10
Accepted
time: 3ms
memory: 8752kb

input:

1
9996
3 6 7 10 13 14 15 16 17 20 9996 9995 9993 9991 9990 9989 9988 9986 9985 9983 9982 9981 9975 9974 9973 9971 9970 9968 9967 9966 9965 9963 9961 9960 9959 9958 9957 9954 9953 9952 9951 9950 9949 9944 9943 9941 9939 9937 9936 9930 9928 9923 9918 9917 9916 9915 9910 9909 9908 9907 9906 9903 9900 9...

output:

9949

result:

ok 1 number(s): "9949"

Test #35:

score: 10
Accepted
time: 2ms
memory: 7924kb

input:

100
98
98 94 93 86 82 83 81 79 78 76 3 7 9 12 10 14 16 19 21 24 27 33 31 34 35 38 36 42 39 43 45 46 48 50 51 54 55 56 57 59 60 67 69 70 75 72 73 77 80 84 74 71 68 65 66 63 64 62 61 58 53 52 49 47 44 41 40 37 30 32 29 28 26 25 23 20 22 18 17 15 13 11 8 6 5 4 2 1 85 87 88 89 90 91 92 95 96 97
92
2 4 6...

output:

89
87
86
84
86
90
90
89
86
80
94
96
86
87
79
85
91
84
85
93
77
83
88
91
83
83
82
88
89
89
83
86
89
92
83
86
92
87
85
91
87
87
87
88
94
91
87
87
85
89
88
83
81
88
94
83
87
93
81
93
87
82
92
82
87
89
89
91
89
88
77
89
91
84
91
79
91
93
87
81
84
89
89
85
87
89
82
85
90
81
85
87
93
85
85
90
87
92
84
86

result:

ok 100 numbers

Test #36:

score: 10
Accepted
time: 0ms
memory: 8436kb

input:

1
10000
7501 1 7502 7503 7504 7505 2 3 7506 4 5 7507 6 7 8 9 7508 10 7509 7510 7511 7512 7513 11 12 13 14 15 7514 7515 7516 7517 7518 7519 16 7520 7521 17 18 7522 19 7523 7524 20 7525 7526 7527 21 22 23 7528 24 25 7529 7530 7531 7532 26 7533 27 28 7534 29 7535 7536 7537 7538 30 7539 31 32 33 34 35 7...

output:

5061

result:

ok 1 number(s): "5061"

Test #37:

score: 10
Accepted
time: 3ms
memory: 6552kb

input:

1
9943
7456 1 2 3 4 7457 7458 5 6 7459 7460 7461 7462 7 8 9 10 11 7463 7464 12 7465 13 7466 7467 7468 7469 14 7470 15 16 17 7471 7472 7473 18 19 20 21 7474 7475 7476 22 23 7477 7478 7479 24 25 7480 26 27 7481 28 29 30 31 7482 7483 7484 32 7485 7486 33 34 35 36 37 38 39 7487 7488 40 7489 7490 7491 74...

output:

5109

result:

ok 1 number(s): "5109"

Test #38:

score: 10
Accepted
time: 3ms
memory: 8452kb

input:

1
9805
1 2 7354 3 7355 4 7356 7357 7358 7359 5 6 7360 7 8 9 7361 7362 7363 7364 10 11 12 7365 7366 13 7367 7368 14 15 7369 7370 16 7371 17 7372 18 7373 19 7374 20 7375 21 7376 7377 22 23 7378 7379 7380 7381 24 7382 25 7383 26 7384 7385 27 7386 7387 28 7388 7389 29 30 31 7390 7391 32 7392 33 34 35 73...

output:

4990

result:

ok 1 number(s): "4990"

Test #39:

score: 10
Accepted
time: 4ms
memory: 8460kb

input:

1
10000
7165 2447 5405 3581 9361 3971 8851 4278 6268 5716 9611 3968 1189 6271 2701 2990 6163 3439 345 4257 7310 8964 1847 2231 3461 4213 8817 19 6111 831 3750 51 5263 4628 2088 5897 3026 1410 4944 7589 1364 5766 3804 5202 3272 2601 3881 6969 3450 9322 9620 1749 756 7255 8309 4609 4023 117 4495 4550 ...

output:

286

result:

ok 1 number(s): "286"

Test #40:

score: 10
Accepted
time: 4ms
memory: 6516kb

input:

1
9932
7651 4852 7660 1165 6160 8413 271 6590 920 9880 5773 8804 9504 2790 9156 2622 6633 9488 8637 1710 2343 3357 3641 3810 95 8973 3831 4979 2704 2643 8975 7443 9662 5961 2804 3327 251 8511 6450 128 7952 7633 4458 7158 8618 9490 9288 4542 1067 2888 9529 5944 1021 9292 5764 5603 192 9588 3011 9064 ...

output:

284

result:

ok 1 number(s): "284"

Test #41:

score: 10
Accepted
time: 4ms
memory: 8720kb

input:

1
9246
5493 4226 7730 4532 4654 6898 1211 8616 8847 131 1044 6604 6279 1528 301 5271 827 7424 2382 6518 1346 4144 2635 5154 7246 6048 8705 7429 1686 727 3746 6958 2180 4126 936 7727 5457 5822 5667 8483 1286 1954 4172 2286 3002 3414 2357 3095 7075 6435 7683 7935 6942 7180 210 3097 1652 4549 2989 3890...

output:

273

result:

ok 1 number(s): "273"

Test #42:

score: 10
Accepted
time: 3ms
memory: 6504kb

input:

1
9200
1 9200 9199 2 9198 3 9197 4 6 9196 7 9195 9 11 12 13 9194 9193 14 9190 9189 9187 9185 9183 16 9182 9181 18 22 9180 9178 25 26 27 31 33 9177 34 9176 9175 9174 35 45 46 48 9172 9171 9170 49 9165 9163 9162 50 9159 9157 9155 51 9152 52 9146 9145 9144 9143 9141 9140 9139 54 9138 9136 57 9135 9134 ...

output:

9123

result:

ok 1 number(s): "9123"

Test #43:

score: 10
Accepted
time: 0ms
memory: 8752kb

input:

1
9659
1 9658 9659 9657 5 9656 6 9654 7 9653 9650 9648 9644 9643 8 9 10 12 17 21 24 9642 9641 9640 9638 9637 9635 9632 9631 23 26 9630 27 9629 33 36 9628 37 9627 9626 9621 9624 9619 9618 40 41 42 43 45 46 9616 9614 49 9613 9612 9610 51 9609 9608 9606 55 9603 56 9602 57 9597 59 9595 60 61 62 65 67 95...

output:

9208

result:

ok 1 number(s): "9208"

Test #44:

score: 10
Accepted
time: 4ms
memory: 8484kb

input:

1
9796
9796 5 9 11 9795 9794 12 9793 9792 19 9791 9790 21 9789 22 9788 9787 9786 9785 23 24 9779 26 9782 9778 9777 27 9775 28 29 9772 9771 9770 9768 32 34 9767 42 9764 43 9763 9759 45 46 49 9757 52 9756 9754 55 57 58 9749 9743 9738 61 9737 62 65 66 9736 70 9735 9734 9733 71 9731 72 9730 73 9728 9727...

output:

9708

result:

ok 1 number(s): "9708"

Test #45:

score: 10
Accepted
time: 0ms
memory: 8460kb

input:

1
9946
9946 9945 9944 9943 9942 9941 9940 9939 9938 9937 9936 9935 9934 9933 9932 9931 9930 9929 9928 9927 9926 9925 9924 9923 9922 9921 9920 9919 9918 9917 9916 9915 9914 9913 9912 9911 9910 9909 9908 9907 9906 9905 9904 9903 9902 9901 9900 9899 9898 9897 9896 9895 9894 9893 9892 9891 9890 9889 988...

output:

9946

result:

ok 1 number(s): "9946"

Test #46:

score: 10
Accepted
time: 3ms
memory: 8732kb

input:

1
9999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

9999

result:

ok 1 number(s): "9999"

Test #47:

score: 10
Accepted
time: 0ms
memory: 8728kb

input:

1
10000
4133 4419 7369 1338 178 4879 4187 1648 244 9161 1207 3751 725 726 9982 5876 6524 2046 3271 1318 6809 2341 7493 2111 6553 7988 8934 7527 7273 9703 7234 3286 702 7211 7437 1004 7223 5682 4005 2854 1419 6347 9988 5639 2797 3916 9871 7698 8554 777 9990 361 3858 2893 9901 8507 8740 3400 9179 2651...

output:

509

result:

ok 1 number(s): "509"

Test #48:

score: 10
Accepted
time: 3ms
memory: 5948kb

input:

10
1000
999 997 998 996 991 994 990 989 986 987 6 988 980 9 981 982 983 985 978 979 7 975 976 977 971 973 974 969 970 967 966 47 962 963 964 965 35 957 960 961 951 952 953 954 956 950 944 945 947 30 948 943 23 942 941 19 940 12 939 938 11 936 937 52 932 935 931 926 927 929 930 925 923 924 921 918 91...

output:

504
116
508
503
504
107
507
91
91
507

result:

ok 10 numbers

Subtask #5:

score: 13
Accepted

Test #49:

score: 13
Accepted
time: 9ms
memory: 6176kb

input:

9000
8
4 1 2 3 5 6 7 8
12
1 2 12 3 4 5 6 7 8 9 10 11
15
4 1 13 2 15 3 5 6 7 8 9 10 11 12 14
15
4 5 10 14 1 2 3 6 7 8 9 11 12 13 15
9
4 1 2 3 5 6 7 8 9
13
1 4 9 12 2 3 5 6 7 8 10 11 13
14
1 10 2 3 4 5 6 7 8 9 11 12 13 14
15
1 6 7 2 3 4 5 8 9 10 11 12 13 14 15
12
1 4 6 10 12 2 3 5 7 8 9 11
8
7 8 1 2 3...

output:

8
12
13
12
9
11
14
14
9
7
12
15
6
13
8
9
8
11
10
5
7
9
11
12
8
6
14
6
6
10
6
9
8
13
6
14
13
5
6
5
9
13
6
12
14
8
4
13
12
8
9
9
11
9
13
6
6
5
11
11
11
6
5
14
13
14
12
6
14
8
8
9
7
9
15
10
7
14
8
11
5
6
8
12
9
8
12
8
9
10
8
6
10
11
10
15
12
11
12
7
8
7
9
7
13
6
12
5
7
9
10
8
13
6
7
8
13
12
10
5
9
10
7...

result:

ok 9000 numbers

Test #50:

score: 13
Accepted
time: 25ms
memory: 5832kb

input:

10000
20
1 9 12 13 17 2 18 19 3 4 5 6 7 8 10 11 14 15 16 20
20
1 2 5 9 17 18 3 4 6 7 8 10 11 12 13 14 15 16 19 20
20
8 9 10 13 1 2 3 4 5 6 7 11 12 14 15 16 17 18 19 20
20
9 10 13 1 2 3 4 5 6 7 8 11 12 14 15 16 17 18 19 20
20
8 1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20
20
1 9 13 2 16 3 4 5 6 7...

output:

15
17
17
18
20
18
14
15
17
13
18
17
15
20
19
15
17
18
20
19
18
18
16
16
16
16
19
15
16
18
17
15
18
20
17
20
18
19
19
16
18
14
16
20
18
20
16
19
18
18
17
20
20
16
17
16
17
16
16
19
20
18
19
16
15
19
17
17
18
17
18
20
15
16
16
20
17
18
15
19
17
17
14
17
18
18
17
19
19
18
18
17
19
13
18
18
16
14
16
19
...

result:

ok 10000 numbers

Test #51:

score: 13
Accepted
time: 1ms
memory: 7968kb

input:

1
200
3 4 1 15 85 2 95 162 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 96 97 98 99 10...

output:

196

result:

ok 1 number(s): "196"

Test #52:

score: 13
Accepted
time: 45ms
memory: 7136kb

input:

10
20000
115 194 264 325 497 569 825 835 955 1036 1174 1292 1382 1436 1440 1580 1642 1845 1968 2013 2092 2214 2274 2400 2573 2763 2791 2809 2838 2891 3127 3239 3240 3296 3447 3602 3765 3903 4009 4095 4133 4200 4237 4368 4573 4590 4692 4714 4825 5028 5073 5380 5457 5479 5497 5730 5884 5896 6001 6316 ...

output:

19795
19803
19805
19824
19820
19793
19779
19789
19813
19819

result:

ok 10 numbers

Test #53:

score: 13
Accepted
time: 61ms
memory: 18628kb

input:

1
200000
43 244 280 312 395 651 712 785 851 1098 1112 1133 1140 1227 1236 1296 1515 1568 1661 1709 1829 1972 1982 1983 2079 2174 2248 2302 2362 2380 2400 2464 2518 2524 2547 2675 2790 2818 2842 3001 3140 3159 3394 3571 3625 3641 3659 3709 3754 3800 3851 3875 4104 4124 4214 4237 4372 4415 4437 4450 4...

output:

197953

result:

ok 1 number(s): "197953"

Test #54:

score: 13
Accepted
time: 54ms
memory: 18172kb

input:

1
191371
4 21 75 1 83 87 110 162 183 220 283 299 309 314 328 363 377 385 2 409 411 434 450 482 3 484 514 521 522 555 583 600 624 645 653 664 685 696 733 5 736 752 796 813 814 843 848 851 866 913 942 954 965 974 1097 1142 1149 1169 1180 1228 1230 1235 1284 1332 1361 1364 1383 1389 1397 1415 1427 1487...

output:

181716

result:

ok 1 number(s): "181716"

Test #55:

score: 13
Accepted
time: 55ms
memory: 18628kb

input:

1
199365
6 7 1 13 2 16 17 3 19 47 61 69 90 4 95 118 120 154 157 161 171 181 201 206 5 213 8 275 286 290 301 318 324 326 9 339 342 351 10 371 376 403 407 408 419 420 440 457 11 465 468 495 507 515 519 525 534 538 542 545 561 564 12 565 572 584 586 601 610 628 643 14 652 657 660 669 15 674 692 695 706...

output:

179477

result:

ok 1 number(s): "179477"

Test #56:

score: 13
Accepted
time: 59ms
memory: 18608kb

input:

1
199909
1 3 2 5 6 4 8 13 7 14 16 18 22 9 23 10 25 27 11 30 12 31 33 34 15 38 40 17 41 42 43 44 19 46 20 47 21 49 24 50 26 54 28 57 29 59 32 60 62 63 65 35 66 67 68 70 71 36 73 74 77 78 37 79 39 81 82 45 85 48 88 93 51 94 52 95 98 105 53 106 108 55 112 56 114 58 120 61 123 64 124 69 125 72 127 75 13...

output:

100224

result:

ok 1 number(s): "100224"

Test #57:

score: 13
Accepted
time: 56ms
memory: 18956kb

input:

1
199994
4 129 1 151 195 213 2 229 247 252 324 392 497 581 601 676 710 751 767 774 790 816 915 990 1116 1133 1160 1214 1216 1222 1356 1380 1390 1485 1683 1695 1820 1833 1894 3 1908 1911 1918 2077 2082 2167 2263 2380 2407 2436 2438 2444 2456 2473 2478 2583 2659 2694 2712 2714 2737 2908 2914 3095 3121...

output:

195992

result:

ok 1 number(s): "195992"

Test #58:

score: 13
Accepted
time: 57ms
memory: 18608kb

input:

1
199999
5 12 33 84 85 100 107 141 166 182 200 232 320 325 408 444 460 492 497 523 532 544 553 567 579 590 600 629 648 696 707 709 742 758 761 799 801 810 835 836 852 867 872 1 877 930 959 981 1023 1030 1064 2 1071 1093 1133 1163 1166 1195 1200 1201 1215 1240 1252 1268 1279 1303 1320 1339 1349 1357 ...

output:

189922

result:

ok 1 number(s): "189922"

Test #59:

score: 13
Accepted
time: 44ms
memory: 5996kb

input:

100
2000
18 46 54 76 125 131 154 155 171 179 211 1 225 294 301 319 358 378 385 407 419 480 515 535 602 2 604 605 612 648 671 674 676 685 718 753 858 863 874 947 967 1008 1035 1049 1095 1102 1151 1177 1210 3 1231 1269 1290 1293 1316 1326 1348 1349 1352 1354 1388 1404 1417 1433 1437 1454 1457 1472 4 1...

output:

1907
1896
1905
1909
1924
1910
1890
1894
1894
1900
1907
1906
1898
1891
1901
1902
1902
1889
1890
1899
1926
1896
1910
1884
1897
1892
1910
1885
1896
1918
1891
1909
1894
1906
1902
1904
1892
1881
1911
1894
1897
1903
1906
1916
1906
1902
1913
1895
1903
1898
1889
1904
1911
1913
1908
1893
1886
1907
1919
1916
...

result:

ok 100 numbers

Test #60:

score: 13
Accepted
time: 34ms
memory: 8012kb

input:

1000
200
5 11 14 18 1 21 27 34 37 52 57 98 2 110 3 111 120 122 123 125 130 174 175 182 188 4 6 7 8 9 10 12 13 15 16 17 19 20 22 23 24 25 26 28 29 30 31 32 33 35 36 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 8...

output:

179
183
181
178
188
187
175
177
182
183
184
186
180
175
180
179
178
178
188
185
186
180
174
178
180
186
177
186
181
180
174
186
185
185
182
176
190
185
180
175
180
185
181
183
179
186
180
175
181
179
183
183
174
178
179
183
187
183
186
180
182
181
182
185
179
177
178
179
173
179
182
179
181
180
183
...

result:

ok 1000 numbers

Test #61:

score: 13
Accepted
time: 74ms
memory: 18668kb

input:

1
200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

200000

result:

ok 1 number(s): "200000"

Subtask #6:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #62:

score: 20
Accepted
time: 30ms
memory: 7924kb

input:

25000
8
5 4 6 3 8 7 2 1
8
2 7 4 1 3 8 6 5
8
5 3 7 4 1 6 2 8
8
6 1 2 3 5 4 7 8
8
4 3 2 1 6 7 8 5
8
1 2 7 3 8 6 4 5
8
7 5 8 3 6 2 1 4
8
8 2 6 4 3 7 5 1
8
4 6 5 1 3 7 8 2
8
4 7 8 5 6 2 1 3
8
4 5 2 3 7 6 8 1
8
2 3 5 4 8 1 6 7
8
8 2 4 7 1 6 3 5
8
1 7 8 6 4 5 3 2
8
2 5 1 4 8 6 7 3
8
3 5 4 8 7 2 1 6
8
4 6 ...

output:

7
6
6
8
7
7
6
7
7
6
6
7
7
7
6
7
6
6
7
7
7
6
6
8
6
6
7
7
6
6
5
7
7
8
7
7
8
7
7
8
6
6
6
6
6
7
6
7
7
5
6
8
7
7
6
7
6
8
8
6
8
7
7
7
7
7
8
6
7
7
7
7
6
7
7
6
6
7
8
6
7
7
7
5
8
7
6
8
6
6
6
6
6
8
6
6
8
6
7
8
7
6
7
6
7
7
8
8
6
7
7
5
8
8
7
8
7
7
6
6
7
7
7
6
7
6
7
7
6
7
7
8
7
7
6
7
7
6
8
8
7
7
5
7
7
8
7
5
8
6
...

result:

ok 25000 numbers

Test #63:

score: 20
Accepted
time: 30ms
memory: 7920kb

input:

20000
10
9 2 8 3 10 4 1 7 5 6
10
5 10 3 9 2 1 8 4 7 6
10
2 7 10 9 6 1 5 3 4 8
10
2 8 9 10 5 7 1 4 3 6
10
9 4 1 8 3 7 2 5 6 10
10
10 3 4 8 9 1 2 5 7 6
10
10 7 8 1 6 4 2 5 9 3
10
4 5 8 9 6 1 3 2 7 10
10
1 3 7 8 10 6 9 4 2 5
10
8 1 4 7 6 2 5 10 9 3
10
4 9 5 7 10 3 2 6 1 8
10
10 4 8 7 3 5 2 9 6 1
10
10 ...

output:

8
6
8
7
8
7
9
8
9
8
9
9
8
8
6
8
8
7
9
8
7
7
7
7
8
7
9
8
8
7
7
6
7
7
9
7
8
9
8
9
7
8
7
7
8
8
7
8
8
8
8
9
9
7
8
7
7
8
8
7
7
8
9
7
7
9
8
8
8
9
6
8
7
7
7
8
8
7
7
7
7
7
7
6
7
8
8
8
7
8
7
9
8
9
8
7
9
8
8
8
8
8
7
8
7
7
7
8
7
8
9
7
8
8
8
8
9
7
6
8
8
8
10
6
8
8
8
7
8
8
9
7
7
8
10
9
8
7
8
6
7
8
8
7
8
7
7
8
8
...

result:

ok 20000 numbers

Test #64:

score: 20
Accepted
time: 39ms
memory: 8192kb

input:

2000
100
52 23 33 90 27 13 16 8 2 64 99 18 12 56 1 49 83 76 51 38 5 6 81 24 50 43 62 34 3 75 7 46 69 68 59 65 91 54 40 71 35 15 96 11 45 31 47 93 17 10 25 77 67 73 36 41 72 26 48 98 87 4 32 29 39 92 85 78 44 21 79 28 58 20 82 57 61 89 9 84 100 74 14 55 66 19 86 22 70 95 42 37 94 60 53 63 30 97 88 80...

output:

27
27
27
34
27
30
26
28
28
23
30
32
28
27
25
28
28
25
24
28
31
27
28
25
29
30
31
26
29
28
30
29
26
28
29
28
27
31
26
31
31
30
29
27
25
31
31
28
26
27
29
27
29
25
27
29
29
29
28
30
29
28
31
31
27
29
28
26
27
28
27
27
32
26
27
27
30
32
29
29
26
31
28
30
27
32
30
31
30
28
26
30
29
27
27
25
27
31
29
28
...

result:

ok 2000 numbers

Test #65:

score: 20
Accepted
time: 47ms
memory: 8232kb

input:

200
1000
436 949 569 913 83 61 626 434 355 802 544 988 764 277 484 752 354 750 732 565 150 993 916 820 776 435 489 758 122 288 737 502 115 268 957 21 631 90 570 962 179 54 19 545 726 371 733 341 356 757 177 117 82 118 909 868 271 540 730 662 828 791 751 786 712 821 577 185 643 162 236 766 353 205 41...

output:

97
92
94
91
98
94
93
86
94
91
93
93
90
94
89
95
90
89
88
94
94
102
93
86
95
93
91
89
90
92
94
90
91
88
89
90
92
85
94
91
93
92
92
95
85
95
93
89
88
88
88
90
87
96
92
94
95
85
92
87
93
89
90
89
88
94
91
85
89
87
89
92
89
95
92
92
89
96
97
94
90
88
88
90
89
91
89
96
87
88
87
92
92
89
91
93
91
94
85
90...

result:

ok 200 numbers

Test #66:

score: 20
Accepted
time: 63ms
memory: 8548kb

input:

20
10000
4136 3094 8864 6778 308 1571 2443 7133 3787 831 7621 9466 6453 7663 5411 3207 4394 3139 4133 5777 5766 9452 4956 1793 4134 3463 3868 83 8340 9494 1086 1694 6082 1141 2794 7186 4880 340 4783 3170 208 1117 9061 7930 8766 9976 9962 3100 4684 1432 3935 3904 5404 3248 7266 3859 2056 1158 1522 30...

output:

282
287
281
281
292
283
279
287
280
286
287
285
296
290
287
290
280
278
304
292

result:

ok 20 numbers

Test #67:

score: 20
Accepted
time: 91ms
memory: 18628kb

input:

1
200000
2267 197795 44179 28889 183445 135430 11261 73174 162870 24455 158632 112209 71528 44817 170101 108676 61286 149626 23262 19770 164092 158160 160631 183782 79740 95331 5768 121145 123860 198063 126655 136246 113534 187046 116778 161933 3294 119909 77018 23993 182300 198020 138054 38856 2297...

output:

1256

result:

ok 1 number(s): "1256"

Test #68:

score: 20
Accepted
time: 87ms
memory: 18236kb

input:

1
192176
131261 47790 150900 99375 30338 171180 36002 58378 102066 157012 79297 152228 118108 189548 73572 142496 169055 93094 116405 25785 135685 131711 36867 167180 55733 54418 87417 94409 85521 164908 168000 188778 34417 14978 22009 8863 164040 32195 126622 29474 23854 157944 106404 92260 170050 ...

output:

1244

result:

ok 1 number(s): "1244"

Test #69:

score: 20
Accepted
time: 95ms
memory: 18656kb

input:

1
199853
138662 17589 192309 91977 179208 9317 3631 134837 181921 18392 84619 21687 70157 147365 16048 159348 181885 144959 165891 134750 101595 178466 118923 151764 18762 81491 164614 151754 174784 52896 126882 115376 5281 179733 65162 144995 17557 97741 66464 101765 61430 138574 195810 119837 1375...

output:

1252

result:

ok 1 number(s): "1252"

Test #70:

score: 20
Accepted
time: 30ms
memory: 13024kb

input:

1
94559
1 4 6 7 94556 8 10 94553 94552 94551 94550 12 14 94547 15 94545 94542 94541 17 18 94539 22 23 28 94536 30 94533 94534 31 94530 32 94529 94528 94526 94525 94519 94517 94516 33 35 38 94514 94513 94512 39 94511 94510 94509 40 94507 94506 42 94503 43 44 46 47 94501 94500 94499 49 94497 94494 944...

output:

93626

result:

ok 1 number(s): "93626"

Test #71:

score: 20
Accepted
time: 39ms
memory: 15036kb

input:

1
133630
3 4 133630 133627 6 133621 133619 133616 10 14 17 18 133615 19 133612 133611 22 133610 133607 23 24 133606 133604 26 28 133602 133598 133597 133596 29 31 32 133592 34 35 36 133591 133588 133586 39 133582 133585 133581 41 133580 133578 133576 42 133573 43 45 133572 47 49 133571 50 133569 52 ...

output:

132260

result:

ok 1 number(s): "132260"

Test #72:

score: 20
Accepted
time: 73ms
memory: 18948kb

input:

1
200000
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 1999...

output:

200000

result:

ok 1 number(s): "200000"

Test #73:

score: 20
Accepted
time: 64ms
memory: 18716kb

input:

1
200000
1 4 5 10 13 14 15 17 19 21 200000 199999 199997 199993 199992 199990 199989 199984 199983 199982 199981 199980 199979 199977 199975 199973 199967 199965 199964 199961 199960 199959 199957 199954 199952 199951 199950 199949 199947 199945 199943 199941 199940 199939 199938 199935 199934 19993...

output:

199975

result:

ok 1 number(s): "199975"

Test #74:

score: 20
Accepted
time: 35ms
memory: 7924kb

input:

2000
100
1 2 3 4 5 7 11 12 13 14 99 98 97 94 92 91 86 85 84 80 81 77 76 74 73 72 71 68 65 63 62 58 61 57 56 53 42 51 37 36 32 31 28 27 25 24 16 21 23 26 29 30 33 35 34 38 39 40 41 43 44 45 46 47 49 48 50 52 54 55 59 60 64 66 67 69 70 75 78 79 83 82 88 87 90 89 93 96 95 100 22 20 19 18 17 15 10 9 6 8...

output:

90
85
86
87
84
86
81
83
88
87
89
93
87
85
85
89
91
82
87
90
81
91
85
86
85
92
88
77
78
91
94
85
89
87
86
88
84
84
92
88
91
87
85
92
88
88
84
87
87
88
94
84
83
86
86
88
88
85
84
87
92
80
82
80
91
89
85
84
87
92
91
91
92
90
86
84
91
91
85
86
80
89
89
83
93
87
86
82
82
89
88
92
85
84
85
84
93
89
85
85
...

result:

ok 2000 numbers

Test #75:

score: 20
Accepted
time: 68ms
memory: 18948kb

input:

1
200000
199997 199998 1 2 15 199989 199990 199993 13 7 6 17 27 20 28 34 35 199994 41 199988 36 199984 199985 199987 45 199976 199978 199981 47 56 199983 199964 199965 53 199967 50 49 199969 199973 199975 199963 199962 57 199960 60 199961 199959 199952 199955 59 199949 199943 58 199945 199946 61 69 ...

output:

100001

result:

ok 1 number(s): "100001"

Test #76:

score: 20
Accepted
time: 64ms
memory: 7168kb

input:

10
20000
7521 9735 11905 19994 14279 3014 17975 20000 1424 19987 13467 5023 5570 13538 19980 11833 19981 15073 18832 14049 27 10546 4361 19972 15611 15541 19142 17574 7114 19951 9396 14482 19974 14813 82 2354 14686 7752 18339 19979 16351 8654 3501 1789 2744 11069 13385 3506 19964 1742 3963 6579 1996...

output:

2532
10003
10003
1085
10004
10004
10004
887
10003
10005

result:

ok 10 numbers

Test #77:

score: 20
Accepted
time: 35ms
memory: 7932kb

input:

2000
100
3 100 97 98 99 91 1 92 94 4 88 87 84 6 85 86 9 7 13 82 83 20 81 79 14 80 26 78 33 75 30 36 74 35 71 73 70 53 64 51 67 62 42 40 50 52 37 56 58 54 59 60 49 48 61 47 46 57 55 63 65 44 45 38 69 39 41 43 32 34 31 68 66 29 28 76 72 90 25 27 22 23 24 89 18 77 95 19 21 15 16 17 93 10 11 12 2 5 8 96...

output:

56
54
52
53
31
32
56
53
55
33
28
38
53
31
34
56
53
29
58
30
55
53
54
54
32
56
33
33
33
54
53
57
56
56
59
51
32
53
52
53
53
32
56
56
59
30
54
31
55
54
54
33
59
33
29
57
54
53
55
55
31
28
54
52
29
55
55
28
53
54
28
55
53
53
53
55
37
30
36
54
56
54
57
53
53
59
27
35
34
55
53
35
54
58
54
34
26
54
28
30
...

result:

ok 2000 numbers

Extra Test:

score: 0
Extra Test Passed