QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#259999#4580. Bicycle Tourpaw#AC ✓73ms20796kbC++142.3kb2023-11-21 17:39:462023-11-21 17:39:46

Judging History

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

  • [2023-11-21 17:39:46]
  • 评测
  • 测评结果:AC
  • 用时:73ms
  • 内存:20796kb
  • [2023-11-21 17:39:46]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
typedef long long ll;
#define int ll
using namespace std;
const int N = 1e5+5;
vector<int> side[N];
int arr[N];
int tp[N];
int dep[N];
bool in[N];
int ans[N];
struct edge{
    int a,b,w;
};
void dfs(int cur,int p){
    for(auto i : side[cur]){
        if(i!=p){
            tp[i] = cur;
            dep[i]=dep[cur]+1;
            dfs(i,cur);
        }
    }
}
int P[N];
int P2[N];
int sz;
int query(int a){
    if(P[a]==a) return a;
    return P[a]=query(P[a]);
}

int query2(int a){
    if(P2[a]==a) return a;
    return P2[a]=query2(P2[a]);
}
bool inedge[2*N];
signed main(){
    AquA;
    int n,m;cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>arr[i];
    vector<edge> es;
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        es.push_back({a,b,abs(arr[a]-arr[b])});
    }
    sort(es.begin(),es.end(),[](const edge &a,const edge &b){return a.w<b.w;});
    for(int i=1;i<=n;i++) P[i]=i;
    for(int i=0;i<m;i++){
        auto e = es[i];
        if(query(e.a)!=query(e.b)){
            P[query(e.a)]=query(e.b);
            inedge[i]=1;
            side[e.a].push_back(e.b);
            side[e.b].push_back(e.a);
        }
    }
    tp[1]=1;
    dep[1]=1;
    dfs(1,0);
    for(int i=1;i<=n;i++) P2[i]=i;
    for(int i=0;i<m;i++){
        if(inedge[i]) continue;
        if(query2(es[i].a)==query2(es[i].b)) continue;
        int a = query2(es[i].a);
        int b = query2(es[i].b);
        while(a!=b){
            if(dep[a]>dep[b]) swap(a,b);
            if(query2(tp[b])!=query2(b)){
                if(!in[b]) ans[b] = es[i].w;
                if(!in[tp[b]]) ans[tp[b]] = es[i].w;
                in[b]=1;
                in[tp[b]]=1;
                P2[query2(b)]=query2(tp[b]);   
            }
            b = query2(tp[b]);
        }
    }
    for(int i=1;i<=n;i++){
        if(!in[i]) cout<<-1<<" ";
        else cout<<ans[i]<<" ";
    }
    cout<<"\n";
}
/*
6 5 4 3
1 2 3 2 4 2
2 2 4 1 1
*/
/*
9 9 9 9 
8 6 4 1 9 7 5 3 2
1 2 3 4 5 6 7 8 9
*/
/*
20 20 18 8
8 9 1 17 18 2 11 17 15 12
9 16 8 13 17 15 16 9 8 17
15 16 2 16 16 8 2 5 5 5
10 12 11 10 12 3 2 13 8 4
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5764kb

input:

8 11
5 2 7 0 10 6 6 6
1 2
1 3
2 3
2 4
2 5
2 7
3 5
1 6
6 7
6 8
7 8

output:

4 4 5 -1 8 0 0 0 

result:

ok single line: '4 4 5 -1 8 0 0 0 '

Test #2:

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

input:

4 5
10 20 30 40
1 2
1 3
1 4
2 3
3 4

output:

20 20 20 30 

result:

ok single line: '20 20 20 30 '

Test #3:

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

input:

5 4
72 35 22 49 108
1 2
2 3
3 4
4 5

output:

-1 -1 -1 -1 -1 

result:

ok single line: '-1 -1 -1 -1 -1 '

Test #4:

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

input:

2 1
10 20
1 2

output:

-1 -1 

result:

ok single line: '-1 -1 '

Test #5:

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

input:

252 31626
825 5234 3578 4723 2145 4362 1861 2413 7203 1939 3210 7153 2155 4559 4403 1466 887 3786 6529 719 4272 3287 5703 6708 2390 4987 4214 770 3487 6230 3498 6255 4963 1093 3065 2961 1663 4857 3224 4284 4228 106 1614 1010 145 1557 4510 1032 4632 155 5570 154 884 1204 2876 6163 5023 4593 7261 3729...

output:

55 33 46 34 10 33 34 30 22 33 33 46 10 34 26 100 14 62 17 9 13 35 81 45 23 29 23 20 11 32 11 32 29 38 18 13 14 0 28 13 11 42 35 22 9 57 22 22 35 7 52 7 14 45 72 92 14 8 15 62 10 20 21 34 66 9 20 24 29 6 30 16 26 9 6 27 8 40 85 17 12 26 29 17 10 61 35 9 39 15 14 14 31 22 63 66 110 24 16 7 30 22 15 18...

result:

ok single line: '55 33 46 34 10 33 34 30 22 33 ...5 15 71 10 52 18 16 30 10 34 4 '

Test #6:

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

input:

30 435
268435456 1024 67108864 16777216 134217728 131072 524288 512 256 8 32 64 33554432 2097152 128 2048 16384 8192 4096 8388608 65536 536870912 4 2 16 1048576 32768 1 262144 4194304
24 28
23 28
10 28
25 28
11 28
12 28
15 28
9 28
8 28
2 28
16 28
19 28
18 28
17 28
27 28
21 28
6 28
28 29
7 28
26 28
1...

output:

201326592 768 50331648 12582912 100663296 98304 393216 384 192 6 24 48 25165824 1572864 96 1536 12288 6144 3072 6291456 49152 402653184 3 3 12 786432 24576 3 196608 3145728 

result:

ok single line: '201326592 768 50331648 1258291... 786432 24576 3 196608 3145728 '

Test #7:

score: 0
Accepted
time: 8ms
memory: 8596kb

input:

430 92235
268435456 64 536870912 256 128 134217728 2 64 33554432 524288 1048576 268435456 1048576 512 32 32 8192 8192 8192 268435456 256 1024 16384 8 2097152 1 4 65536 268435456 32768 2048 512 128 32768 268435456 8192 4194304 16384 1024 4194304 128 33554432 67108864 1 512 16 128 16384 536870912 4 16...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #8:

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

input:

4815 185773
999998072 999997632 999995973 999998063 999999530 999999125 999999430 999998145 999999596 999997846 999999214 999998642 999997013 999995796 999999311 999996273 999996607 999996332 999995768 999996225 999996086 999996362 999997090 999997081 999998960 999996645 999996842 999998514 99999527...

output:

66 57 91 47 76 25 193 80 42 120 47 87 36 50 34 219 43 42 97 227 57 40 28 45 141 46 111 84 164 131 99 60 135 181 88 44 147 58 104 199 60 202 24 46 53 56 116 105 79 48 26 34 59 79 52 31 131 166 29 38 35 25 146 119 275 33 42 119 84 95 32 57 280 106 92 47 309 116 52 310 47 85 100 53 114 35 23 84 79 70 7...

result:

ok single line: '66 57 91 47 76 25 193 80 42 12...173 79 85 50 80 71 47 22 56 49 '

Test #9:

score: 0
Accepted
time: 50ms
memory: 17056kb

input:

98999 135802
999915141 999970725 999970117 999947993 999935245 999995293 999929471 999931920 999920419 999957183 999935027 999960800 999906092 999915777 999965089 999905949 999979021 999933691 999988435 999975097 999960084 999972032 999910145 999932210 999933979 999910318 999926596 999961902 9999664...

output:

67767 26917 -1 -1 38445 72454 29312 51112 -1 27742 53854 40947 73684 57120 58146 34789 53977 -1 33543 -1 26917 -1 29995 40427 30208 44827 41060 31384 49362 64479 29692 65900 25703 31337 -1 40560 21511 26288 56255 79786 32090 34373 40241 64207 37436 63306 -1 53100 41333 51042 30032 35731 -1 33762 -1 ...

result:

ok single line: '67767 26917 -1 -1 38445 72454 ... 77902 30701 65641 47833 85899 '

Test #10:

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

input:

4283 182226
262144 268435456 64 64 32 2 536870912 512 536870912 8192 134217728 16 131072 32 2097152 8192 32768 1024 1024 1024 8388608 256 65536 67108864 256 4 16777216 67108864 134217728 8192 8 67108864 134217728 4096 8 268435456 134217728 4096 128 8 4096 32768 8388608 256 262144 524288 536870912 33...

output:

229376 0 32 32 0 0 268435456 0 0 0 0 0 0 16 0 0 31744 0 512 0 4194304 0 32768 0 0 2 8388608 0 0 0 4 33554432 0 2048 0 0 0 0 0 0 0 16384 0 0 0 262144 402653184 16777216 268435456 0 0 0 0 32768 8388608 0 0 0 0 0 67108864 0 4096 0 0 1048576 0 0 0 0 0 512 0 16 0 0 0 32768 8192 1 0 0 0 0 0 0 0 2 4 0 0 0 ...

result:

ok single line: '229376 0 32 32 0 0 268435456 0... 0 0 0 12 0 0 0 0 50331648 2 0 '

Test #11:

score: 0
Accepted
time: 51ms
memory: 17572kb

input:

96917 161085
536870912 524288 131072 262144 128 268435456 1024 32768 33554432 8 4194304 8192 16777216 2048 16777216 2097152 8192 1048576 131072 1 512 1048576 8192 2 134217728 8192 1024 32768 524288 32768 536870912 131072 33554432 2 256 65536 128 8 16384 128 8388608 16 32 2097152 512 8388608 128 2048...

output:

-1 4193792 -1 262142 16256 268435200 2044 30720 33554416 536870904 4194272 4186112 12582912 2047 16777184 2097088 31744 786432 122880 131071 130560 1048575 1048572 4194302 -1 65528 15360 32764 524272 -1 536870911 4063232 33554424 2046 3968 63488 2064384 67108856 2031616 65408 8380416 65520 524256 20...

result:

ok single line: '-1 4193792 -1 262142 16256 268...8191 16777184 524280 536870848 '

Test #12:

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

input:

2276 189315
999997978 999999292 999998174 999999881 999999029 999997762 999998882 999998569 999999722 999999686 999997917 999998501 999997764 999999457 999999256 999999329 999998747 999997838 999998750 999998996 999997958 999999564 999999833 999998592 998940220 999999181 999998669 999998403 99999852...

output:

20 32 10 19 11 38 27 7 36 28 62 7 3 13 19 24 7 9 7 14 24 12 30 8 1057586 23 22 18 11 12 17 22 11 7 7 8 10 11 25 12 12 42 44 10 10 14 11 18 28 18 21 18 21 9 13 23 21 56 30 10 19 22 4 17 22 26 16 44 64 7 10 44 15 27 26 27 12 13 22 22 10 6 34 5 11 14 20 14 15 14 13 32 14 18 18 12 16 18 12 31 6 9 9 18 2...

result:

ok single line: '20 32 10 19 11 38 27 7 36 28 6...2 25 14 11 20 30 32 32 22 9 13 '

Test #13:

score: 0
Accepted
time: 48ms
memory: 15740kb

input:

92822 99949
999946646 999971953 999936903 999966043 999997604 999995940 999956577 999979354 999990943 999986032 999988993 999999390 999960794 999969467 999955426 999976112 999952521 999907752 999976247 999954381 999968368 999960021 999940315 999972523 999937486 999959537 999984892 999951681 99997891...

output:

-1 -1 -1 53275 45818 -1 48136 -1 55997 -1 45877 -1 -1 -1 -1 -1 43292 -1 61178 39212 -1 -1 -1 -1 -1 -1 -1 -1 71358 -1 -1 -1 -1 -1 51386 33011 -1 -1 -1 64729 89212 -1 71795 -1 -1 58797 -1 -1 -1 50767 -1 -1 66186 -1 88191 -1 -1 -1 -1 54061 57729 -1 -1 66785 62112 79833 -1 38845 -1 79137 88722 57106 -1 ...

result:

ok single line: '-1 -1 -1 53275 45818 -1 48136 ... -1 -1 39634 -1 47207 -1 -1 -1 '

Test #14:

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

input:

1898 176595
33554432 8192 2097152 16777216 16777216 16384 4194304 536870912 16777216 536870912 128 2097152 524288 1024 4194304 2048 16777216 32 2 8192 64 134217728 65536 262144 524288 16777216 8192 1 2048 8388608 8192 524288 4 128 67108864 16777216 512 4096 262144 8388608 32 1048576 128 67108864 102...

output:

0 0 0 0 0 0 0 0 0 0 0 1048576 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 65536 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 1048576 ... 0 0 0 0 0 0 0 0 0 0 8 512 0 0 '

Test #15:

score: 0
Accepted
time: 2ms
memory: 5880kb

input:

3 3
30 20 10
1 3
2 3
1 2

output:

20 20 20 

result:

ok single line: '20 20 20 '

Test #16:

score: 0
Accepted
time: 38ms
memory: 15972kb

input:

90733 119755
1024 536870912 131072 262144 4194304 64 65536 4194304 536870912 4194304 2 2097152 32768 512 2097152 262144 536870912 16384 4 268435456 8388608 16777216 4194304 65536 1024 2 4096 4 131072 8 2048 134217728 8192 67108864 512 1048576 16777216 16 1024 256 262144 33554432 524288 512 2048 2097...

output:

32760 536346624 -1 -1 4194176 491520 -1 -1 536739840 -1 134217726 2080768 -1 122880 2080768 536608768 -1 16769024 536870908 -1 58720256 16777214 4186112 33488896 134216704 -1 -1 262143 -1 268435454 32512 134216704 2096640 -1 32767 134217726 14680064 2064384 16777214 -1 -1 -1 133693440 523776 65280 1...

result:

ok single line: '32760 536346624 -1 -1 4194176 ...4400 268435452 260046848 65504 '

Test #17:

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

input:

1136 105665
999999847 999999319 999999467 999999562 999999034 999999858 999999716 999999892 999999579 999999506 999999714 999999013 999999313 999999349 999999924 999999686 999999404 999999932 999999629 999998975 999999287 999999469 999999695 999999075 999999956 999998959 999999550 999999575 99999988...

output:

10 11 11 10 2 3 7 6 4 8 17 12 9 3 17 6 7 7 9 6 4 6 8 10 13 5 5 4 8 8 4 5 18 14 8 19 16 7 11 6 8 3 8 7 4 8 13 4 11 7 3 9 17 7 7 6 6 30 5 1825632 8 3 3 14 5 10 8 3 26 8 10 8 7 5 12 4 4 4 12 7 5 21 7 8 7 6 3 6 4 3 8 5 9 14 3 15 9 9 10 7 4 8 15 17 10 4 13 8 3 6 9 6 7 9 14 12 27 10 7 12 9 7 7 24 8 20 5 5...

result:

ok single line: '10 11 11 10 2 3 7 6 4 8 17 12 ...8 7 5 7 8 7 9 6 5 3 3 19 6 3 5 '

Test #18:

score: 0
Accepted
time: 57ms
memory: 16824kb

input:

94990 136180
999973983 999982826 999980853 999938836 999967770 999965770 999941129 999915204 999976045 999920385 999958274 999990147 999910492 999982595 999918907 999925659 999975482 999972917 999907885 999950160 999972694 999922674 999956135 999941366 999927742 999911824 999909804 999994395 9999379...

output:

-1 49024 23374 41131 60747 22924 -1 24913 26324 24913 -1 49666 81625 -1 64027 41273 34764 24977 56108 -1 59038 -1 29107 63237 21887 -1 89246 -1 43366 45569 63370 59252 44135 -1 44112 29494 70707 -1 61190 33299 55281 53231 40337 87225 22388 31262 32601 47518 31221 37560 -1 75611 73879 81775 49890 219...

result:

ok single line: '-1 49024 23374 41131 60747 229...297 24428 -1 68961 44312 27340 '

Test #19:

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

input:

2547 104496
1024 32768 16384 16384 128 16384 16384 512 128 134217728 8192 524288 33554432 1024 2097152 512 67108864 4 8 8 16 4 536870912 4096 16 8192 32 134217728 64 16 33554432 1048576 2 536870912 8388608 64 32 256 536870912 64 32768 8 4 8388608 536870912 32768 16384 8 256 524288 2048 1 2097152 8 1...

output:

0 0 0 8192 96 12288 0 0 64 67108864 0 0 16777216 512 0 0 0 0 0 56 0 0 402653184 0 0 0 0 67108864 32 0 0 524288 1 268435456 4194304 0 0 0 0 32 0 0 0 0 0 16384 8192 4 0 0 0 0 1572864 0 0 0 0 0 4096 0 0 262144 1536 0 0 0 0 32 0 32768 32768 512 25165824 4096 4 0 512 0 0 16384 0 0 12 0 0 1 0 196608 0 2 2...

result:

ok single line: '0 0 0 8192 96 12288 0 0 64 671...134217728 0 0 0 0 0 0 0 0 8192 '

Test #20:

score: 0
Accepted
time: 41ms
memory: 16068kb

input:

94990 102420
8192 131072 4096 262144 524288 262144 512 4194304 2048 32 33554432 16384 2097152 524288 2 16 16 16 262144 131072 128 33554432 32 134217728 2 1 65536 16 4194304 8388608 268435456 4194304 8 268435456 16 16777216 131072 268435456 1 1 2048 512 8192 4096 1024 536870912 64 1 4 512 262144 6710...

output:

67100672 524284 -1 -1 -1 -1 -1 -1 -1 2031616 33553920 -1 -1 -1 -1 -1 -1 -1 -1 -1 8323072 -1 8380416 -1 33554430 -1 2095104 -1 -1 -1 -1 267386880 -1 -1 -1 -1 -1 268402688 -1 -1 268435455 524286 -1 134217724 2097120 536805376 134213632 -1 262128 -1 -1 -1 8388592 66584576 -1 134217727 2097144 8388480 -...

result:

ok single line: '67100672 524284 -1 -1 -1 -1 -1...4217472 -1 -1 -1 -1 1048448 -1 '

Test #21:

score: 0
Accepted
time: 59ms
memory: 17828kb

input:

93504 140254
252571116 474658570 497208431 243826610 12884391 412407613 797944191 872580102 496583302 661594577 606155886 573336212 409153391 20035879 338180890 313771031 958966673 211196165 820182360 900824261 944666698 169166067 904437481 83006698 793232851 92440436 917809518 324053456 452975528 2...

output:

379245564 434019031 369760018 343071715 845777735 209572509 433544081 404612758 451932524 344246994 334080969 522814018 403426646 573857544 561496591 499953892 385909754 529124941 725233301 377833370 687652359 599053304 297331750 225049060 205585295 602678701 502329444 310735514 330414181 358218597 ...

result:

ok single line: '379245564 434019031 369760018 ... 492061555 292498254 320548015 '

Test #22:

score: 0
Accepted
time: 53ms
memory: 18592kb

input:

92708 139060
29492862 11687217 858267302 103888622 654270198 757049373 702153551 397308221 298066413 205128932 350580011 127258333 376423539 170656085 883996400 990630238 581375021 545299112 992953840 683334419 390608964 545890631 77809482 651794030 263378765 797892705 885095320 908162407 964818309 ...

output:

7528 11231 18915 10726 15435 18621 9944 5976 6399 27920 25248 6635 17210 32772 34547 11512 17788 14057 1158 11936 24370 20572 19299 46520 10656 18439 19886 14885 20168 26427 10753 15064 17248 22418 8840 27699 7828 7339 41575 42680 14294 29942 11251 16925 8908 14197 17798 13433 10665 17335 11924 2181...

result:

ok single line: '7528 11231 18915 10726 15435 1...5 10463 35475 29949 8755 39422 '

Test #23:

score: 0
Accepted
time: 47ms
memory: 16996kb

input:

90656 131444
340113100 458881838 233820102 981524094 978131814 340754776 928273232 588614007 287250079 917831417 588954466 188116386 469995342 168914144 370960055 813017920 916589164 771794602 550025586 170037726 389764527 117808463 821663883 208823731 572467324 308303638 469827856 979296245 6291402...

output:

500835138 193045769 419503448 604832139 513965490 391429713 600293958 676719382 586039680 557879250 256745138 568704305 698190031 498027260 328591766 637571100 556750674 480083186 396350726 613174120 369675334 774063314 364708899 227565056 256333940 664319427 140289310 259111395 434443767 540839201 ...

result:

ok single line: '500835138 193045769 419503448 ... 331635646 278307831 589772093 '

Test #24:

score: 0
Accepted
time: 44ms
memory: 16792kb

input:

93726 117249
855064465 739161961 714101350 824165076 453787042 289608569 377708552 251017467 518083695 298164346 104676701 137482213 531051537 260094024 511047694 453019967 273293742 400806807 205146707 98871782 473189049 833882576 872350570 901329227 21869978 520218896 855944108 365796469 193407102...

output:

776748803 620689292 765354541 787203171 860994209 484652408 759854930 680114726 581979542 680282679 775700584 764992067 686645381 477966509 384296750 477053230 306752857 627414033 347253160 629676716 530246634 494908066 561878068 147084416 536249807 902789009 810042416 525795140 425201572 541422587 ...

result:

ok single line: '776748803 620689292 765354541 ... 721417080 750160936 409530364 '

Test #25:

score: 0
Accepted
time: 41ms
memory: 16012kb

input:

90950 93259
447011512 249434675 818313499 837811295 549907854 251720472 978738540 401324424 353562251 567825033 214897835 631053693 462089346 80526286 972696406 837760074 641587936 661665261 521106995 337730067 875182892 763179478 546737934 11488675 500332740 251060470 29354033 684632836 912462437 1...

output:

697081382 875405508 906683285 810153167 952623557 820774249 855132269 926780077 932434684 801457926 918908905 822429118 911412736 716576398 970951814 945541226 939130017 912194069 956449650 799370716 875533618 843814112 672183372 971169165 936994157 882019982 936499862 967619360 899166024 826523302 ...

result:

ok single line: '697081382 875405508 906683285 ... 902014112 629615225 956089812 '

Test #26:

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

input:

3 3
1000000000 1000000000 1000000000
1 2
1 3
2 3

output:

0 0 0 

result:

ok single line: '0 0 0 '

Test #27:

score: 0
Accepted
time: 44ms
memory: 17068kb

input:

99018 101504
839840120 229104548 247998906 859226114 443449351 698467647 758933937 891076216 960336934 566338643 168384088 449146787 354633591 18748929 38609467 748890147 362636445 124330094 951895089 161844720 624162787 957480563 185910386 203804927 575631805 43942130 357917481 516787299 268887534 ...

output:

81076 43413 63954 63360 69668 88352 66587 85009 82789 40404 35990 62452 49178 37050 59800 62330 88217 55055 50888 52115 71207 68928 76375 72167 51503 67196 63411 39671 60081 71367 73641 68218 41332 38130 39450 66185 48304 87838 62963 62725 46976 64200 83158 48682 54211 46299 59567 62636 93496 63056 ...

result:

ok single line: '81076 43413 63954 63360 69668 ... 72053 76302 69163 86582 59925 '

Test #28:

score: 0
Accepted
time: 44ms
memory: 15060kb

input:

95076 95075
999334049 845203489 829064587 117149900 250257051 348165966 522588105 633863670 621854269 750498046 796621117 129111454 516874841 822747709 497600437 467360231 812249354 376558527 795709536 48199641 481418333 91922103 487455846 966424611 710073070 552204640 812009735 163443717 121376331 ...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #29:

score: 0
Accepted
time: 40ms
memory: 16344kb

input:

94101 94100
349657857 781670068 162670138 68723767 852748209 832893076 823840804 984296057 920025618 471866029 971696248 141787402 37943514 855019160 925989123 63788383 904134683 793769973 597770817 970097859 944593056 437877343 92176841 935225600 536934837 785684002 258290370 205720377 385630306 40...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #30:

score: 0
Accepted
time: 43ms
memory: 16652kb

input:

98692 98691
922289605 761443166 341213076 256931982 255787533 317239190 262027125 410782044 696169678 195261901 956988505 187283747 370191629 923089854 6652470 155560057 592551191 926826544 667206033 59506587 936582028 606084535 847124907 664518901 32799907 757847669 752774657 431989813 329079086 23...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #31:

score: 0
Accepted
time: 39ms
memory: 17784kb

input:

98852 98851
34723148 310670108 484193924 583893661 720967713 83441800 234834858 91394285 453405115 169755326 573142510 528617 391042650 736306706 427691753 344423883 189094871 457133205 428126895 142707738 159620431 524346392 59308167 987739801 941106224 456777804 509157351 337508612 853707441 95342...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #32:

score: 0
Accepted
time: 55ms
memory: 18076kb

input:

90943 200000
609706135 58122286 374876015 618784019 256774332 639707652 238286761 183661256 87609199 98282180 43577784 199586795 565634762 228961725 23168460 225128102 53220522 34466881 605010180 141400126 261807328 889020341 537165510 48070934 252699410 205764098 736194770 164969201 257436055 72635...

output:

-1 129298345 -1 343506356 195408372 612632110 36990902 91616407 187668464 -1 635157183 -1 290357099 427317843 801354982 426083728 116830240 240810782 505306224 776431441 106578457 578642112 179197795 160934127 710206454 129050941 460917107 110308462 162126875 567902133 -1 551188887 427744549 -1 2136...

result:

ok single line: '-1 129298345 -1 343506356 1954...1 37177677 100796545 140019918 '

Test #33:

score: 0
Accepted
time: 60ms
memory: 18608kb

input:

98088 200000
557426653 944770717 724264842 585263238 868565452 539961199 655253135 888604032 260958866 310898581 172704172 448356518 856707975 965977027 80865591 404505902 26800426 42229727 211897013 759617363 53271195 567206124 928353260 681564479 939240394 81121098 973582028 232010168 781948214 95...

output:

109854382 397149860 373664105 204799277 320944595 10075120 286063065 175010481 327614048 454761768 708503359 130105779 309087118 418356170 466755266 312410544 454270803 -1 481791370 211996506 -1 264365318 906551500 133943622 363462035 466499759 396270135 315610689 179570714 348132103 -1 164055135 85...

result:

ok single line: '109854382 397149860 373664105 ... 239453049 266019601 568045423 '

Test #34:

score: 0
Accepted
time: 42ms
memory: 18364kb

input:

95998 191993
221324820 302165997 197518448 215275018 79268840 609672659 116365125 542475706 356834834 503113271 8406671 36599788 731231718 49296126 71333561 121134227 90739624 54947451 91422071 71637971 518769397 101725445 384673847 172002146 593978670 74689948 441476670 113190848 24208875 59388217 ...

output:

135906138 267396050 155183585 107284444 139684766 511161142 513531629 532081835 288643269 419979799 432919420 436474603 614931165 361378405 394703145 577542455 703971710 491948184 278854056 77637241 403668857 487814986 290163101 142810270 510460670 460465005 314591307 88572882 494731057 274609610 40...

result:

ok single line: '135906138 267396050 155183585 ... 552524112 774362581 514051373 '

Test #35:

score: 0
Accepted
time: 43ms
memory: 17884kb

input:

100000 100000
386476757 191748921 593516089 321934164 829833057 38461855 826653887 351919980 327920084 282968094 219097145 132254146 532479679 488738764 945642359 401126775 196563011 256528133 370754478 947907900 171182372 497947277 647839744 302182525 751255562 585439858 537091549 761604704 4351362...

output:

999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 ...

result:

ok single line: '999966734 999966734 999966734 ... 999966734 999966734 999966734 '

Test #36:

score: 0
Accepted
time: 40ms
memory: 20220kb

input:

100000 199997
24624 43011 4563 66303 41067 30099 10631 62022 84718 76143 90418 18032 47477 73050 75524 91122 68568 83177 57962 56710 40377 11002 10937 37866 23318 68969 72589 2283 44969 74941 50406 94543 13182 84200 52622 90667 47590 71567 87715 71719 24914 82127 92218 79627 83229 54887 76737 99359 ...

output:

24623 43010 4562 66302 41066 30098 10630 62021 84717 76142 90417 18031 47476 73049 75523 91121 68567 83176 57961 56709 40376 11001 10936 37865 23317 68968 72588 2282 44968 74940 50405 94542 13181 84199 52621 90666 47589 71566 87714 71718 24913 82126 92217 79626 83228 54886 76736 99358 38830 99474 25...

result:

ok single line: '24623 43010 4562 66302 41066 3... 11920 80352 10558 82466 63762 '

Test #37:

score: 0
Accepted
time: 2ms
memory: 5760kb

input:

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

output:

8 8 -1 -1 8 8 

result:

ok single line: '8 8 -1 -1 8 8 '

Test #38:

score: 0
Accepted
time: 49ms
memory: 20796kb

input:

100000 199997
95877 6369 14355 68573 81499 17335 86287 99287 1474 28163 47205 35802 71634 11582 92995 41365 78698 9160 41293 3040 25882 88014 8974 37532 49080 30724 28568 28575 88946 71027 80169 72039 58913 9145 61007 95221 89586 38381 88755 75527 5707 92973 80548 85366 53606 36902 72798 57750 40158...

output:

4123 93631 85645 31427 18501 82665 13713 713 98526 71837 52795 64198 28366 88418 7005 58635 21302 90840 58707 96960 74118 11986 91026 62468 50920 69276 71432 71425 11054 28973 19831 27961 41087 90855 38993 4779 10414 61619 11245 24473 94293 7027 19452 14634 46394 63098 27202 42250 59842 80680 81311 ...

result:

ok single line: '4123 93631 85645 31427 18501 8... 37089 46357 23831 60273 88030 '

Test #39:

score: 0
Accepted
time: 55ms
memory: 20212kb

input:

100000 199927
70185 94269 61558 80726 13911 66129 30942 77915 3501 83948 85168 99158 35584 93963 20355 66993 96032 72280 61092 57492 99151 65872 31627 30638 57955 35437 67469 40120 31088 68124 14493 61314 52508 88064 17227 95369 6666 88255 11323 69581 85862 67173 18243 89983 19908 83842 32308 19716 ...

output:

70184 94268 61557 80725 13910 66128 30941 77914 3500 83947 85167 99157 35583 93962 20354 66992 96031 72279 61091 57491 99150 65871 31626 30637 57954 35436 67468 40119 31087 68123 14492 61313 52507 88063 17226 95368 6665 88254 11322 69580 85861 67172 18242 89982 19907 83841 32307 19715 24359 28122 99...

result:

ok single line: '70184 94268 61557 80725 13910 ... 42195 82518 32242 64246 93342 '

Test #40:

score: 0
Accepted
time: 54ms
memory: 19444kb

input:

100000 199997
91900 33235 83095 26726 69788 41596 58286 23643 37775 39647 7535 85260 52020 16907 81931 95839 74487 7293 36177 26066 28685 558 88441 49109 19245 93609 39515 64963 32568 71656 45435 43343 19874 23814 48275 95263 74523 81615 20375 13893 87817 58249 425 70046 1217 55285 56601 61666 73995...

output:

90454 66765 81833 73274 68782 58404 57501 76357 62225 60353 81774 83952 51347 81774 80688 94317 73382 81774 63823 73934 71315 54130 87063 50891 80755 92133 60485 64053 67432 70615 54565 56657 80126 76186 51725 93753 73417 80379 79625 81774 86453 57464 60688 69035 79476 54554 55844 60819 72901 62543 ...

result:

ok single line: '90454 66765 81833 73274 68782 ... 76871 56486 69551 80460 81774 '

Test #41:

score: 0
Accepted
time: 58ms
memory: 19496kb

input:

100000 199899
21855 70001 34105 82425 25104 32896 83577 85761 63682 70175 6985 32070 3471 4346 84486 29560 88601 76510 40063 1602 71042 55930 87348 13099 74225 84279 38234 85494 18397 54726 38736 64011 52759 7491 17151 70500 50964 48880 3050 40333 95184 59610 55665 95882 85178 35684 26600 1913 74607...

output:

21854 70000 34104 82424 25103 32895 83576 85760 63681 70174 6984 32069 3470 4345 84485 29559 88600 76509 40062 1601 71041 55929 87347 13098 74224 84278 38233 85493 18396 54725 38735 64010 52758 7490 17150 70499 50963 48879 3049 40332 95183 59609 55664 95881 85177 35683 26599 1912 74606 36353 34683 8...

result:

ok single line: '21854 70000 34104 82424 25103 ... 33174 46653 17783 83297 63591 '

Test #42:

score: 0
Accepted
time: 56ms
memory: 20188kb

input:

100000 199997
91615 1063 871 38749 61071 74089 79966 37495 54547 4902 879 12868 40299 90047 32130 42661 7536 36141 7608 32898 9597 33111 86951 69638 43631 56474 22642 7399 53081 72812 96116 5747 89781 79668 52717 16972 65444 51353 61518 29172 48647 15748 38440 31126 65308 65099 30655 10160 64280 231...

output:

90993 58685 58685 58685 61025 73789 79567 58685 45453 58685 58685 58685 58685 89453 58685 57339 58685 58685 58685 58685 58685 58685 86421 69413 56369 43526 58685 58685 46919 72535 95412 58685 89192 79273 47283 58685 65313 48647 61462 58685 51353 58685 58685 58685 65182 64977 58685 58685 64173 58685 ...

result:

ok single line: '90993 58685 58685 58685 61025 ... 70170 57453 58685 58685 56828 '

Test #43:

score: 0
Accepted
time: 62ms
memory: 19484kb

input:

100000 199970
96120 96183 68363 86413 5753 98272 33806 34305 67565 4782 88759 8596 91218 52339 79909 81895 56907 40647 12785 81022 16690 95661 53791 13173 72470 56478 62229 4893 54058 7311 80768 16222 29033 33018 90217 14901 62553 74185 28862 75952 8923 25476 64639 84252 12053 71154 94730 78185 3796...

output:

96119 96182 68362 86412 5752 98271 33805 34304 67564 4781 88758 8595 91217 52338 79908 81894 56906 40646 12784 81021 16689 95660 53790 13172 72469 56477 62228 4892 54057 7310 80767 16221 29032 33017 90216 14900 62552 74184 28861 75951 8922 25475 64638 84251 12052 71153 94729 78184 37962 32807 75383 ...

result:

ok single line: '96119 96182 68362 86412 5752 9... 59169 76461 86306 59136 17471 '

Test #44:

score: 0
Accepted
time: 46ms
memory: 19356kb

input:

100000 199997
27229 83347 77865 80111 50444 98036 69976 88515 41844 58241 13862 78568 41034 27153 21844 21606 13641 26592 99291 12766 77558 83806 44536 65554 79258 5690 48350 42363 27026 89498 16936 51956 45285 40556 33395 41833 83038 65680 97127 65684 5480 45329 22150 13225 12609 50236 51873 54944 ...

output:

53187 82750 77379 79585 49556 97147 69645 87809 53187 58143 53187 78072 53187 53187 53187 53187 53187 53187 98379 53187 77078 83202 53187 65313 78748 53187 51650 53187 53187 88774 53187 48044 53187 53187 53187 53187 82446 65436 96258 65440 53187 53187 53187 53187 53187 49764 48127 54902 62812 76031 ...

result:

ok single line: '53187 82750 77379 79585 49556 ... 53187 53187 53187 63265 78055 '

Test #45:

score: 0
Accepted
time: 49ms
memory: 17308kb

input:

100000 150000
6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6931 6...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #46:

score: 0
Accepted
time: 50ms
memory: 18624kb

input:

100000 199996
243129336 523727586 15429871 772510726 918721553 372328408 664603396 128038777 220667716 929153268 679023443 360179352 924551546 481121415 501101646 467987913 560591418 301786270 38648626 264052408 616009799 87929958 163872242 658664090 933271308 530366178 146394131 534715503 892480873...

output:

511241613 22095627 946175524 545939115 417089594 254015118 162971437 373607303 280981007 427521309 177391484 141454417 422919587 20514417 530313 33644046 120689823 199845689 462983333 469909798 114384824 413702001 668706202 157046837 431639349 28734219 355237828 68916519 390879264 340025608 23320239...

result:

ok single line: '511241613 22095627 946175524 5... 264004177 163021420 457621409 '

Test #47:

score: 0
Accepted
time: 69ms
memory: 19228kb

input:

100000 199996
344082472 230670730 609942303 711596179 168383371 587092133 304902215 781809807 603874749 749335751 284321744 969151316 286518513 314605570 161241384 675937390 992035393 648086060 490539275 839099359 219333327 933207901 789549003 268433532 805010569 437624924 519698940 15528516 2920852...

output:

344075920 230665584 390918305 419868468 168376819 415464193 304895663 562983553 397476215 496040690 284315192 938293424 286511961 314599018 161234832 350579612 984010158 353214981 29256219 676941569 219326775 865856204 578475577 268437019 609707887 437618372 37538752 968661093 292078745 373810847 34...

result:

ok single line: '344075920 230665584 390918305 ... 501509504 852366123 438129579 '

Test #48:

score: 0
Accepted
time: 2ms
memory: 5756kb

input:

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

output:

8 -1 8 8 9 -1 

result:

ok single line: '8 -1 8 8 9 -1 '

Test #49:

score: 0
Accepted
time: 68ms
memory: 18668kb

input:

100000 200000
378645709 153728114 377447416 302555021 914165046 630764431 366505993 973294663 162843189 155968553 116537848 835230803 345200189 217364263 819370538 331473462 681426579 493693058 374817332 148358490 230561807 135295684 644633758 729366790 488177203 363864420 849297055 644211385 257729...

output:

68689906 693127025 242775366 392343816 827611964 263651853 264960967 3393740 674278276 688713791 413556364 670359632 308398007 424889080 293844637 334174104 364515884 10830481 247843525 704003222 379068104 453148532 291055505 460796108 12541973 143474259 243288827 290176219 482296248 840419069 33406...

result:

ok single line: '68689906 693127025 242775366 3...5 41088449 552088366 743930672 '

Test #50:

score: 0
Accepted
time: 72ms
memory: 18700kb

input:

100000 200000
97177197 103760981 643101477 303839165 537238579 302525568 410708308 1890547 299088838 217946445 429386996 892114158 373577957 395435164 98825324 663733933 696650853 225367474 995467897 891603849 109269994 152700044 635235521 453758806 993078068 860697414 690890710 166040198 873980651 ...

output:

806245242 793615954 283802253 393390326 74147479 396139080 180639736 996110396 402426693 237326013 143370687 782904592 111500355 152703516 802826848 299941897 392291318 549826226 524075323 554940232 782775617 695029555 268518358 93494243 985416197 720310291 381376669 573709363 746606824 239869696 98...

result:

ok single line: '806245242 793615954 283802253 ...11 217325614 76080648 88751466 '

Test #51:

score: 0
Accepted
time: 59ms
memory: 18684kb

input:

100000 199996
590829791 430917118 101856541 324398143 779919756 491802364 681386951 750316470 426283949 366874051 670162028 800773899 439740095 458184043 113990440 473259215 738051318 758334686 836270068 425450935 970699065 146834723 110181309 373998489 41181243 383963578 700636719 731822430 8611927...

output:

181899675 70602882 85517486 347613339 278406359 9717636 179866951 248796470 75243532 134649665 343404148 299253899 121860289 43335957 73383970 54982101 236531318 256814686 674679356 149587974 941813652 40524686 77178100 251038788 146178166 117556422 405857118 467163751 724161910 107290423 794418132 ...

result:

ok single line: '181899675 70602882 85517486 34...6 276847641 103758829 39197817 '

Test #52:

score: 0
Accepted
time: 61ms
memory: 19236kb

input:

100000 199996
661123346 285985990 646743535 952134844 382908532 219585541 442316967 419250603 509438989 603736944 267327357 863576697 755087385 897671158 8377468 730996195 154613778 814131089 751271147 435501315 285642852 889121948 588654750 473674936 24847602 490034771 443126221 29570370 925565777 ...

output:

323110268 117761063 294726141 47859324 214683605 51362569 274092040 251025676 323979877 228752866 99102430 136417471 511428304 102323010 984022296 463195848 692869883 627679855 503693541 267276388 427030578 110879541 243537578 305450009 952211794 321809844 274901294 942771274 848499298 466645217 578...

result:

ok single line: '323110268 117761063 294726141 ... 230863926 556497203 503630622 '

Test #53:

score: 0
Accepted
time: 72ms
memory: 18600kb

input:

100000 200000
173453569 116691185 723850107 370684597 774043808 824458808 348208930 403576106 119913457 424427056 214020925 852859272 999583430 546665609 179951471 847290687 592916523 141166125 26724371 840554545 440909983 192404442 217292341 208742762 900537881 303831628 318992037 914347499 6309711...

output:

653901308 767152239 263064899 258815139 162439755 448956532 74084400 193567535 88366474 151718505 200281054 116283869 1963369 45660570 640922924 693489832 85182525 720470813 29913612 588925048 42533381 615310726 207948560 559613931 371889453 149049664 361663165 36965956 262015623 119884038 453442104...

result:

ok single line: '653901308 767152239 263064899 ...641 74840369 51941104 34719281 '

Test #54:

score: 0
Accepted
time: 68ms
memory: 18668kb

input:

100000 200000
914765489 3141800 692612768 446074813 196172456 925992284 69722092 463436148 820497947 724471339 584611898 971453396 852403301 105008653 757543796 911042072 304790551 367881172 16002271 460145919 833628935 955679341 646713913 248646232 469782322 531565591 105734780 331305803 404514460 ...

output:

829735792 813405792 248582956 104673454 196431690 851907572 654367015 7921511 529804772 450478348 50403874 524290831 703073322 217045572 514397014 822285920 388983105 197578232 885122001 9192459 666630535 910450677 292945748 252832933 5412140 1731280 607252191 336469071 190223556 152753374 815206644...

result:

ok single line: '829735792 813405792 248582956 ...984 128112 327491588 944050192 '

Test #55:

score: 0
Accepted
time: 33ms
memory: 13304kb

input:

50000 149993
432850965 10949945 775909783 722839855 221938261 215692743 768474818 685085770 227296882 602590698 522275553 323855435 881455812 812943800 619959905 304005801 660540591 32253733 167248798 531665663 143635770 245146770 749797503 797627818 461449486 156312041 304385876 431156284 331032330...

output:

61671960 483572980 281406645 228316930 221946773 215692619 546752838 190562845 227296758 108067773 27752628 323855311 386932887 318420875 125439669 190517124 166019767 32297412 167269488 37142738 350887155 245146646 255299682 303104893 33080712 156311917 190174934 63376260 163490595 237310223 116223...

result:

ok single line: '61671960 483572980 281406645 2... 109239656 533428279 319547575 '

Test #56:

score: 0
Accepted
time: 70ms
memory: 18912kb

input:

100000 200000
973752136 628506421 935418387 702677427 394471682 733621060 961800026 151217267 340059619 307423805 251561548 853162024 283622689 138396689 239322739 46196617 458199390 838774712 31410083 462273986 621265562 304285543 109960355 671046192 204172498 112634308 150191536 587241154 34765916...

output:

22692479 9878922 11572590 4345458 22328494 32484502 116999194 637566 4235673 72464433 91020898 55473697 52449866 45600713 76687172 35658522 18478046 4645844 403537791 7240202 26264463 7968147 226692483 1126515 4779746 646639980 185299221 2722728 137697025 632291977 4668470 23952479 2687859 973165505...

result:

ok single line: '22692479 9878922 11572590 4345...49881 83771247 637566 43455825 '

Test #57:

score: 0
Accepted
time: 69ms
memory: 18904kb

input:

100000 200000
498275958 803393401 734216526 951558606 806395740 596640130 8085476 837308352 164551283 703494363 402126504 202879479 267469018 419905654 328472075 6609666 754669607 930284756 192008076 631007320 431015477 133475099 602171532 9169224 686363142 741424012 591222318 558328613 553693451 97...

output:

3465636 16147552 62534265 7500550 130088130 1618747 -1 5665010 -1 204753958 15331039 128208553 4499809 -1 -1 279114571 10994215 50806972 10941395 2243662 27319986 14489874 -1 -1 38854696 -1 -1 12052756 -1 55953746 101477782 28757384 18331165 231794696 11702603 143577452 7316455 -1 103560 15349125 -1...

result:

ok single line: '3465636 16147552 62534265 7500...553 -1 420103359 9071141 -1 -1 '

Test #58:

score: 0
Accepted
time: 71ms
memory: 18880kb

input:

100000 200000
823602757 175184002 515236215 371101409 700987703 584640358 616034231 664903156 904013536 396649840 135163528 410234226 525008384 340472118 810110233 818336821 912946170 660587360 44497781 502392294 225286031 900099710 117608115 533409491 356785643 225168006 984446744 673526168 1460323...

output:

644485874 89852178 4569205 35306055 76807112 32228438 63693691 44653147 227812433 20532920 344600495 63861038 59181125 324486273 405765020 -1 224387128 271971895 80765915 3382335 185060137 589264041 758703306 67499789 42417410 375612045 289244417 343154164 290305255 663055859 36570360 737024142 2510...

result:

ok single line: '644485874 89852178 4569205 353...9 617987348 145459985 54539811 '

Test #59:

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

input:

10 11
67 81 92 52 22 33 85 51 66 12
1 8
7 8
6 8
1 5
5 7
4 6
4 9
3 9
9 10
2 3
2 10

output:

63 69 69 -1 63 -1 63 63 69 69 

result:

ok single line: '63 69 69 -1 63 -1 63 63 69 69 '

Test #60:

score: 0
Accepted
time: 64ms
memory: 19488kb

input:

100000 200000
564324219 101498423 371950743 346672234 412560860 982691394 459969394 484256429 567593929 150926604 918287 240028812 710446469 427629164 747377001 407351433 25407442 715060603 272485941 146494289 988959216 504959652 884382100 685624853 218431581 93374709 292188295 125500210 180472221 8...

output:

127120617 325005018 163158779 57590535 -1 302730823 74320326 18036143 23065378 225733354 172276230 -1 -1 50148765 107173927 -1 545196779 -1 -1 -1 -1 -1 634361032 -1 116763977 635908175 -1 -1 -1 834122258 -1 -1 263356160 276207111 328849865 -1 111231048 -1 -1 252823993 93009970 -1 -1 -1 -1 -1 -1 3824...

result:

ok single line: '127120617 325005018 163158779 ...3808324 -1 332947510 100325104 '

Test #61:

score: 0
Accepted
time: 62ms
memory: 17604kb

input:

100000 149998
353260884 921286552 987914259 636386041 723423473 858077121 122548335 826029238 970478718 810577412 553135486 577733238 390714003 625213739 423480534 619422639 425251056 812165720 170490729 925048099 693381880 89774905 394480288 561189383 782356994 978984635 26307291 31456203 545202650...

output:

143855663 844652879 490843845 139311473 226354423 361039270 374526549 328954670 473404150 313525325 56077681 156709336 106381012 251234209 73624663 240289691 71823512 315091152 656266316 427973531 196370241 407323643 102594280 64114815 285313311 481939681 470771162 936658767 48138850 54116743 367923...

result:

ok single line: '143855663 844652879 490843845 ...6 323144080 77764809 243143418 '

Test #62:

score: 0
Accepted
time: 73ms
memory: 18652kb

input:

100000 200000
527606060 222493670 430939813 331326819 555249116 672743826 75116244 21293390 442986487 600074262 585489964 475119131 200453204 297075520 134087553 631561894 648130088 313722841 419263544 128959988 357890045 67154175 572993961 690808782 541891807 632997233 111175927 628567791 819562803...

output:

206630467 234965587 162076425 35863004 221082399 200063505 233364238 314888410 186808528 100332807 259286777 164247758 140945932 104972222 310960997 561034946 113256668 181870070 139370821 442554022 20517880 174043498 265765570 196037881 380624352 223033436 478415557 529016291 248326533 50190251 111...

result:

ok single line: '206630467 234965587 162076425 ...5 145315430 169011055 34474087 '

Test #63:

score: 0
Accepted
time: 71ms
memory: 19476kb

input:

100000 200000
199491332 273945277 569967304 16878229 95185462 748404958 556762795 150106597 106442332 8198861 40714805 382377775 236454422 275981338 483149997 376893077 60915592 103522712 280275230 372561642 170827416 653874015 247034144 41657771 819923388 510986679 98398527 34038598 544666612 96908...

output:

-1 -1 202805603 -1 78333734 214134715 421945739 -1 290370334 -1 -1 -1 140283510 -1 -1 169619936 -1 -1 -1 -1 -1 282103477 264034248 -1 224415465 -1 -1 -1 39590680 420141379 -1 -1 756751082 -1 -1 183401147 -1 343290595 527542566 182067459 -1 42409861 -1 -1 258400727 281572113 43677560 -1 -1 -1 -1 1404...

result:

ok single line: '-1 -1 202805603 -1 78333734 21...75601 -1 331868998 -1 92235676 '

Test #64:

score: 0
Accepted
time: 54ms
memory: 19212kb

input:

100000 200000
741964095 21085690 51323549 205611126 822141033 194351657 155913491 17276571 227966455 181445493 154613616 734689669 471731759 24457824 69797385 899017660 227256482 478993018 362991682 22306334 96730212 745783349 463755212 773641476 268581823 877616628 85079515 111425687 206200052 9236...

output:

-1 -1 -1 11958789 -1 -1 -1 -1 54265953 15570301 4316303 -1 -1 -1 -1 -1 -1 -1 -1 -1 19712258 -1 -1 -1 23956942 -1 45564805 -1 76579022 -1 -1 -1 -1 71604195 -1 -1 -1 -1 -1 17053504 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 114122895 105892782 -1 6635269 -1 -1 -1 8229278 -1 -1 -1 -1 3517029 260123546 -1 -1 -...

result:

ok single line: '-1 -1 -1 11958789 -1 -1 -1 -1 ... 36373587 -1 -1 -1 10917987 -1 '

Test #65:

score: 0
Accepted
time: 63ms
memory: 18928kb

input:

100000 200000
577939200 168843821 298660096 161925373 499311704 226133920 37553275 385449483 228236400 169446681 171579285 642509727 148140118 549169792 144498311 162144202 196351166 811680222 327876939 340946564 939801121 425520743 133133212 25326257 698040762 133821519 366719079 603498238 69499127...

output:

549018995 227356531 32358300 122909500 207450208 206719504 485747296 205250746 109373682 226054567 179247420 323279769 269321031 67937530 125794250 240585275 172396496 811289025 260973256 112382281 628669773 286051849 298520810 330173624 323822673 297284202 234306973 603103228 322367694 283252641 79...

result:

ok single line: '549018995 227356531 32358300 1... 300149290 175542917 312071423 '

Test #66:

score: 0
Accepted
time: 53ms
memory: 19412kb

input:

100000 200000
89434840 336941186 175376237 16543672 760969288 667018204 132891840 189444764 237217621 703480947 456693447 410018064 368396874 978724601 471140679 885685100 884526242 402429688 484644212 56711483 919233161 164847721 412729326 438053112 105760817 647052025 371144557 619058487 145729214...

output:

-1 -1 174589164 -1 218729773 167420791 -1 -1 -1 248917928 -1 -1 -1 469933973 427972947 364279752 487464498 -1 -1 -1 868799280 -1 264835088 -1 -1 256754703 -1 618531621 771380409 -1 886324958 185364564 -1 438007009 170796014 -1 -1 309022217 -1 265620542 233964193 -1 -1 293097539 484879677 286495726 9...

result:

ok single line: '-1 -1 174589164 -1 218729773 1...2119658 126100619 495416890 -1 '

Test #67:

score: 0
Accepted
time: 60ms
memory: 19488kb

input:

100000 200000
456817863 967901544 478379293 432983633 439173434 800386964 618294803 473964562 895443858 672254765 571802240 58483234 841642159 845088699 711962434 723753100 794724458 537415870 97224043 37436941 357047524 133635655 360295783 60489213 87394397 472496332 814923093 974435047 925498416 6...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 8511571 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5481690 -1 23913821 -1 -1 -1 -1 -1 -1 -1 -1 26959673 -1 -1 -1 -1 9535016 2874493 -1 -1 -1 -1 -1 -1 -1 3971256 4085135 4150225 -1 -1 -1 -1 -1 -1 604655 -1 -1 -1 28551715 295797 -1 -1 -1 -1 -1 32825247 -1 88...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 13506524 -1 -1 -1 -1 -1 '

Test #68:

score: 0
Accepted
time: 48ms
memory: 16864kb

input:

100000 117637
480280895 202781544 325698052 478880362 203127566 383595570 53031922 981930665 189970637 233468120 84644002 86849085 16255978 596370310 734267819 570463009 483895268 764906915 870609185 684264069 401995188 702129215 905054838 101629693 643504113 248275307 106649691 947640731 410004826 ...

output:

846276177 588584066 218384186 906757919 402181162 559912372 922257591 215943289 578692300 731478338 437705449 364538236 -1 513036916 -1 -1 682028451 306488318 -1 142658019 545670293 201890150 368584402 369135723 501235177 729315301 -1 272430811 98137945 771645659 525693126 306574347 442240133 921820...

result:

ok single line: '846276177 588584066 218384186 ... 298731605 499138745 809737759 '

Test #69:

score: 0
Accepted
time: 52ms
memory: 16820kb

input:

100000 117559
913849543 714459705 218528143 825652704 749737999 516977905 36017785 698898239 307885045 153838960 617952158 16271912 550114983 99203548 615296445 826334724 506798852 630676122 708689915 605809801 639686873 657338605 500900552 172600017 385920304 667539853 500493422 73933306 979651079 ...

output:

706493702 -1 -1 441988781 528522376 -1 472558541 461120259 210612379 208335761 -1 471136231 711001031 -1 186086892 -1 322269086 544540109 -1 342750127 158675422 364924856 481259154 -1 414749977 448794467 -1 -1 914303107 -1 882818349 -1 -1 323282991 517661546 500819783 -1 -1 421087188 651348174 42571...

result:

ok single line: '706493702 -1 -1 441988781 5285...9111310 385164614 149635952 -1 '

Test #70:

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

input:

10 15
66 81 33 12 85 92 52 67 51 22
8 9
5 9
3 9
8 10
5 10
3 7
1 7
1 6
1 4
2 6
2 4
9 10
5 8
1 2
4 6

output:

26 26 -1 69 34 26 -1 34 34 45 

result:

ok single line: '26 26 -1 69 34 26 -1 34 34 45 '

Test #71:

score: 0
Accepted
time: 56ms
memory: 16852kb

input:

100000 117635
512309412 706729736 124615062 794855984 159856314 104077457 273808577 212185295 636479167 99398605 338956818 572667094 879609086 662472607 227192400 410704725 440244521 293231160 94313838 701607572 161886143 34070330 116447192 881057726 320301482 232895930 346774694 20100694 184286527 ...

output:

-1 888299353 308939081 549596090 -1 851898335 564039471 389730092 525108916 416172680 39724682 431333503 481587426 -1 582265149 -1 336573021 -1 355153697 -1 708364950 -1 669463964 352767163 -1 -1 898503498 931672945 495553313 -1 772966708 429348515 -1 -1 -1 471902979 622114757 -1 -1 766594270 621967...

result:

ok single line: '-1 888299353 308939081 5495960...8997173 943581359 -1 324591371 '

Test #72:

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

input:

10 45
999835731 589284011 999639054 843908835 993577974 999985538 999974908 957676055 997453497 999994557
2 4
4 7
4 10
3 4
4 5
4 6
1 4
4 8
4 9
2 7
2 10
2 3
2 5
2 6
1 2
2 8
2 9
7 10
3 7
5 7
6 7
1 7
7 8
7 9
3 10
5 10
6 10
1 10
8 10
9 10
3 5
3 6
1 3
3 8
3 9
5 6
1 5
5 8
5 9
1 6
6 8
6 9
1 8
1 9
8 9

output:

149807 368392044 335854 149669139 6061080 19649 19649 39777442 2382234 19649 

result:

ok single line: '149807 368392044 335854 149669...9 19649 39777442 2382234 19649 '

Test #73:

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

input:

36 630
123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123
10 28
8 28
18 28
11 28
26 28
3 28
28 31
7 28
24 28
17 28
15 28
28 36
2 28
25 28
28 33
13 28
20 28
28 35
6 28
28 30
22 28
23 28
16 28
28 34
14 28
28 2...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '