QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#707153#8561. Restoring a Permutationd325AC ✓28ms14740kbC++141.4kb2024-11-03 14:52:482024-11-03 14:52:48

Judging History

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

  • [2024-11-03 14:52:48]
  • 评测
  • 测评结果:AC
  • 用时:28ms
  • 内存:14740kb
  • [2024-11-03 14:52:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
#define ll long long
int read(){
    int x=0,f=1;
    char ch=0;
    while(ch<'0'||ch>'9'){
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(!(ch<'0'||ch>'9')){
        x=(x<<3)+(x<<1)+(ch-'0');
        ch=getchar();
    }
    return x*f;
}
int n;
int a[N],b[N];
int st[N];
int h[N],ne[N<<2],e[N<<2],idx,d[N];
void add(int a,int b){
    idx++;
    e[idx]=b;
    ne[idx]=h[a];
    h[a]=idx;
    d[b]++;
}
queue<int> q;
int now;
int res[N];
int main(){
    // ios::sync_with_stdio(false);
    // freopen("in.in","r",stdin);
    // freopen("out.out","w",stdout);
    n=read();
    now=n;
    for(int i=1;i<=n;i++)a[i]=read();
    for(int i=1;i<=n;i++)b[i]=read();
    for(int i=1;i<=n;i++){
        if(st[a[i]])add(st[a[i]],i);
        if(a[i]!=1)add(i,st[a[i]-1]);
        st[a[i]]=i;
    }
    for(int i=1;i<=n;i++)st[i]=0;
    for(int i=n;i>=1;i--){
        if(st[b[i]])add(st[b[i]],i);
        if(b[i]!=1)add(i,st[b[i]-1]);
        st[b[i]]=i;
    }
    for(int i=1;i<=n;i++){
        if(!d[i])q.push(i);
    }
    while(q.size()){
        int t=q.front();
        // cout<<"&& "<<t<<" ";
        q.pop();
        res[t]=now--;
        for(auto i=h[t];i;i=ne[i]){
            int v=e[i];
            d[v]--;
            if(!d[v])q.push(v);
        }
    }
    for(int i=1;i<=n;i++)cout<<res[i]<<" ";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7628kb

input:

5
1 1 1 2 3
3 2 1 1 1

output:

5 3 1 2 4 

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 5840kb

input:

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

output:

3 1 5 2 6 4 

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 7664kb

input:

1
1
1

output:

1 

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 7876kb

input:

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

output:

4 6 7 1 10 5 8 3 2 9 

result:

ok 

Test #5:

score: 0
Accepted
time: 1ms
memory: 7916kb

input:

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

output:

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

result:

ok 

Test #6:

score: 0
Accepted
time: 1ms
memory: 9724kb

input:

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

output:

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

result:

ok 

Test #7:

score: 0
Accepted
time: 1ms
memory: 9664kb

input:

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

output:

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

result:

ok 

Test #8:

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

input:

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

output:

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

result:

ok 

Test #9:

score: 0
Accepted
time: 0ms
memory: 8168kb

input:

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

output:

15960 18233 11173 3396 12224 8989 10402 18417 17897 10158 19011 13353 14523 7959 5744 16225 18279 10718 19921 2997 626 17741 10754 2553 3411 18462 10961 9836 3214 11643 19057 7565 14482 9869 9768 11033 18139 2750 11066 4441 10632 4058 8560 6641 15231 17795 8285 10997 17441 8071 14663 9017 6550 10504...

result:

ok 

Test #10:

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

input:

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

output:

34407 2611 15092 20957 28999 35497 38832 31894 27051 5713 6463 37146 4415 13437 34077 36129 8950 14630 39617 1154 33009 16527 24748 3045 3312 24898 33347 32585 27895 13020 10260 4470 16357 38089 6403 38893 9740 13472 37913 24596 29754 681 3488 35447 34710 19609 28686 1662 39893 25618 33610 19227 358...

result:

ok 

Test #11:

score: 0
Accepted
time: 9ms
memory: 11396kb

input:

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

output:

44785 50684 10927 1442 55329 47931 35675 31422 52705 20 33600 56225 49393 29104 55190 55792 54988 41342 52333 46411 44131 13724 33922 46483 32881 34624 48859 48001 33207 28153 18949 21042 34907 48555 14514 35717 52628 7468 56429 9327 55479 55256 1950 41386 39668 56507 27826 13268 25850 57035 11264 1...

result:

ok 

Test #12:

score: 0
Accepted
time: 11ms
memory: 11316kb

input:

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

output:

56777 151 46977 64144 18087 64635 68105 5261 27169 31 60688 29140 43982 13391 40656 22750 46092 40836 72699 65730 39821 60928 19836 63903 1574 27074 66917 51018 59725 67685 28030 52491 46600 68998 76233 39759 12708 67775 36114 7485 60771 61798 49637 12621 10581 55853 11749 67588 47366 74525 18406 23...

result:

ok 

Test #13:

score: 0
Accepted
time: 9ms
memory: 11692kb

input:

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

output:

73984 60400 71959 98396 56816 9937 37974 98855 95500 48808 96453 11538 50900 70856 50386 91023 74932 92509 73697 69169 36511 98168 15615 63953 49640 38979 50837 98068 35913 76154 92604 89663 68979 47117 46716 58986 49717 24960 36266 90335 2087 57406 49431 31381 75017 22474 89348 95123 97302 71886 83...

result:

ok 

Test #14:

score: 0
Accepted
time: 17ms
memory: 12328kb

input:

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

output:

3339 106964 116822 89989 18133 114362 104180 63569 9526 120000 79790 3946 112538 55534 8140 32004 44382 25207 50049 53424 39991 32317 71086 107072 25448 56341 69025 119820 60520 100231 79168 49321 67351 106647 20741 80825 115374 49860 43049 72744 50116 23073 61242 31132 119500 111898 103517 69101 10...

result:

ok 

Test #15:

score: 0
Accepted
time: 16ms
memory: 12580kb

input:

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

output:

136212 111943 77629 14223 50197 134996 132564 26455 55926 82931 16999 137972 3310 39266 120290 131672 103965 117381 17958 16787 97946 104497 134666 42883 94493 46566 22624 122651 31947 23763 2327 76595 55397 53951 103553 42683 36174 74775 35642 75565 112762 100160 116905 35798 107728 126334 125050 3...

result:

ok 

Test #16:

score: 0
Accepted
time: 23ms
memory: 12852kb

input:

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

output:

87323 55519 147732 2153 99016 34399 43459 91237 42577 123359 64595 16512 73062 110096 107699 92274 27526 67185 48717 80147 61377 66595 31052 90012 42021 131891 10433 106428 31358 40316 89914 118416 41816 130314 137178 7009 471 152282 2085 27816 152412 110880 91847 71041 27869 82763 158563 25385 1439...

result:

ok 

Test #17:

score: 0
Accepted
time: 26ms
memory: 14056kb

input:

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

output:

74389 110247 35019 21732 103077 93677 47655 157797 104070 64211 143166 149629 40743 150103 20237 67476 45212 86726 30387 133438 57919 5167 74221 138434 180000 151406 136555 123328 158468 79454 16464 27898 28844 97565 169134 122895 86999 44943 159020 51858 78348 33007 50062 145609 67678 25641 168879 ...

result:

ok 

Test #18:

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

input:

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

output:

96532 188761 198870 3206 31915 177309 88765 106601 82895 111735 138212 174051 12635 177031 111835 147229 59919 181597 68887 123895 199216 80898 97545 61134 34825 161729 188916 198391 114549 60822 146433 165113 34631 199565 121599 3082 91955 185428 183019 94238 199768 124436 191701 62544 69697 81963 ...

result:

ok 

Test #19:

score: 0
Accepted
time: 20ms
memory: 14508kb

input:

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

output:

176397 111185 75567 93454 132227 171009 16667 65570 119028 166332 182334 146807 42464 65653 12235 45141 167704 104495 179737 186245 166212 172992 140995 146105 113425 137729 34349 86183 105284 37059 119866 122021 75090 3197 187435 46013 172495 159740 128001 103584 183219 141330 40355 55624 34400 535...

result:

ok 

Test #20:

score: 0
Accepted
time: 25ms
memory: 14520kb

input:

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

output:

77339 71631 70086 164112 82294 153712 128356 82928 22609 178752 125964 11701 22533 144617 18298 68801 130421 61617 95157 52750 105700 55185 84983 110651 159312 80690 53681 63510 187785 100856 141129 147207 101411 46984 185521 156351 44025 162749 163780 79359 32781 77599 26912 170698 93712 59115 1891...

result:

ok 

Test #21:

score: 0
Accepted
time: 26ms
memory: 14692kb

input:

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

output:

196193 22110 84301 48099 105305 196339 84722 28718 64317 22061 4082 52254 126318 91816 13015 63437 100567 183099 130518 119475 77216 56791 49846 98405 28766 170538 169033 31009 122490 172976 163343 97730 63503 164839 175572 177614 174249 2045 173098 67388 168419 114811 118015 175070 95008 12942 3140...

result:

ok 

Test #22:

score: 0
Accepted
time: 28ms
memory: 14412kb

input:

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

output:

152446 116278 21086 185728 14730 77600 127093 195803 81642 105424 93815 146867 167518 188610 149612 71037 178481 106627 148728 191054 26303 121051 161685 162292 158944 81554 86627 172164 47595 145356 114100 50768 92720 26229 64348 149725 22493 192637 79717 81985 159886 35689 145234 45556 174542 9882...

result:

ok 

Test #23:

score: 0
Accepted
time: 19ms
memory: 14540kb

input:

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

output:

150808 1066 11042 157742 165242 138004 56657 112178 47377 195717 178803 185771 93615 91621 17213 156082 33672 100601 92640 58354 31298 79840 120629 22618 198202 122819 158185 84711 174064 54427 80374 111691 3295 53530 165012 87325 195160 178671 164126 152532 66514 186264 157399 77322 131618 148469 1...

result:

ok 

Test #24:

score: 0
Accepted
time: 25ms
memory: 14492kb

input:

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

output:

23093 119989 186447 75343 181388 108828 180992 4391 164719 194695 16128 70328 138809 95391 128629 112195 90466 137684 157037 62321 105458 16312 133811 89561 91648 193757 197546 154369 186588 1527 51274 46025 6599 107894 110482 195946 89651 177547 115973 185028 143274 77081 23136 118167 18281 139033 ...

result:

ok 

Test #25:

score: 0
Accepted
time: 25ms
memory: 14520kb

input:

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

output:

177011 72867 152754 161125 195686 155689 5219 97363 194458 141326 35735 39768 120294 86926 11548 50803 9965 152634 134828 190308 28419 93433 49103 162960 59424 107011 158729 54583 185561 40652 25986 180895 138491 99440 95256 197233 187867 181667 184857 164935 49026 77300 127278 172397 181029 25850 9...

result:

ok 

Test #26:

score: 0
Accepted
time: 24ms
memory: 14508kb

input:

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

output:

172554 163490 48582 127848 158275 193688 158154 152002 162876 30139 114751 2750 138187 29571 1418 47086 172168 190216 15659 155541 16696 61126 134555 98620 122665 190360 169198 64471 85038 123519 173944 48637 75333 193126 6205 122026 45844 147900 24332 38997 25562 137286 107985 22803 36806 172950 11...

result:

ok 

Test #27:

score: 0
Accepted
time: 18ms
memory: 14516kb

input:

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

output:

120872 78674 67901 116926 145963 153487 192671 159859 166864 180882 77214 156858 101845 103228 158493 183704 158030 195420 62826 181003 132245 126630 105591 131496 186842 11020 131813 117986 52419 174613 105168 58312 61317 156513 169895 165436 150852 192790 78344 166432 163890 6919 69608 128596 3570...

result:

ok 

Test #28:

score: 0
Accepted
time: 16ms
memory: 13628kb

input:

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

output:

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 101 102 ...

result:

ok 

Test #29:

score: 0
Accepted
time: 15ms
memory: 13268kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

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 199959 199958...

result:

ok 

Test #30:

score: 0
Accepted
time: 19ms
memory: 13668kb

input:

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

output:

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 177...

result:

ok 

Test #31:

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

input:

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

output:

13 7 9 1 2 11 3 4 5 6 31 26 33 28 17 30 20 22 16 24 36 58 39 54 56 52 43 45 41 38 61 62 69 74 60 71 67 63 65 66 83 89 76 91 86 79 93 81 88 84 111 113 108 110 98 100 107 96 102 104 130 136 134 120 132 117 122 124 126 119 171 159 152 148 150 145 147 138 140 142 161 153 155 157 173 163 165 167 168 160 ...

result:

ok 

Test #32:

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

input:

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

output:

26 28 30 40 2 161 164 23 20 16 156 150 19 12 25 33 153 6 143 35 110 146 158 122 149 155 152 128 116 142 145 15 22 148 31 133 18 42 105 47 50 136 3 129 44 29 139 9 123 37 54 34 56 121 41 39 141 11 38 138 60 63 65 27 4 52 58 45 127 115 66 120 109 1 36 61 48 8 13 51 32 24 21 43 55 104 64 5 57 46 53 49 ...

result:

ok 

Test #33:

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

input:

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

output:

490 300 194 1459 1210 1221 1515 56 1579 1179 1583 1563 23 1594 1551 1574 1199 1467 1602 879 345 200 1187 248 1169 1230 495 1143 1238 1604 874 50 257 1321 1269 1220 1245 1526 1198 1347 1568 1229 1152 268 1237 177 1597 239 247 190 1126 1253 93 1599 256 222 1578 1587 141 1591 1582 1333 1117 1279 1260 2...

result:

ok 

Test #34:

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

input:

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

output:

1693 5425 13997 13878 14275 1336 475 14968 5439 3369 8064 3268 9059 14230 1632 14828 15373 7811 15781 5735 7783 1428 3281 14846 13700 15211 8090 14867 7975 5410 2039 11783 200 8481 344 8186 15229 20 14019 14785 14540 14086 15482 5396 15195 15247 14717 15210 1116 912 9804 7835 1739 10859 10019 13957 ...

result:

ok 

Test #35:

score: 0
Accepted
time: 19ms
memory: 14376kb

input:

198916
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:

99236 99682 100127 100571 101014 101456 101897 102337 102776 103214 103651 104087 104522 104956 105389 105821 106252 106682 107111 107539 107966 108392 108817 109241 109664 110086 110507 110927 111346 111764 112181 112597 113012 113426 113839 114251 114662 115072 115481 115889 116296 116702 117107 1...

result:

ok 

Test #36:

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

input:

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

output:

119801 120201 120600 120998 121395 121791 122186 122580 122973 123365 123756 124146 124535 124923 125310 125696 126081 126465 126848 127230 127611 127991 128370 128748 129125 129501 129876 130250 130623 130995 131366 131736 132105 132473 132840 133206 133571 133935 134298 134660 135021 135381 135740...

result:

ok 

Test #37:

score: 0
Accepted
time: 18ms
memory: 14492kb

input:

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

output:

4951 5051 5151 5251 5351 5451 5551 5651 5751 5851 5951 6051 6151 6251 6351 6451 6551 6651 6751 6851 6951 7051 7151 7251 7351 7451 7551 7651 7751 7851 7951 8051 8151 8251 8351 8451 8551 8651 8751 8851 8951 9051 9151 9251 9351 9451 9551 9651 9751 9851 9951 10051 10151 10251 10351 10451 10551 10651 107...

result:

ok 

Test #38:

score: 0
Accepted
time: 26ms
memory: 14488kb

input:

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

output:

99555 99081 100000 98536 99525 97979 98979 100444 98421 100887 97513 97072 96632 99970 97954 99423 100414 98864 98396 99868 96175 95728 101329 100857 97512 97953 100312 101770 102210 99308 97071 99753 96613 101299 95278 98839 97511 101740 98395 99283 97952 97052 94842 98838 102649 98394 96165 103087...

result:

ok 

Test #39:

score: 0
Accepted
time: 18ms
memory: 14520kb

input:

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

output:

179913 179713 180112 179513 180310 179912 180111 180507 180309 179313 180703 179712 180898 179109 178909 179911 180506 181092 179512 178709 178509 180110 178308 178108 179711 181285 180308 179910 180109 180702 180897 179308 181477 179108 181091 181284 178908 180505 180307 179507 180701 180896 181668...

result:

ok 

Test #40:

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

input:

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

output:

52 43 35 61 28 21 51 70 60 42 50 34 79 88 41 15 27 69 10 33 78 20 26 14 6 9 19 13 59 49 40 68 97 87 58 77 32 106 48 25 18 116 3 126 96 39 31 107 136 5 24 67 1 86 8 57 146 12 2 47 117 98 4 108 156 17 127 7 11 166 118 76 137 147 38 30 128 176 138 23 89 99 66 109 16 56 186 119 129 80 196 90 46 71 81 10...

result:

ok 

Test #41:

score: 0
Accepted
time: 27ms
memory: 14740kb

input:

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

output:

79963 79514 79116 80362 78712 80761 78307 77854 77460 79912 80311 79513 77067 79108 78702 78248 81160 76675 77853 76277 81559 79911 75880 75489 75101 80710 74714 81958 81109 82357 77459 79505 79098 74324 82756 78643 73939 77066 73555 78247 77852 77458 73172 72790 81508 76667 77058 83155 83554 76269 ...

result:

ok 

Test #42:

score: 0
Accepted
time: 13ms
memory: 14400kb

input:

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

output:

199810 199790 199829 199809 199767 199847 199864 199786 199828 199736 199715 199846 199805 199824 199755 199734 199880 199694 199713 199774 199863 199895 199753 199842 199732 199879 199859 199674 199909 199894 199693 199875 199654 199633 199613 199793 199922 199593 199712 199673 199772 199652 199632...

result:

ok