QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#668234#6339. CookiesL_Hospital_#100 ✓148ms302968kbC++142.2kb2024-10-23 12:55:122024-10-23 12:55:13

Judging History

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

  • [2024-10-23 12:55:13]
  • 评测
  • 测评结果:100
  • 用时:148ms
  • 内存:302968kb
  • [2024-10-23 12:55:12]
  • 提交

answer

#include<bits/stdc++.h>
# define int long long
# define rep(i, j, k) for (int i = j; i <= k; ++i)
# define id(i, j) (plc[i] + (j))
using namespace std;

bitset < 15005 > ok[300005];
int n, a[15005], st[15005], pre[15005], sum, m, b[15005], can[15005];
int plc[15005], len[15005];
int stk[15005], r;
int now[15005], pos[15005];
bool cmp(int x, int y){return a[x] > a[y];}
signed main()
{
	//freopen("ex_3.in", "r", stdin);
//	freopen("c.out", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
	cin >> n;
	rep(i, 1, n) cin >> a[i], st[i] = i;
	sort(st + 1, st + n + 1, cmp);
    rep(i, 1, n) pre[i] = pre[i - 1] + a[st[i]], sum += a[i];
	cin >> m;
	rep(i, 1, m) cin >> b[i], can[b[i]] = 1;
	rep(i, 2, sum + 1) plc[i] = plc[i - 1] + (len[i - 1] = sum / (i - 1)) + 1;
	ok[id(sum + 1, 0)][sum] = 1;
	len[sum + 1] = 0;
//	rep(i, 1, n) cout << plc[i] << endl;
    for (int i = sum + 1; i; --i)
    {
        if (i <= sum) rep(j, 0, len[i]) ok[id(i, j)] = ((ok[id(i, j)] >> pre[i]) << pre[i]);
        if (can[i]) rep(j, 1, len[i]) ok[id(i, j)] |= ok[id(i, j - 1)];// cerr << "fdsfds" << i << endl;}
        if (i > 1) rep(j, 0, len[i]) ok[id(i - 1, j)] = (ok[id(i, j)] >> j);
//        rep(j, 0, len[i]) cout << i << ' ' << j << ' ' << ok[id(i, j)] << '\n';
    }
    rep(x, a[st[1]], sum) if (ok[id(1, x)][x])
    {
        cout << x << '\n';
        int ppt = x;
        rep(i, 1, sum)
        {
            if (can[i]) while (x > 0 && ok[id(i, x - 1)][ppt]) stk[++r] = i, --x;
            ppt += x;
        }
  //      cerr << "OK" << endl;
        x = r;
        rep(i, 1, n) pos[i] = st[i], now[i] = a[st[i]];
   //     rep(i, 1, r) cout << stk[i] << ' '; cout << endl;
        rep(i, 1, x)
        {
            cout << stk[i] << ' ';
            rep(j, 1, stk[i]) cout << pos[j] << ' ', --now[j];
            cout << '\n';
    //        cout << "gfdgfdgfd" << endl;
            int le = stk[i], re = stk[i], asd = now[stk[i]];
            while (le > 1 && now[le - 1] == asd) --le;
            while (re < n && now[re + 1] == asd + 1) ++re;
            for (; le < re; ++le, --re) swap(now[le], now[re]), swap(pos[le], pos[re]);
        }
        return 0;
    }
    cout << "-1\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 1ms
memory: 5648kb

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

score: 6
Accepted
time: 0ms
memory: 3672kb

input:

2
1 1
1
1

output:

2
1 1 
1 2 

result:

ok good!

Test #3:

score: 6
Accepted
time: 1ms
memory: 5688kb

input:

2
1 1
1
2

output:

1
2 1 2 

result:

ok good!

Test #4:

score: 6
Accepted
time: 0ms
memory: 3668kb

input:

2
1 1
2
1 2

output:

1
2 1 2 

result:

ok good!

Test #5:

score: 6
Accepted
time: 1ms
memory: 5672kb

input:

4
1 1 1 1
2
2 3

output:

2
2 1 2 
2 4 3 

result:

ok good!

Test #6:

score: 6
Accepted
time: 1ms
memory: 5692kb

input:

8
1 1 1 1 1 1 1 1
3
1 4 5

output:

2
4 1 2 3 4 
4 8 7 6 5 

result:

ok good!

Test #7:

score: 6
Accepted
time: 5ms
memory: 11892kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

500
1 329 
1 158 
1 344 
1 159 
1 343 
1 160 
1 342 
1 161 
1 341 
1 162 
1 340 
1 163 
1 339 
1 164 
1 338 
1 165 
1 337 
1 166 
1 336 
1 167 
1 335 
1 168 
1 334 
1 169 
1 333 
1 170 
1 332 
1 171 
1 331 
1 1 
1 330 
1 173 
1 345 
1 174 
1 328 
1 175 
1 327 
1 176 
1 326 
1 177 
1 325 
1 178 
1 32...

result:

ok good!

Test #8:

score: 6
Accepted
time: 4ms
memory: 11804kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1
500 329 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 345 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 360 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 313 359 358 357 356 355 354 353 352 351 350 349 348 347 346 266 281 280 279 278 277 276 275 274 273 27...

result:

ok good!

Test #9:

score: 6
Accepted
time: 4ms
memory: 12192kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

2
1 329 
499 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 141 221 222 223 224 225 226 227 228 229 230 2...

result:

ok good!

Test #10:

score: 6
Accepted
time: 4ms
memory: 12268kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #11:

score: 6
Accepted
time: 4ms
memory: 11836kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

11
40 329 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 345 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 360 375 374 373 372 371 370 369 
46 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 ...

result:

ok good!

Test #12:

score: 6
Accepted
time: 4ms
memory: 10636kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

250
2 329 344 
2 158 159 
2 343 342 
2 160 161 
2 341 340 
2 162 163 
2 339 338 
2 164 165 
2 337 336 
2 166 167 
2 335 334 
2 168 169 
2 333 332 
2 170 171 
2 331 330 
2 1 173 
2 345 328 
2 174 175 
2 327 326 
2 176 177 
2 325 324 
2 178 179 
2 323 322 
2 180 181 
2 321 320 
2 182 183 
2 319 318 
2...

result:

ok good!

Test #13:

score: 6
Accepted
time: 4ms
memory: 11824kb

input:

484
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

22
22 318 333 332 331 330 329 328 327 326 325 324 323 322 321 320 319 334 317 316 315 314 313 
22 153 154 155 156 157 158 159 160 161 162 163 164 165 166 1 168 169 170 171 172 173 174 
22 312 311 310 309 308 307 306 305 304 349 363 362 361 360 359 358 357 356 355 354 353 352 
22 175 176 177 178 179 ...

result:

ok good!

Test #14:

score: 6
Accepted
time: 5ms
memory: 11924kb

input:

495
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

55
9 325 340 339 338 337 336 335 334 333 
9 157 158 159 160 161 162 163 164 165 
9 332 331 330 329 328 327 326 341 324 
9 166 167 168 169 170 1 172 173 174 
9 323 322 321 320 319 318 317 316 315 
9 175 176 177 178 179 180 181 182 183 
9 314 313 312 311 356 371 370 369 368 
9 184 185 171 126 127 128 ...

result:

ok good!

Test #15:

score: 6
Accepted
time: 0ms
memory: 11888kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
125 329 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 345 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 360 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 313 359 358 357 356 355 354 353 352 351 350 349 348 347 346 266 281 280 279 278 277 276 275 274 273 27...

result:

ok good!

Test #16:

score: 6
Accepted
time: 4ms
memory: 11796kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

27
5 328 343 342 341 340 
5 158 159 160 161 162 
5 339 338 337 336 335 
5 163 164 165 166 167 
17 334 333 332 331 330 329 344 327 326 325 324 323 322 321 320 319 318 
21 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 
21 317 316 315 314 313 359 374 373 372 371 370 ...

result:

ok good!

Test #17:

score: 6
Accepted
time: 4ms
memory: 11904kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

19
13 328 343 342 341 340 339 338 337 336 335 334 333 332 
27 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 
27 331 330 329 344 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 359 374 373 372 371 370 369 368 
27 185 186 187 172 ...

result:

ok good!

Test #18:

score: 6
Accepted
time: 0ms
memory: 12072kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

7
18 328 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 344 327 
64 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 1...

result:

ok good!

Test #19:

score: 6
Accepted
time: 4ms
memory: 11968kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
56 328 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 344 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 359 374 373 372 371 370 369 368 367 366 365 364 363 362 361 360 312 358 357 356 355 354 353 352 
56 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 1...

result:

ok good!

Test #20:

score: 6
Accepted
time: 0ms
memory: 10520kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

2
11 328 343 342 341 340 339 338 337 336 335 334 
488 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 141 ...

result:

ok good!

Test #21:

score: 6
Accepted
time: 4ms
memory: 11800kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #22:

score: 6
Accepted
time: 0ms
memory: 12304kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #23:

score: 6
Accepted
time: 4ms
memory: 11816kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
1 324 
1 156 
1 339 
1 157 
1 338 
1 158 
1 337 
1 159 
1 336 
1 160 
1 335 
1 161 
1 334 
1 162 
1 333 
1 163 
477 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 309 354 353 352 351 350 3...

result:

ok good!

Test #24:

score: 6
Accepted
time: 0ms
memory: 11876kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
1 324 
1 156 
1 339 
1 157 
1 338 
1 158 
1 337 
1 159 
1 336 
1 160 
1 335 
1 161 
1 334 
1 162 
1 333 
1 163 
477 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 309 354 353 352 351 350 3...

result:

ok good!

Test #25:

score: 6
Accepted
time: 0ms
memory: 11952kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 
16 156 157 158 159 160 161 162 163 164 165 166 167 168 169 1 171 
16 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 
16 172 173 174 175 176 177 178 179 180 181 182 183 184 170 125 126 
16 370 369 368 367 366 365 ...

result:

ok good!

Test #26:

score: 6
Accepted
time: 4ms
memory: 11896kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 
16 156 157 158 159 160 161 162 163 164 165 166 167 168 169 1 171 
16 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 
16 172 173 174 175 176 177 178 179 180 181 182 183 184 170 125 126 
16 370 369 368 367 366 365 ...

result:

ok good!

Test #27:

score: 6
Accepted
time: 0ms
memory: 11852kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 
16 156 157 158 159 160 161 162 163 164 165 166 167 168 169 1 171 
16 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 
16 172 173 174 175 176 177 178 179 180 181 182 183 184 170 125 126 
16 370 369 368 367 366 365 ...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 1ms
memory: 5632kb

input:

1
15
1
1

output:

15
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 

result:

ok good!

Test #29:

score: 7
Accepted
time: 3ms
memory: 11828kb

input:

1
500
1
1

output:

500
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #30:

score: 7
Accepted
time: 4ms
memory: 56828kb

input:

1
3000
1
1

output:

3000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
...

result:

ok good!

Test #31:

score: 7
Accepted
time: 67ms
memory: 301364kb

input:

1
15000
1
1

output:

15000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 ...

result:

ok good!

Test #32:

score: 7
Accepted
time: 1ms
memory: 5628kb

input:

2
2 1
1
1

output:

3
1 1 
1 1 
1 2 

result:

ok good!

Test #33:

score: 7
Accepted
time: 0ms
memory: 3660kb

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

score: 7
Accepted
time: 1ms
memory: 5676kb

input:

3
1 2 3
1
2

output:

3
2 3 2 
2 3 2 
2 3 1 

result:

ok good!

Test #35:

score: 7
Accepted
time: 0ms
memory: 3692kb

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

score: 7
Accepted
time: 0ms
memory: 3708kb

input:

3
2 2 2
1
2

output:

3
2 1 2 
2 3 2 
2 3 1 

result:

ok good!

Test #37:

score: 7
Accepted
time: 2ms
memory: 12312kb

input:

15
50 49 48 47 46 45 44 43 42 41 40 2 1 1 1
1
10

output:

50
10 1 2 3 4 5 6 7 8 9 10 
10 1 2 3 4 5 6 7 8 9 10 
10 1 2 3 4 5 6 7 8 9 11 
10 1 2 3 4 5 6 7 8 11 9 
10 1 2 3 4 5 6 7 8 10 9 
10 1 2 3 4 5 6 7 8 10 11 
10 1 2 3 4 5 6 7 11 10 8 
10 1 2 3 4 5 6 7 9 8 10 
10 1 2 3 4 5 6 7 9 11 10 
10 1 2 3 4 5 6 7 9 11 8 
10 1 2 3 4 5 6 8 11 9 7 
10 1 2 3 4 5 6 10 7...

result:

ok good!

Test #38:

score: 7
Accepted
time: 0ms
memory: 11752kb

input:

15
51 49 48 47 46 45 44 43 42 41 40 1 1 1 1
1
10

output:

-1

result:

ok no solution

Test #39:

score: 7
Accepted
time: 76ms
memory: 302764kb

input:

10
430 3078 390 349 3750 906 377 3374 1795 551
1
4

output:

3750
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9 
4 5 8 2 9...

result:

ok good!

Test #40:

score: 7
Accepted
time: 102ms
memory: 301212kb

input:

500
4 99 56 16 7 39 5 8 3 18 15 30 19 27 46 47 24 55 1 7 21 1 13 5 53 32 12 98 12 121 3 118 25 15 8 32 29 7 13 3 29 94 22 4 12 37 15 52 14 9 59 22 3 16 9 77 5 17 41 22 16 6 3 32 33 34 18 1 28 4 72 4 3 40 21 13 22 16 42 77 2 16 1 1 10 11 3 34 21 28 4 173 24 57 17 9 20 116 21 72 17 165 28 30 6 13 86 1...

output:

5000
3 238 92 383 
3 238 92 383 
3 238 92 251 
3 238 251 92 
3 238 383 92 
3 238 383 251 
3 238 251 383 
3 238 211 92 
3 238 92 211 
3 238 251 383 
3 238 383 251 
3 238 92 211 
3 238 211 92 
3 238 102 383 
3 238 251 383 
3 238 251 211 
3 238 102 92 
3 238 92 102 
3 238 383 251 
3 238 211 251 
3 238 ...

result:

ok good!

Test #41:

score: 7
Accepted
time: 98ms
memory: 302892kb

input:

500
30 23 12 48 4 11 119 12 15 24 33 9 22 46 42 7 18 49 9 1 43 3 4 43 31 11 4 7 33 30 13 5 36 3 20 2 40 37 7 1 8 43 34 12 2 37 99 38 59 36 24 18 68 23 9 24 33 1 13 10 12 2 7 7 1 5 73 7 7 32 2 13 7 49 41 20 160 69 11 61 25 35 15 22 32 66 47 45 34 14 12 7 9 43 4 42 2 24 29 16 11 6 5 5 8 11 42 3 48 20 ...

output:

200
75 496 284 77 297 336 316 7 470 435 489 195 447 319 196 264 265 47 335 389 197 200 449 434 366 233 131 144 401 223 446 238 484 474 397 433 383 303 67 115 391 355 236 398 305 114 442 78 368 116 53 163 404 443 86 226 458 497 493 364 327 127 467 388 267 80 465 126 175 274 49 381 209 407 298 121 
75...

result:

ok good!

Test #42:

score: 7
Accepted
time: 87ms
memory: 302584kb

input:

500
6 60 24 11 17 58 8 42 30 60 38 34 54 23 5 12 32 6 35 11 60 42 35 60 25 60 37 40 5 22 24 26 17 17 60 21 7 29 13 7 56 12 8 16 8 20 11 60 12 60 32 56 30 55 12 23 26 60 60 6 18 60 60 21 21 16 28 23 60 9 16 4 8 5 20 4 60 59 39 20 8 27 8 7 6 8 10 30 18 15 60 60 41 48 17 24 17 60 10 42 6 13 22 21 14 18...

output:

60
250 242 196 197 200 213 223 226 234 241 187 246 248 253 272 273 280 283 289 137 77 91 92 98 108 128 129 131 290 139 144 146 147 159 170 178 180 452 418 420 421 425 426 439 446 450 400 455 460 466 479 480 485 491 500 339 292 302 306 314 321 325 329 330 2 342 353 359 363 383 388 396 69 50 24 35 10 ...

result:

ok good!

Test #43:

score: 7
Accepted
time: 94ms
memory: 297164kb

input:

122
121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 ...

output:

122
121 77 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 93 76 75 74 73 72 71 70 69 68 67 66 65 64 63 108 122 121 120 119 118 117 116 115 114 113 112 111 110 109 62 107 106 105 104 103 102 101 100 99 98 97 96 95 94 16 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 32 15 14 13 12 11 10 9 8 7 6 5 4 3 2 4...

result:

ok good!

Test #44:

score: 7
Accepted
time: 4ms
memory: 18604kb

input:

498
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

3
332 328 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 344 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 359 374 373 372 371 370 369 368 367 366 365 364 363 362 361 360 312 358 357 356 355 354 353 352 351 350 349 348 347 346 345 265 280 279 278 277 276 275 274 273 272 27...

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

score: 12
Accepted
time: 0ms
memory: 3812kb

input:

2
7 8
2
1 2

output:

8
1 2 
2 2 1 
2 1 2 
2 2 1 
2 1 2 
2 2 1 
2 1 2 
2 2 1 

result:

ok good!

Test #46:

score: 12
Accepted
time: 1ms
memory: 5628kb

input:

3
5 4 6
2
2 3

output:

6
2 3 1 
2 3 1 
2 3 2 
3 2 3 1 
3 1 3 2 
3 2 3 1 

result:

ok good!

Test #47:

score: 12
Accepted
time: 1ms
memory: 5776kb

input:

3
4 2 9
3
1 2 3

output:

9
1 3 
1 3 
1 3 
1 3 
1 3 
2 3 1 
2 1 3 
3 3 1 2 
3 2 1 3 

result:

ok good!

Test #48:

score: 12
Accepted
time: 1ms
memory: 5636kb

input:

4
3 5 4 3
2
3 4

output:

5
3 2 3 1 
3 2 3 4 
3 2 4 3 
3 2 1 3 
3 2 1 4 

result:

ok good!

Test #49:

score: 12
Accepted
time: 1ms
memory: 5612kb

input:

4
1 4 5 5
3
1 3 4

output:

5
3 3 4 2 
3 3 4 2 
3 3 4 2 
3 3 4 2 
3 3 4 1 

result:

ok good!

Test #50:

score: 12
Accepted
time: 0ms
memory: 3788kb

input:

4
3 3 6 3
3
2 3 4

output:

6
2 3 1 
2 3 4 
2 3 2 
2 3 2 
3 3 1 4 
4 4 1 3 2 

result:

ok good!

Test #51:

score: 12
Accepted
time: 1ms
memory: 5688kb

input:

5
4 3 3 3 1
3
2 4 5

output:

4
2 1 2 
4 1 4 3 2 
4 1 4 3 2 
4 1 4 3 5 

result:

ok good!

Test #52:

score: 12
Accepted
time: 0ms
memory: 3840kb

input:

5
4 3 3 3 2
3
3 4 5

output:

4
3 1 2 3 
3 1 4 3 
4 1 4 5 2 
5 2 5 4 1 3 

result:

ok good!

Test #53:

score: 12
Accepted
time: 1ms
memory: 5684kb

input:

5
4 4 4 2 1
3
2 4 5

output:

5
2 1 2 
2 3 2 
2 3 1 
4 1 3 2 4 
5 4 2 3 1 5 

result:

ok good!

Test #54:

score: 12
Accepted
time: 0ms
memory: 3844kb

input:

5
3 3 3 3 3
3
1 2 4

output:

5
1 1 
2 5 4 
4 2 3 4 5 
4 2 3 1 5 
4 2 3 1 4 

result:

ok good!

Test #55:

score: 12
Accepted
time: 0ms
memory: 3776kb

input:

6
3 3 3 2 2 2
3
2 4 6

output:

-1

result:

ok no solution

Test #56:

score: 12
Accepted
time: 1ms
memory: 5688kb

input:

6
3 3 3 2 2 2
3
2 5 6

output:

3
5 1 2 3 4 5 
5 1 2 3 6 5 
5 1 2 3 6 4 

result:

ok good!

Test #57:

score: 12
Accepted
time: 1ms
memory: 5668kb

input:

6
4 4 3 2 1 1
3
1 3 5

output:

5
1 1 
1 2 
3 2 1 3 
5 3 1 2 4 5 
5 3 1 2 4 6 

result:

ok good!

Test #58:

score: 12
Accepted
time: 1ms
memory: 5632kb

input:

6
7 2 2 2 1 1
5
2 3 4 5 6

output:

7
2 1 2 
2 1 4 
2 1 3 
2 1 3 
2 1 6 
2 1 4 
3 1 5 2 

result:

ok good!

Test #59:

score: 12
Accepted
time: 1ms
memory: 5684kb

input:

7
3 3 3 2 2 1 1
3
1 4 6

output:

4
1 1 
4 3 2 1 4 
4 3 2 5 4 
6 3 2 5 7 6 1 

result:

ok good!

Test #60:

score: 12
Accepted
time: 0ms
memory: 3848kb

input:

7
4 4 3 1 1 1 1
3
1 4 6

output:

6
1 1 
1 2 
1 2 
4 3 1 2 4 
4 3 1 2 7 
4 3 1 5 6 

result:

ok good!

Test #61:

score: 12
Accepted
time: 1ms
memory: 5748kb

input:

8
2 2 2 2 2 2 2 1
6
1 2 3 4 6 7

output:

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

result:

ok good!

Test #62:

score: 12
Accepted
time: 1ms
memory: 5672kb

input:

8
3 3 3 2 1 1 1 1
4
4 6 7 8

output:

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

result:

ok good!

Test #63:

score: 12
Accepted
time: 1ms
memory: 5632kb

input:

8
4 3 3 1 1 1 1 1
4
1 6 7 8

output:

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

result:

ok good!

Test #64:

score: 12
Accepted
time: 0ms
memory: 3700kb

input:

9
4 3 2 1 1 1 1 1 1
4
3 4 5 7

output:

4
3 1 2 3 
3 1 2 3 
4 1 2 9 8 
5 1 4 5 6 7 

result:

ok good!

Test #65:

score: 12
Accepted
time: 0ms
memory: 3772kb

input:

12
3 2 1 1 1 1 1 1 1 1 1 1
9
1 4 5 6 7 8 9 10 11

output:

3
1 1 
4 1 2 3 4 
10 1 2 12 11 10 9 8 7 6 5 

result:

ok good!

Test #66:

score: 12
Accepted
time: 0ms
memory: 3812kb

input:

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

output:

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

result:

ok good!

Test #67:

score: 12
Accepted
time: 1ms
memory: 5624kb

input:

4
2 2 2 1
2
1 4

output:

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

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 0ms
memory: 12188kb

input:

150
24 12 11 10 9 9 9 9 9 8 8 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

25
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 22 23 
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 20 18 
18 1 2 3 4 5 6 7 8 9 10 11 21 19 17 18 20 16 15 
18 1 2 3 4 5 6 7 8 9 10 11 21 19 17 24 25 26 27 
18 1 2 3 4 5 6 7 8 9 14 13 12 23 22 31 36 35 34 
18 1 2 3 4 28 29 30 32 33 34 35 36 31 22 23 12 13 14...

result:

ok good!

Test #69:

score: 45
Accepted
time: 2ms
memory: 12300kb

input:

200
9 9 9 8 8 8 7 7 6 6 6 6 6 6 6 6 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

10
1 2 
9 1 3 2 4 5 6 7 8 11 
9 1 3 2 4 5 6 7 8 9 
9 1 3 2 4 5 6 16 15 14 
9 1 3 10 12 13 14 15 16 6 
78 1 3 10 12 13 17 19 20 21 22 23 24 25 26 18 11 7 8 9 2 4 5 6 16 15 14 30 44 43 42 41 40 39 38 37 35 34 33 32 31 36 29 28 27 59 60 61 62 63 64 65 66 67 68 69 70 71 50 57 45 46 47 48 49 58 52 53 54 ...

result:

ok good!

Test #70:

score: 45
Accepted
time: 0ms
memory: 11820kb

input:

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

output:

9
1 1 
1 1 
33 5 4 3 2 1 6 7 8 9 13 17 16 15 14 12 11 10 24 33 32 31 30 29 28 27 25 26 23 22 21 20 19 18 
33 5 4 3 2 1 6 7 8 9 13 17 16 15 14 12 11 10 18 19 20 21 22 23 26 25 27 28 29 30 31 32 33 24 
33 5 4 3 2 1 6 7 8 9 13 17 16 15 14 12 11 10 45 44 43 42 41 40 39 38 37 36 35 34 46 47 60 59 
33 5 4...

result:

ok good!

Test #71:

score: 45
Accepted
time: 4ms
memory: 10536kb

input:

300
8 6 6 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9
22 1 2 3 4 5 6 7 16 17 15 14 13 11 10 12 9 8 33 34 35 36 37 
23 1 2 3 4 5 6 7 16 17 15 14 13 11 10 12 9 8 24 30 29 28 27 26 
23 1 2 3 4 5 6 7 38 39 40 41 42 44 45 46 43 31 18 19 20 21 32 22 
23 1 2 3 25 23 22 32 21 20 19 18 31 43 46 45 44 42 41 40 39 38 7 6 
23 1 2 3 25 23 76 68 69 70 71 72 73 74 ...

result:

ok good!

Test #72:

score: 45
Accepted
time: 0ms
memory: 11912kb

input:

300
5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6
6 2 3 4 5 6 7 
6 1 7 6 5 4 3 
63 1 8 9 10 12 11 13 14 16 17 15 2 3 4 5 6 7 31 32 34 35 36 37 38 39 40 41 42 33 29 18 19 20 21 22 23 25 26 27 30 28 24 100 101 102 103 104 105 106 107 108 110 111 99 98 97 96 95 94 93 92 91 90 
63 1 8 9 10 12 11 13 14 16 17 15 2 3 4 5 6 7 31 32 34 35 36 37 38 39 40 4...

result:

ok good!

Test #73:

score: 45
Accepted
time: 4ms
memory: 11912kb

input:

350
5 5 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6
2 2 1 
2 1 2 
53 3 4 5 6 7 8 9 11 10 2 1 25 27 26 24 23 22 21 20 18 17 16 15 19 14 13 12 80 90 81 82 83 84 85 87 88 89 79 78 77 76 75 74 73 72 71 86 70 101 110 109 108 107 
53 3 4 5 6 7 8 9 11 10 2 1 25 27 26 24 23 22 21 20 18 17 16 15 19 14 13 12 58 51 52 69 53 54 55 56 57 59 60 61 62 63 64 65 66...

result:

ok good!

Test #74:

score: 45
Accepted
time: 0ms
memory: 10480kb

input:

70
51 39 26 24 21 18 16 15 15 12 11 10 10 9 9 9 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
14
1 14 15 17 26 27 34 35 41 44 48 58 62 65

output:

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

result:

ok good!

Test #75:

score: 45
Accepted
time: 0ms
memory: 11868kb

input:

70
22 22 20 19 18 15 14 13 13 13 12 12 12 12 12 12 11 11 10 9 9 9 9 9 9 9 8 8 8 8 8 7 6 6 6 6 6 5 5 5 5 5 5 5 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
9
1 3 7 9 16 17 62 68 69

output:

24
16 2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 
16 2 1 3 4 5 6 7 8 9 10 16 15 14 13 12 11 
16 2 1 3 4 5 6 7 8 9 10 18 17 11 12 13 14 
16 2 1 3 4 5 6 7 8 9 10 18 17 19 16 15 14 
17 2 1 3 4 5 6 7 8 9 10 18 17 19 16 15 26 25 
17 2 1 3 4 5 6 7 13 12 11 20 21 22 23 24 25 26 
17 2 1 3 4 5 6 7 13 12 11 20 21...

result:

ok good!

Test #76:

score: 45
Accepted
time: 3ms
memory: 11776kb

input:

40
61 55 33 31 28 26 26 23 21 20 18 15 13 11 11 10 9 9 8 8 7 7 7 6 4 4 4 4 3 3 2 2 2 2 2 1 1 1 1 1
9
1 12 18 20 24 29 30 32 40

output:

79
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
1 1 
1 2 
1 2 
1 1 
12 1 2 3 4 5 6 7 8 9 10 11 12 
12 1 2 3 4 5 6 7 8 9 10 11 12 
12 1 2 3 4 5 6 7 8 9 10 1...

result:

ok good!

Test #77:

score: 45
Accepted
time: 0ms
memory: 11836kb

input:

127
64 32 32 16 16 16 16 8 8 8 8 8 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
7
1 2 4 8 16 32 64

output:

64
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
4 1 2 3 4 
4 1 2 3 7 
4 1 2 3 5 
4 1 2 3 6 
4 1 2 3 6 
4 1 2 3 4 
4 1 2 3 5 
4 1 2 3 7 
4 1 2 3 7 
4 1 2 3 6 
4 1 2 3 5 
4 1 2 3 4 
4 1 2...

result:

ok good!

Test #78:

score: 45
Accepted
time: 3ms
memory: 12396kb

input:

10
31 67 31 15 21 37 53 96 81 68
4
1 2 8 10

output:

115
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 10 
2 8 10 
2 8 2 
2 8 9 
2 8 9 
2 8 10 
2 8 2 
2 8 2 
2 8 9 
2 8 10 
2 8 10 
2 8 2 
2 8 9 
2 8 9 
2 8 10 
2 8 2 
2 8 2 
2 8 9 
2 8 10 
2 8 10 
2 8 2 
2 8 9 
2 9 8 
2 10 2 
2 2 10 
2 9 8 
2 8 9 ...

result:

ok good!

Test #79:

score: 45
Accepted
time: 3ms
memory: 11768kb

input:

40
24 20 23 12 7 11 20 16 1 4 2 21 12 13 7 17 5 15 4 24 17 8 13 8 15 9 16 21 12 7 3 16 6 5 21 8 11 12 11 23
5
8 12 13 27 29

output:

24
8 1 20 3 40 35 28 12 2 
8 1 20 3 40 35 28 12 7 
8 1 20 3 40 7 12 28 35 
8 1 20 3 40 2 35 28 12 
8 1 20 3 40 2 7 12 28 
8 1 20 3 40 2 7 21 16 
8 1 20 3 40 35 16 21 7 
8 1 20 3 40 35 27 8 32 
13 1 20 2 28 12 32 8 27 35 40 3 7 21 
27 1 20 2 28 12 18 25 16 21 7 3 40 35 27 8 32 14 23 4 38 29 13 37 6 3...

result:

ok good!

Test #80:

score: 45
Accepted
time: 4ms
memory: 10684kb

input:

40
2 18 20 17 18 15 12 4 6 12 13 20 2 15 22 20 21 8 8 1 3 9 22 16 5 8 12 11 8 16 4 19 14 13 13 16 24 21 1 11
14
1 4 5 8 10 13 14 21 23 24 32 33 34 36

output:

24
1 37 
1 37 
4 37 23 15 38 
4 37 23 15 17 
8 17 15 23 37 38 3 12 16 
10 16 12 3 38 37 23 15 17 32 2 
10 16 12 3 38 37 23 15 17 32 5 
13 5 32 17 15 23 37 38 3 12 16 2 4 24 
14 5 32 17 15 23 37 38 3 12 16 2 4 36 30 
21 30 36 4 2 16 12 3 38 37 23 15 17 32 5 24 14 6 33 35 34 11 
21 30 36 4 2 16 12 3 3...

result:

ok good!

Test #81:

score: 45
Accepted
time: 4ms
memory: 10568kb

input:

130
5 1 7 5 7 6 4 2 4 2 7 1 5 1 1 7 4 3 3 4 3 5 1 5 5 2 1 6 5 2 7 2 1 2 3 1 1 6 1 5 3 2 1 5 7 6 5 2 5 3 5 4 2 3 1 3 2 4 6 6 1 3 4 7 6 2 7 1 7 7 5 7 2 3 1 2 2 4 4 1 3 4 7 3 7 3 6 1 1 3 3 6 5 7 4 1 4 5 3 3 5 4 4 6 1 3 2 6 4 7 3 4 2 6 1 2 7 7 7 6 5 6 7 5 2 2 2 2 7 2
7
26 43 55 69 82 116 125

output:

7
26 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 59 120 108 38 114 104 
43 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 6 87 92 122 28 60 65 46 104 114 38 108 120 59 71 93 1 98 51 13 49 47 4 
69 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 6 ...

result:

ok good!

Test #82:

score: 45
Accepted
time: 0ms
memory: 12364kb

input:

130
5 4 7 2 1 6 4 3 4 4 4 3 7 4 5 1 2 1 6 1 7 4 6 4 2 4 2 7 1 3 1 7 1 3 1 2 6 4 7 3 6 5 3 2 6 3 1 7 2 1 1 6 7 6 1 3 4 5 7 1 3 1 5 7 6 3 4 6 1 5 1 5 5 6 3 1 7 6 7 2 5 6 4 7 3 7 4 2 5 2 6 4 1 2 4 1 7 4 4 6 2 5 5 3 4 6 1 2 3 2 2 3 6 1 7 4 1 2 5 4 3 5 5 3 5 2 2 3 5 5
45
1 4 5 6 15 18 20 23 28 31 32 33 3...

output:

7
18 64 39 84 86 32 79 28 97 77 48 21 115 3 59 53 13 68 82 
31 64 39 84 86 32 79 28 97 77 48 21 115 3 59 53 13 52 113 106 19 74 54 23 100 78 45 6 91 65 37 41 
66 41 37 65 91 6 45 78 100 23 54 74 19 106 113 52 13 53 59 3 115 21 48 77 97 28 79 32 86 84 39 64 82 68 70 58 81 42 73 72 63 89 1 130 129 125...

result:

ok good!

Test #83:

score: 45
Accepted
time: 4ms
memory: 11924kb

input:

130
2 6 1 6 1 4 5 4 3 4 4 7 6 3 6 1 2 7 4 5 1 5 4 2 6 3 6 3 1 1 2 7 2 5 6 1 5 1 6 3 7 4 4 6 6 1 7 1 1 3 2 7 3 6 1 7 2 5 5 1 5 1 1 4 6 2 4 5 1 2 6 2 1 6 4 2 6 4 5 6 5 4 1 5 6 6 1 2 1 6 2 1 6 1 2 6 4 3 1 4 6 3 7 7 7 3 3 5 1 6 2 7 6 6 6 2 4 3 3 7 4 6 3 7 3 2 3 4 1 3
9
2 3 4 6 8 9 10 16 17

output:

30
8 52 32 112 41 120 47 105 104 
16 12 56 124 18 103 104 105 47 120 41 112 32 52 45 80 113 
17 12 56 124 18 103 115 4 27 25 13 15 122 114 96 101 54 2 
17 35 77 110 39 74 44 85 71 86 90 93 65 2 54 101 96 114 
17 35 77 110 39 74 44 85 71 86 90 93 65 108 22 37 20 34 
17 122 15 13 25 27 4 115 103 18 12...

result:

ok good!

Test #84:

score: 45
Accepted
time: 3ms
memory: 11756kb

input:

70
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5
20
1 2 3 4 6 7 8 9 10 13 21 24 30 31 33 40 45 46 54 70

output:

9
4 33 23 24 25 
46 21 20 19 18 17 16 15 14 13 12 11 9 8 7 6 5 4 3 1 22 10 43 42 41 40 39 38 37 36 35 34 2 32 31 30 29 28 27 26 25 24 23 33 47 49 48 
46 21 20 19 18 17 16 15 14 13 12 11 9 8 7 6 5 4 3 1 22 10 43 42 41 40 39 38 37 36 35 34 2 32 31 30 29 28 27 26 46 44 45 48 49 47 33 
54 21 20 19 18 17...

result:

ok good!

Test #85:

score: 45
Accepted
time: 4ms
memory: 10524kb

input:

90
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2
20
1 2 3 6 7 8 9 10 13 20 24 30 32 46 53 63 68 69 70 79

output:

8
46 27 19 20 21 22 23 24 25 26 2 28 29 30 31 32 33 1 17 3 4 5 6 7 8 9 11 12 13 14 15 16 18 10 37 36 35 34 38 39 40 41 42 43 44 52 46 
46 27 19 20 21 22 23 24 25 26 2 28 29 30 31 32 33 1 17 3 4 5 6 7 8 9 11 12 13 14 15 16 18 10 37 36 35 34 38 39 40 41 42 43 44 49 45 
46 27 19 20 21 22 23 24 25 26 2 ...

result:

ok good!

Test #86:

score: 45
Accepted
time: 4ms
memory: 11864kb

input:

120
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1
20
1 2 3 4 5 9 10 14 15 19 25 28 30 33 36 77 78 99 108 116

output:

9
1 2 
30 15 13 12 11 10 9 8 7 6 5 4 3 14 16 17 18 19 20 21 22 23 24 25 26 27 1 2 28 29 30 
36 15 13 12 11 10 9 8 7 6 5 4 3 14 16 17 18 19 20 21 22 23 24 25 26 27 1 31 30 29 28 2 33 37 36 34 32 
36 15 13 12 11 10 9 8 7 6 5 4 3 14 16 17 18 19 20 21 22 23 24 25 26 27 1 31 35 32 34 36 37 33 2 28 29 
36...

result:

ok good!

Test #87:

score: 45
Accepted
time: 4ms
memory: 11824kb

input:

200
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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 ...

output:

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

result:

ok good!

Test #88:

score: 45
Accepted
time: 4ms
memory: 11800kb

input:

250
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 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
59 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 2 46 47 48 49 50 51 52 53 54 55 56 57 1 29 30 3 4 5 6 7 8 9 10 11 12 13 14 15 17 28 27 26 25 24 23 22 21 20 19 18 16 77 76 
147 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 2 46 47 48 49 50 51 52 53 54 55 56 57 1 29 30 3 4 5 6 7 8 9 10 11 12 13 14 15...

result:

ok good!

Test #89:

score: 45
Accepted
time: 4ms
memory: 11896kb

input:

300
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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

5
3 36 25 26 
51 13 15 16 17 18 19 20 21 22 14 12 11 10 9 8 7 6 5 4 3 24 23 1 46 45 44 43 42 41 40 39 38 37 2 35 34 33 32 31 30 29 28 27 26 25 36 61 60 59 58 51 
61 13 15 16 17 18 19 20 21 22 14 12 11 10 9 8 7 6 5 4 3 24 23 1 46 45 44 43 42 41 40 39 38 37 2 35 34 33 32 31 30 29 28 27 54 47 48 49 50 ...

result:

ok good!

Test #90:

score: 45
Accepted
time: 4ms
memory: 11848kb

input:

100
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 76 77 78 79 80 81 82 83 84 85 ...

output:

18
16 39 27 28 29 30 31 32 33 34 35 36 37 38 2 40 41 
24 16 17 18 19 20 21 22 23 24 14 15 13 12 11 10 9 8 7 6 5 4 3 26 25 
24 42 43 44 45 46 47 48 49 50 1 25 26 3 4 5 6 7 8 9 10 11 12 13 15 
24 42 43 44 45 46 47 48 49 50 1 39 27 28 29 30 31 32 33 34 35 36 37 38 2 
24 14 24 23 22 21 20 19 18 17 16 41...

result:

ok good!

Test #91:

score: 45
Accepted
time: 4ms
memory: 12356kb

input:

446
55 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

55
9 1 306 280 305 304 303 302 301 300 
9 1 141 142 143 144 145 146 147 148 
9 1 299 298 297 296 295 294 293 292 
9 1 149 150 151 152 223 154 155 156 
9 1 291 290 289 288 287 286 285 284 
9 1 157 158 159 160 161 162 163 164 
9 1 283 282 281 334 321 335 333 332 
9 1 165 166 153 113 114 115 116 117 
9...

result:

ok good!

Test #92:

score: 45
Accepted
time: 4ms
memory: 11828kb

input:

470
31 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

31
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
470 1 323 295 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 352 338 353 351 350 349 3...

result:

ok good!

Test #93:

score: 45
Accepted
time: 3ms
memory: 11848kb

input:

31
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
15
1 2 3 4 5 6 7 24 25 26 27 28 29 30 31

output:

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

result:

ok good!

Test #94:

score: 45
Accepted
time: 3ms
memory: 11928kb

input:

100
1 14 14 8 2 2 5 16 7 1 4 7 7 2 7 2 1 1 4 5 2 14 9 3 7 1 11 4 7 4 2 8 17 1 7 1 7 2 11 3 3 2 1 7 1 9 1 7 3 3 4 2 1 10 1 1 1 3 8 7 1 1 1 2 4 1 3 16 5 9 3 3 1 3 2 3 7 11 1 3 1 11 13 4 1 3 1 17 1 2 1 16 11 4 9 5 6 4 1 2
7
1 2 4 8 16 32 64

output:

18
1 88 
2 33 88 
8 33 68 8 92 88 2 22 3 
8 33 68 8 92 88 3 22 2 
8 33 68 8 92 88 83 2 22 
8 33 68 8 92 88 83 3 22 
16 33 68 8 92 88 83 3 93 82 78 27 39 2 22 54 70 
16 33 68 8 92 88 83 3 93 82 78 27 39 2 22 54 95 
16 33 68 8 92 88 83 3 93 82 78 27 39 2 46 23 95 
16 33 68 8 92 88 83 3 93 82 78 27 39 ...

result:

ok good!

Test #95:

score: 45
Accepted
time: 4ms
memory: 11856kb

input:

350
3 1 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 2 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 5 1 1 2 1 3 1 1 1 1 1 1 2 1 3 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 2 1 1 3 1 ...

output:

7
1 308 
2 206 308 
16 206 103 247 308 327 344 332 298 233 143 32 147 261 322 320 250 
32 206 103 247 308 327 344 332 298 233 221 224 1 291 77 285 280 276 305 108 117 321 259 254 253 250 320 322 261 147 32 143 92 
64 206 103 247 308 327 344 332 298 233 221 224 1 291 77 285 280 276 305 108 117 321 25...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 11ms
memory: 55152kb

input:

27
12 148 141 10 98 1 82 103 145 60 190 102 181 147 152 185 24 134 179 127 141 38 169 93 132 157 49
6
1 5 7 13 17 26

output:

190
1 11 
1 11 
1 11 
1 11 
1 11 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 23 
5 11 16 13 19 26 
5 11 16 13 19 ...

result:

ok good!

Test #97:

score: 15
Accepted
time: 23ms
memory: 56860kb

input:

160
35 20 9 34 11 22 2 17 18 37 32 27 4 22 26 15 32 19 22 29 8 30 7 10 23 33 11 18 24 18 29 34 17 35 26 12 28 6 27 19 37 34 8 7 33 32 18 13 24 13 26 34 6 3 37 9 10 6 16 34 19 8 30 8 14 14 32 3 35 18 12 20 1 19 25 30 19 6 2 16 15 24 34 6 31 7 22 29 11 14 14 23 7 25 32 14 9 11 21 31 37 31 2 19 31 4 13...

output:

37
8 122 41 10 55 101 69 34 110 
8 122 41 10 55 101 1 110 34 
8 122 41 10 55 101 1 151 42 
20 122 41 10 55 101 69 60 4 32 83 52 42 151 1 34 110 26 45 17 46 
20 122 41 10 55 101 69 60 4 32 83 52 42 151 1 34 110 26 45 67 95 
20 122 41 10 55 101 69 60 4 32 83 52 11 95 67 45 26 110 34 1 151 
22 122 41 1...

result:

ok good!

Test #98:

score: 15
Accepted
time: 25ms
memory: 56872kb

input:

600
5 6 6 1 7 4 1 2 8 3 4 4 8 6 4 9 6 2 2 8 8 6 6 1 3 2 3 2 5 5 1 7 8 8 3 6 6 3 2 7 6 4 9 6 7 8 2 4 5 8 9 6 1 1 5 5 1 4 3 3 4 5 6 6 8 4 8 8 3 5 6 2 8 1 3 3 7 7 3 1 2 4 8 8 5 5 5 5 9 5 9 1 6 5 1 6 4 1 4 6 7 6 5 4 6 8 4 5 5 3 9 9 7 6 5 3 3 5 8 5 6 5 4 8 4 1 2 5 1 7 5 3 9 3 4 8 6 9 4 9 5 7 9 7 5 3 9 4 ...

output:

9
101 501 469 140 143 147 480 152 484 353 157 492 158 463 159 348 511 166 521 169 528 51 332 330 391 419 416 414 424 111 112 429 397 396 395 233 91 390 89 453 385 457 380 133 462 138 211 560 562 568 569 571 575 294 290 283 327 273 16 214 267 587 262 259 255 43 194 178 192 189 188 551 326 322 323 408...

result:

ok good!

Test #99:

score: 15
Accepted
time: 26ms
memory: 54960kb

input:

400
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 13 13 13 13 13 13 13 12 12 12 12 12 12...

output:

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

result:

ok good!

Test #100:

score: 15
Accepted
time: 12ms
memory: 54924kb

input:

750
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

8
45 140 128 129 130 131 132 133 134 135 136 137 138 139 127 141 142 143 144 145 146 147 148 149 150 151 152 115 103 104 105 106 107 108 109 110 111 112 113 114 153 116 117 118 119 120 
162 67 68 69 70 71 72 73 74 75 77 65 66 64 63 62 61 60 59 58 57 56 55 54 52 76 102 100 99 98 97 96 95 94 93 92 91 ...

result:

ok good!

Test #101:

score: 15
Accepted
time: 11ms
memory: 56840kb

input:

460
13 13 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12...

output:

24
32 2 1 10 9 8 7 6 5 4 3 160 148 159 158 157 156 155 154 153 152 151 150 149 175 161 162 163 164 165 166 167 168 
114 2 1 10 9 8 7 6 5 4 3 81 82 83 84 85 86 87 88 89 90 79 80 78 77 76 75 74 73 72 71 70 69 120 68 92 91 66 118 117 116 115 114 113 112 111 110 109 108 107 67 105 104 103 102 101 100 99...

result:

ok good!

Test #102:

score: 15
Accepted
time: 23ms
memory: 55404kb

input:

2751
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

250
12 1 1828 1848 1829 1830 1831 1832 1833 1834 1835 1836 1837 
12 1 924 923 922 921 920 919 918 917 916 1377 914 
12 1 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1807 
12 1 913 912 911 910 909 908 907 906 905 915 945 
12 1 1817 1891 1808 1809 1810 1811 1812 1813 1814 1815 1816 
12 1 944 943...

result:

ok good!

Test #103:

score: 15
Accepted
time: 15ms
memory: 54992kb

input:

2924
77 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

77
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 ...

result:

ok good!

Test #104:

score: 15
Accepted
time: 21ms
memory: 54896kb

input:

76
76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
39
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 57 58 59 60 61 62 63 64 65 ...

output:

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

result:

ok good!

Test #105:

score: 15
Accepted
time: 18ms
memory: 54980kb

input:

1500
1 2 2 2 1 1 1 2 1 2 1 1 1 1 1 3 1 2 2 1 1 1 4 1 1 2 2 3 4 2 2 4 4 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 1 1 1 2 4 1 3 3 1 1 1 3 1 1 1 1 2 2 1 2 1 3 1 1 1 4 2 2 1 1 1 1 1 1 2 2 2 6 4 1 1 1 2 2 2 3 1 3 1 4 3 1 1 1 2 1 1 1 2 1 1 1 2 2 1 4 2 2 3 3 7 3 2 1 2 1 3 3 1 3 5 1 2 5 2 3 4 1 3 3 1 1 2 1 2 1 1 3 1...

output:

11
1 1279 
2 1279 558 
4 558 1279 1483 718 
16 558 1279 1429 808 718 1483 774 163 214 713 1044 291 1294 920 120 1316 
32 558 1279 1429 808 1316 120 920 1294 291 1044 713 214 163 774 1483 718 1319 1264 87 493 1062 1411 700 764 383 509 460 768 316 649 772 323 
64 558 1279 1429 808 1028 940 256 1203 45...

result:

ok good!

Test #106:

score: 15
Accepted
time: 25ms
memory: 54916kb

input:

2400
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 1 2 1 1 2 1 1 1 4 2 1 1 1 2 1 1 3 1 1 1 1 1 1 1 3 3 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 3 1 1 2 1 1 1 3 1 1 1 1 3 2 1 3 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 2 2 2 1 1 1 3 1 1 1 1 1 1 4 2 3...

output:

9
1 1267 
2 1267 1336 
4 225 1335 1336 1267 
16 225 1335 146 1302 1271 855 435 915 366 1427 1104 1426 46 835 2052 242 
32 853 316 1313 1095 242 2052 835 46 1426 1104 1427 366 915 435 855 1271 1302 146 1335 225 1267 1336 508 63 139 2218 148 522 2058 1027 608 2101 
128 853 316 1313 1095 322 2392 1333 ...

result:

ok good!

Subtask #6:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #107:

score: 15
Accepted
time: 66ms
memory: 300856kb

input:

40
153 344 238 669 595 304 297 265 438 678 232 354 377 249 297 629 693 559 65 283 407 198 128 290 443 371 667 289 86 601 429 231 266 624 474 12 319 436 364 646
7
1 8 9 12 21 27 28

output:

693
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 30 
8 17 10 4 27 40 16 34 5 ...

result:

ok good!

Test #108:

score: 15
Accepted
time: 105ms
memory: 302644kb

input:

420
51 4 68 8 19 9 42 34 39 31 62 47 46 32 55 42 31 28 37 21 36 44 8 13 56 30 15 4 23 17 56 42 38 25 26 5 39 16 38 46 55 26 23 34 27 36 60 55 35 38 69 31 49 21 28 42 27 21 57 12 47 52 56 10 32 6 33 64 20 44 15 50 45 25 53 30 59 43 47 43 45 36 62 57 16 7 20 17 49 11 18 42 28 24 48 13 45 40 28 19 6 38...

output:

70
18 243 170 291 324 296 130 343 116 131 51 210 305 176 150 355 238 414 3 
18 243 170 291 324 296 130 343 116 131 51 210 347 3 414 238 355 150 176 
18 243 170 291 324 296 130 343 116 131 51 210 347 120 156 282 305 176 150 
18 243 170 291 324 296 130 343 116 131 51 210 347 120 156 282 305 309 325 
1...

result:

ok good!

Test #109:

score: 15
Accepted
time: 117ms
memory: 300976kb

input:

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

output:

8
686 2130 2183 2176 3009 2172 340 973 976 2166 2157 3025 330 990 326 3005 322 2126 2123 2116 2106 1018 314 2097 312 3062 3063 1025 2222 2272 2935 2257 381 2250 2243 2241 2946 2234 933 2231 942 307 2217 2966 2216 361 2215 2986 2990 2993 2997 351 2188 347 1936 3122 3123 1975 1110 243 1115 1117 1962 1...

result:

ok good!

Test #110:

score: 15
Accepted
time: 80ms
memory: 302968kb

input:

700
70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 69 68 67 66 65 64 64 63 62 61 60 59 59 58 57 56 56 55 54 54 53 52 52 51 51 50 49 49 48 48 47 47 46 46 45...

output:

103
1 50 
6 22 25 23 21 20 18 
9 34 35 36 37 38 39 40 41 42 
60 24 26 27 28 29 30 31 32 19 2 3 33 5 6 7 8 4 10 11 12 13 14 15 16 17 9 1 64 63 62 61 60 59 58 57 56 55 54 53 52 51 47 49 48 46 45 44 43 42 41 40 39 38 37 36 35 34 18 20 21 
60 24 26 27 28 29 30 31 32 19 2 3 33 5 6 7 8 4 10 11 12 13 14 15...

result:

ok good!

Test #111:

score: 15
Accepted
time: 123ms
memory: 301608kb

input:

6250
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...

output:

6
291 907 917 916 915 914 913 912 911 910 909 908 918 906 905 904 903 902 901 900 899 898 897 928 938 937 936 935 934 933 932 931 930 929 896 927 926 925 924 923 922 921 920 919 864 874 873 872 871 870 869 868 867 866 865 875 863 862 861 860 859 858 857 856 855 854 885 895 894 893 892 891 890 889 88...

result:

ok good!

Test #112:

score: 15
Accepted
time: 146ms
memory: 300864kb

input:

2000
14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 1...

output:

28
26 673 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 657 674 675 676 677 678 679 680 681 682 
499 332 333 334 335 336 337 338 339 340 341 342 343 330 331 329 328 327 326 325 324 323 322 321 320 319 318 317 316 345 344 314 374 373 372 371 370 369 368 367 366 365 364 363 362 315 360 3...

result:

ok good!

Test #113:

score: 15
Accepted
time: 148ms
memory: 302224kb

input:

13930
1071 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1071
14 1 9279 9305 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 
14 1 4652 4651 4650 4649 4648 4647 4646 4645 4644 4643 4642 4641 6965 
14 1 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 
14 1 4639 4638 4637 4636 4635 4634 4633 4632 4631 4630 4629 4628 4627 
14 1 9304 9...

result:

ok good!

Test #114:

score: 15
Accepted
time: 129ms
memory: 301816kb

input:

14828
173 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

173
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #115:

score: 15
Accepted
time: 108ms
memory: 299352kb

input:

172
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 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 9...

output:

172
43 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 
43 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 
43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...

result:

ok good!

Test #116:

score: 15
Accepted
time: 103ms
memory: 300988kb

input:

5000
3 3 3 2 1 2 1 2 1 1 6 8 1 2 1 1 3 3 1 2 7 2 1 2 4 1 3 5 3 5 3 2 7 2 7 2 1 5 1 1 1 3 7 1 2 4 1 1 2 1 6 1 1 4 2 1 4 1 3 3 5 1 3 3 6 10 9 1 1 1 3 6 6 1 1 3 2 3 8 2 4 4 12 3 3 6 3 2 4 7 4 1 5 1 7 1 4 4 15 5 2 6 6 2 10 5 3 3 7 1 1 1 1 1 1 1 2 2 1 3 2 1 6 1 5 3 2 1 1 3 4 7 2 2 1 3 2 3 5 1 2 7 3 1 1 1...

output:

22
1 2438 
2 1224 2438 
2 1224 2438 
2 1224 2438 
8 1224 1092 2178 2438 1723 1989 2110 4477 
8 1224 1092 2178 2438 1723 1989 2110 4908 
16 1224 1092 2178 1623 2388 783 4303 4908 2110 1989 1723 2438 4477 2352 1395 99 
16 1224 1092 2178 1623 2388 783 4303 3364 2074 4135 4400 99 1395 2352 4477 2438 
32...

result:

ok good!

Test #117:

score: 15
Accepted
time: 124ms
memory: 302788kb

input:

11000
1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 1 1 3 1 3 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 4 1 1 1 3 2 1 2 1 1 3 1 1 1 1 1 1 1 1 1 1 1 3 2 1 2 2 1 1 2 2 2 2 1 1 1 1 1 2 4 1 2 1 1 1 2 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 ...

output:

9
1 9052 
2 9052 1326 
4 3901 1427 1489 4683 
16 10604 7060 554 478 9653 9592 10648 726 2700 10348 4683 1489 1427 3901 1326 9052 
128 10604 7060 554 478 9653 9592 10648 726 2700 10348 5356 4815 9058 6400 8176 9379 1654 1868 6025 4418 7037 3437 1499 5397 630 7184 10787 4488 10239 2333 954 789 8520 23...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed