QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#246221#7729. Permutation Compression IIcomeintocalmAC ✓543ms77932kbC++171.8kb2023-11-10 17:27:392023-11-10 17:27:40

Judging History

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

  • [2023-11-10 17:27:40]
  • 评测
  • 测评结果:AC
  • 用时:543ms
  • 内存:77932kb
  • [2023-11-10 17:27:39]
  • 提交

answer

#include<bits/stdc++.h>
const int N = 1e6+7;
using namespace std;
const int U = 1e6;

int c[N], fr[N], ans[N], pos[N];
#define pii pair<int, int>
int n;
#define lbt(x) (x &(-x))
pii query(int x) {
  pii a; a.first = a.second = 0;
  if(!x) return a;
  while(x > 0) {
    if(c[x] > a.first) a.first = c[x], a.second = pos[x];
    else if(c[x] == a.first) a.second = min(a.second, pos[x]);
    x -= lbt(x);
  } return a;
}
void upd(int x, int a, int i) {
  if(!x) return;
  while(x <= n) {
    //c[x] = max(c[x], a);
    if(a > c[x]) {
      c[x] = a;
      pos[x] = i;
    } else if(a == c[x]) pos[x] = min(i, pos[x]);
    x += lbt(x);
  }
}

int a[N], vis[N], ord[N];

int main() {
  int T;
  //scanf("%d", &T);
  //cin >> T;
  
  cin >> T;
  vector<int> p;
  set<int> s;
  while(T--) {
    
    scanf("%d", &n);
    int jump = 0;
    for(int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      ord[a[i]] = i;
      pii nx = query(a[i] - 1);
      ans[i] = nx.first + 1;
      fr[i] = nx.second;
      upd(a[i], ans[i], i);
      if(ans[i] > ans[jump]) jump = i;
    }
    int Len = ans[jump];
    
    while(jump) {
      vis[jump] = 1;
      jump = fr[jump];
    }
    //reverse(q.begin(), q.end());
    for(int i = 1; i <= n; i++) {
      if(vis[i]) {
        set<int>::iterator it;
        while((it = s.upper_bound(a[i])) != s.end()) {
          p.push_back(ord[*it]);
          s.erase(it);
        }
      }
      s.insert(a[i]);
    }
    printf("%d %d\n", Len, p.size());
    sort(p.begin(), p.end());
    for(auto &x : p) printf("%d ", x);
    printf("\n");
    for(int i = 0; i <= n; i++) a[i] = vis[i] = ord[i] = c[i] = fr[i] = ans[i] = pos[i] = 0;
    p.clear();
    s.clear();
  }
return 0;
}



/*
8
389 207 155 300 299 170 158 65
*/

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

2
3
3 1 2
3
1 2 3

output:

2 1
1 
3 0


result:

ok ok n = 3

Test #2:

score: 0
Accepted
time: 154ms
memory: 13824kb

input:

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

output:

3 0

3 0

3 0

2 0

4 5
1 3 4 8 10 
3 0

7 3
2 4 9 
4 1
1 
7 2
1 6 
2 1
1 
9 21
1 2 3 5 7 8 9 12 13 15 16 17 20 22 23 24 25 26 27 28 29 
1 0

2 0

1 0

2 0

5 5
2 3 5 6 7 
2 0

6 3
3 4 11 
3 0

2 0

5 3
1 3 4 
1 0

3 1
1 
2 0

4 3
1 2 4 
10 19
1 4 8 9 10 11 12 13 14 15 16 17 20 22 25 27 28 31 32 
2 ...

result:

ok ok n = 8

Test #3:

score: 0
Accepted
time: 191ms
memory: 13988kb

input:

10000
65
4 18 41 7 11 24 29 19 12 52 65 2 62 5 37 55 59 20 42 1 47 54 32 16 58 14 9 26 61 3 15 33 27 35 50 21 8 48 51 23 10 13 17 44 60 46 56 38 36 53 39 25 31 28 49 40 64 22 34 63 57 30 6 43 45
123
8 75 110 89 30 47 80 87 34 66 50 36 44 12 20 27 55 58 39 67 11 109 114 17 116 5 10 21 86 112 123 93 2...

output:

13 25
2 3 10 11 13 15 16 17 19 21 22 25 29 35 38 39 44 45 46 47 50 55 57 60 61 
22 38
2 3 4 6 7 8 10 11 13 17 18 20 22 23 25 29 30 31 32 34 36 37 38 40 41 42 45 46 48 49 53 55 59 64 70 82 86 101 
21 24
3 4 5 6 8 10 11 13 14 19 22 27 30 34 35 36 39 47 55 65 66 73 78 81 
36 141
1 2 3 4 6 7 8 9 10 11 1...

result:

ok ok n = 35

Test #4:

score: 0
Accepted
time: 223ms
memory: 16164kb

input:

1000
755
225 379 544 576 667 603 358 368 689 711 406 681 393 651 18 244 354 114 157 559 490 599 621 537 356 351 113 166 380 169 605 289 106 409 574 124 1 228 515 545 293 170 212 306 412 435 648 459 694 660 258 267 411 181 594 439 25 607 588 560 369 32 259 699 223 464 606 563 747 592 344 663 693 529 ...

output:

49 286
1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 20 21 22 23 24 25 26 29 31 32 34 35 38 39 40 41 44 45 46 47 48 49 50 53 55 56 58 59 60 61 64 66 67 68 69 70 71 72 73 74 77 82 84 92 95 96 97 98 99 101 103 105 106 107 109 112 113 115 116 117 118 119 120 121 122 123 124 126 127 128 129 130 131 132 135 138...

result:

ok ok n = 1038

Test #5:

score: 0
Accepted
time: 267ms
memory: 14820kb

input:

100
9934
5959 6367 4621 2806 5929 6657 7409 1773 206 4002 8297 7782 3544 1605 6282 7405 9175 3939 9739 3540 7920 3252 8382 2848 5874 7175 4951 8598 5101 1142 4451 7386 8279 2200 8870 7550 2195 5797 928 5601 6488 2127 167 9277 448 5495 9475 5048 4236 7279 1144 6702 8405 1116 282 8597 1317 219 4976 80...

output:

193 4811
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...

result:

ok ok n = 3558

Test #6:

score: 0
Accepted
time: 332ms
memory: 35948kb

input:

10
16046
15112 9938 7990 507 10378 9653 3934 483 6732 13907 4660 8592 4845 7396 4829 6228 14079 1583 8493 1692 981 1466 12874 12410 12924 7050 3376 12376 2460 6776 4551 4507 3266 13348 10515 4216 2324 14355 14681 6301 7510 6027 4532 6303 7315 6277 4689 12677 7569 9873 5108 8486 15572 15446 7226 1175...

output:

253 8125
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...

result:

ok ok n = 83294

Test #7:

score: 0
Accepted
time: 543ms
memory: 55820kb

input:

1
1000000
330652 360403 666390 110925 197675 937862 536868 187911 88303 970828 421775 501768 79595 76239 644124 256083 662395 363691 240456 406463 90594 392030 969653 31799 577337 694817 841968 74013 67730 297531 454629 965693 577789 79111 588020 710557 186930 454320 876010 344009 273600 589241 6482...

output:

2001 499039
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 ...

result:

ok ok n = 1000000

Test #8:

score: 0
Accepted
time: 418ms
memory: 77880kb

input:

1
1000000
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 10...

output:

999994 3
39929 589259 826499 

result:

ok ok n = 1000000

Test #9:

score: 0
Accepted
time: 376ms
memory: 61400kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

5 684511
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...

result:

ok ok n = 1000000

Test #10:

score: 0
Accepted
time: 407ms
memory: 77932kb

input:

1
1000000
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 10...

output:

999990 5
8244 118552 297490 555780 756107 

result:

ok ok n = 1000000

Test #11:

score: 0
Accepted
time: 314ms
memory: 62848kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

5 363938
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...

result:

ok ok n = 1000000

Test #12:

score: 0
Accepted
time: 391ms
memory: 77844kb

input:

1
1000000
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 10...

output:

999980 10
29479 41129 167859 180924 261994 298987 344188 374454 418385 727832 

result:

ok ok n = 1000000

Test #13:

score: 0
Accepted
time: 295ms
memory: 66984kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

9 273978
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...

result:

ok ok n = 1000000

Test #14:

score: 0
Accepted
time: 355ms
memory: 77876kb

input:

1
1000000
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 10...

output:

999800 100
2908 5453 12415 14449 17730 25031 25736 37890 60820 61298 62368 64675 71604 77202 77331 78578 81613 82055 86078 89623 91201 91316 97844 100537 109691 112286 120066 128123 133889 139624 142042 145776 151310 153661 160686 165991 167741 168385 172340 176053 186661 196270 203186 206608 206866...

result:

ok ok n = 1000000

Test #15:

score: 0
Accepted
time: 246ms
memory: 66448kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

27 253628
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 10...

result:

ok ok n = 1000000

Test #16:

score: 0
Accepted
time: 285ms
memory: 77868kb

input:

1
1000000
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 10...

output:

998002 999
662 990 1260 1930 2184 2845 3466 4258 5007 5060 5090 5127 5158 5380 5952 6505 6930 7095 7368 8489 8886 8997 9279 9551 9639 9975 10245 10696 10774 11317 12280 12507 12828 13192 13294 13405 13425 15238 15466 15926 16194 16340 16373 17835 18314 18887 19059 19109 19160 19255 19685 19715 19884...

result:

ok ok n = 1000000

Test #17:

score: 0
Accepted
time: 233ms
memory: 60592kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

85 389238
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 10...

result:

ok ok n = 1000000

Test #18:

score: 0
Accepted
time: 242ms
memory: 77484kb

input:

1
1000000
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 10...

output:

980209 9897
311 340 392 400 416 489 607 618 688 701 814 826 849 935 992 1021 1074 1100 1159 1177 1180 1234 1300 1421 1519 1623 1629 1715 1740 1808 2000 2019 2067 2108 2125 2141 2157 2182 2201 2255 2270 2353 2408 2411 2414 2449 2491 2493 2526 2536 2562 2624 2648 2680 2761 2765 2773 2795 2821 2860 287...

result:

ok ok n = 1000000

Test #19:

score: 0
Accepted
time: 237ms
memory: 58364kb

input:

1
1000000
1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99...

output:

273 444546
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 1...

result:

ok ok n = 1000000

Test #20:

score: 0
Accepted
time: 419ms
memory: 77848kb

input:

1
1000000
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 10...

output:

1000000 0


result:

ok ok n = 1000000

Test #21:

score: 0
Accepted
time: 398ms
memory: 77044kb

input:

2
14602
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:

14596 3
5925 7571 11569 
985392 3
6724 80509 295414 

result:

ok ok n = 985398

Test #22:

score: 0
Accepted
time: 264ms
memory: 51240kb

input:

3
221862
221862 221861 221860 221859 221858 221857 221856 221855 221854 221853 221852 221851 221850 221849 221848 221847 221846 221845 221844 221843 221842 221841 221840 221839 221838 221837 221836 221835 221834 221833 221832 221831 221830 221829 221828 221827 221826 221825 221824 221823 221822 2218...

output:

5 46880
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 ...

result:

ok ok n = 665566

Test #23:

score: 0
Accepted
time: 339ms
memory: 55772kb

input:

4
69450
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:

69440 5
641 11937 14055 14216 14310 
35372 5
1985 5677 6268 6882 7482 
571814 5
75911 88402 110932 159234 419295 
323334 5
1879 12841 17027 57740 114039 

result:

ok ok n = 323344

Test #24:

score: 0
Accepted
time: 251ms
memory: 58328kb

input:

5
1278
1278 1277 1276 1275 1274 1273 1272 1271 1270 1269 1268 1267 1266 1265 1264 1263 1262 1261 1260 1259 1258 1257 1256 1255 1254 1253 1252 1251 1250 1249 1248 1247 1246 1245 1244 1243 1242 1241 1240 1239 1238 1237 1236 1235 1234 1233 1232 1231 1230 1229 1228 1227 1226 1225 1224 1223 1222 1173 122...

output:

5 933
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 10...

result:

ok ok n = 64361

Test #25:

score: 0
Accepted
time: 275ms
memory: 44548kb

input:

6
72201
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:

72181 10
2433 3915 9108 21770 27189 27234 29714 34960 35321 37862 
93085 10
1819 10252 18710 20086 27507 34034 45758 60150 74665 88114 
415194 10
7140 17937 45388 80037 98954 110905 172108 178463 260163 357128 
16440 10
1737 1876 3584 4437 4691 7010 8645 9448 9665 14944 
179365 10
4969 8586 20695 22...

result:

ok ok n = 223635

Test #26:

score: 0
Accepted
time: 233ms
memory: 44680kb

input:

7
32589
32589 32588 32587 32586 32585 32584 32583 32582 32581 32580 32579 32578 32577 32576 32575 32574 32573 32572 32571 32570 32569 32568 32567 32566 32565 32564 32563 32562 32561 32560 32559 32558 32557 32556 32555 32554 32553 32552 32551 32550 32549 32548 32547 32546 32545 32544 32543 32542 3254...

output:

9 9820
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...

result:

ok ok n = 4233

Test #27:

score: 0
Accepted
time: 222ms
memory: 28920kb

input:

10
34116
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 21997 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 ...

output:

33916 100
41 213 343 366 386 441 520 525 818 866 1222 1509 1606 1873 1999 2088 2322 2448 2653 2845 3127 3246 3357 3380 3428 3508 3577 3601 3703 3940 4095 4268 5002 5104 5215 5620 5689 5971 5977 6105 6169 6361 6422 6757 7037 7363 7377 7905 8029 8603 8791 8889 9462 10401 10756 11426 11563 11759 12085 ...

result:

ok ok n = 24477

Test #28:

score: 0
Accepted
time: 179ms
memory: 19560kb

input:

20
95367
95367 95366 4319 95364 95363 95362 95361 95360 95359 95358 95357 95356 95355 95354 95353 95352 95351 95350 95349 95348 95347 95346 95345 95344 95343 95342 95341 95340 95339 95338 95337 95336 95335 95334 95333 95332 95331 95330 95329 95328 95327 95326 95325 95324 95323 95322 95321 95320 9531...

output:

33 24888
1 2 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...

result:

ok ok n = 95529

Test #29:

score: 0
Accepted
time: 182ms
memory: 23348kb

input:

30
61430
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 58332 42 43 44 45 46 47 48 49 50 51 52 53 17021 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 35492 92 93 94 95 96 97 ...

output:

59466 986
41 54 91 122 187 316 350 364 507 563 618 644 665 669 686 694 696 733 747 795 804 836 871 872 880 893 897 985 990 1015 1061 1095 1179 1261 1317 1322 1328 1363 1366 1380 1382 1489 1491 1502 1534 1535 1570 1576 1620 1630 1672 1746 1867 1921 1930 1958 1970 1973 1977 2102 2118 2170 2172 2175 22...

result:

ok ok n = 3041

Test #30:

score: 0
Accepted
time: 227ms
memory: 45480kb

input:

2
344577
344577 344576 344575 344574 344573 344572 344571 344570 344569 344568 159183 344566 344565 344564 344563 344562 344561 344560 344559 344558 344557 344556 344555 344554 344553 344552 344551 344550 344549 344548 344547 344546 344545 344544 344543 344542 344541 344540 344539 344538 344537 2266...

output:

90 175296
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 10...

result:

ok ok n = 655423

Test #31:

score: 0
Accepted
time: 264ms
memory: 61748kb

input:

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

output:

275420 9685
9 10 12 33 55 56 78 90 107 149 151 192 225 240 251 272 273 277 282 283 286 321 324 342 344 345 346 375 390 398 406 423 434 445 446 447 465 542 562 565 569 573 580 587 594 604 625 636 679 693 699 706 713 728 738 747 779 792 797 798 818 838 849 855 864 865 867 881 888 908 918 930 945 955 9...

result:

ok ok n = 705231

Test #32:

score: 0
Accepted
time: 236ms
memory: 44284kb

input:

3
217657
194137 217656 217655 217654 217653 217652 217651 217650 217649 217648 217647 217646 217645 217644 217643 217642 217641 217640 217639 217638 217637 217636 217635 217634 157715 217632 217631 217630 217629 217628 217627 217626 217625 217624 217623 217622 217621 217620 141420 151086 217617 2176...

output:

268 76851
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 10...

result:

ok ok n = 131949

Test #33:

score: 0
Accepted
time: 383ms
memory: 56376kb

input:

3
8366
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:

8366 0

393291 0

598343 0


result:

ok ok n = 598343

Extra Test:

score: 0
Extra Test Passed