QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#930946#10149. 图排列RDFZchenyy52 372ms32616kbC++264.7kb2025-03-10 16:22:142025-03-10 16:22:15

Judging History

This is the latest submission verdict.

  • [2025-03-10 16:22:15]
  • Judged
  • Verdict: 52
  • Time: 372ms
  • Memory: 32616kb
  • [2025-03-10 16:22:14]
  • Submitted

answer

#include<bits/stdc++.h>

#define MAXN 200005

namespace sub1{
    int T,n,m,x,y;
    std::vector<int> g[MAXN];
    int li[MAXN],pos[MAXN];
    int vis[MAXN];
    int uu[MAXN],vv[MAXN];
    bool ok=false;

    void dfs(int lvl){
        if(lvl>n) return (void)(ok=true);
        for(int i=1;i<=n;i++) if(!vis[i]){
            int tag=0;
            li[lvl]=i;
            for(int x:g[i]){
                int y=pos[x]; if(!y) continue;
                for(int j=1;j<=m;j++){
                    if((!pos[uu[j]])||(!pos[vv[j]])) continue;
                    if(pos[uu[j]]<=y&&pos[vv[j]]<=y) continue;
                    if(pos[uu[j]]>=y&&pos[vv[j]]>=y) continue;
                    tag=1; break;
                }
                if(tag) break;
            }
            if(!tag){
                pos[i]=lvl;
                vis[i]=1;
                dfs(lvl+1);
                vis[i]=0;
                pos[i]=0;
            }
            if(ok) return;
        }

        return;
    }
   
    void run(){
        memset(li,0,sizeof(li)),memset(pos,0,sizeof(pos));
        memset(vis,0,sizeof(vis));
        std::cin>>n>>m;
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=m;i++){
            std::cin>>x>>y,g[x].push_back(y),g[y].push_back(x);
            uu[i]=x,vv[i]=y;
        }
        ok=false; dfs(1);
        for(int i=1;i<=n;i++) std::cout<<li[i]<<' ';
        std::cout<<'\n';
        return;
    }
    void main(){
        std::cin>>T; for(int i=1;i<=T;i++) run();
        return;
    }
}

namespace subc{
    int T;
    int n,m,x,y;
    std::vector<int> g[MAXN];
    int nxt[MAXN];
    int vis[MAXN],h[MAXN],t[MAXN];
    int st[MAXN],tp;

    void expand(int u){
        for(int i=u;i;i=nxt[i]){
            while(tp&&st[tp]<i) expand(st[tp--]);
            std::cout<<i<<' ';
        }
        return;
    }
    
    void dfs(int u,int fa){
        vis[u]=1;
        std::vector<int> tmp; tmp.push_back(u);
        for(int v:g[u]){
            if(v==fa) continue;
            dfs(v,u);
            tmp.push_back(v);
        } 
        std::sort(tmp.begin(),tmp.end(),[](int x,int y){ return h[x]<h[y]; });
        for(int i=1;i<tmp.size();i++){
            nxt[t[tmp[i-1]]]=h[tmp[i]];
        }
        h[u]=h[tmp.front()],t[u]=t[tmp.back()];
        return;
    }
    void run(){
        std::cin>>n>>m;
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=n;i++) nxt[i]=0,vis[i]=0,h[i]=t[i]=i;
        for(int i=1;i<=m;i++){
            std::cin>>x>>y;
            g[x].push_back(y);
            g[y].push_back(x);
        }
        tp=0;
        for(int i=1;i<=n;i++){
            if(!vis[i]){
                dfs(i,0);
                st[++tp]=i;
            }
       }
        std::reverse(st+1,st+tp+1);
        while(tp) expand(st[tp--]);
        std::cout<<'\n';
        return;
    }
    void main(){
        std::cin>>T; for(int i=0;i<T;i++) run();
        return;
    }
}

namespace subf{
    int T;
    int n,m,x,y;
    std::vector<int> g[MAXN];
    int nxt[MAXN];
    int vis[MAXN],h[MAXN],t[MAXN];
    int fa[MAXN];
    int st[MAXN],tp;

    void expand(int u){
        for(int i=u;i;i=nxt[i]){
            while(tp&&st[tp]<i) expand(st[tp--]);
            std::cout<<i<<' ';
        }
        return;
    }
    
    void dfs(int u,int fa){
        vis[u]=1;
        std::vector<int> tmp; tmp.push_back(u);
        for(int v:g[u]){
            if(v==fa) continue;
            dfs(v,u);
            tmp.push_back(v);
        } 
        std::sort(tmp.begin(),tmp.end(),[](int x,int y){ return h[x]<h[y]; });
        for(int i=1;i<tmp.size();i++){
            nxt[t[tmp[i-1]]]=h[tmp[i]];
        }
        h[u]=h[tmp.front()],t[u]=t[tmp.back()];
        return;
    }

    int find(int x){ return (x==fa[x])?x:(fa[x]=find(fa[x])); }
    
    void run(){
        std::cin>>n>>m;
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=n;i++) nxt[i]=0,vis[i]=0,h[i]=t[i]=i,fa[i]=i;
        for(int i=1;i<=m;i++){
            std::cin>>x>>y;
            if(find(x)==find(y)) continue;
            g[x].push_back(y);
            g[y].push_back(x);
            fa[find(x)]=find(y);
        }
        tp=0;
        for(int i=1;i<=n;i++){
            if(!vis[i]){
                dfs(i,0);
                st[++tp]=i;
            }
        }
        std::reverse(st+1,st+tp+1);
        while(tp) expand(st[tp--]);
        std::cout<<'\n';
        return;
    }
    void main(){
        std::cin>>T; for(int i=0;i<T;i++) run();
        return;
    }
}

int c;
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0),std::cout.tie(0);

    std::cin>>c;
    if(c==1||c==2) sub1::main();
    else if(c==3||c==4||c==7||c==8||(c>=12&&c<=15)||(c==19||c==20||c==21)) subc::main();
    else subf::main();

    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 4
Accepted
time: 4ms
memory: 9828kb

input:

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

output:

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

result:

ok 100 numbers

Test #2:

score: 4
Accepted
time: 5ms
memory: 9956kb

input:

2 10
10 0
10 0
10 3
4 8
5 4
7 3
10 4
5 2
7 6
4 8
7 10
10 8
2 5
10 2
10 1
7 4
4 2
6 10
6 2
6 9
10 12
5 9
8 9
8 3
1 2
8 7
5 8
2 4
3 10
10 8
4 10
4 1
6 7
10 11
8 6
10 8
5 6
9 4
8 7
5 4
4 6
3 6
2 8
2 7
9 8
10 15
8 4
9 10
4 7
1 4
6 5
7 3
7 10
3 10
7 6
4 3
10 5
6 2
6 10
3 8
3 9
10 17
8 10
4 1
9 2
3 5
7 8
...

output:

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

result:

ok 100 numbers

Test #3:

score: 4
Accepted
time: 5ms
memory: 9968kb

input:

3 10
2000 1999
456 471
691 1122
216 269
455 1552
650 721
1720 1985
1077 832
299 1033
1654 1140
1164 1451
588 1234
71 889
518 496
1465 456
271 1386
51 1713
1937 347
1355 1023
2 1748
1592 1003
325 565
1035 1392
1159 1922
1453 1785
1234 115
1625 2000
439 1123
1762 1094
175 11
117 262
1012 130
1110 90
1...

output:

1 2 113 718 876 1748 45 104 1697 1209 115 588 1234 1423 128 290 1052 1518 160 384 665 835 542 1791 1707 1388 839 988 1253 1588 340 1516 559 1227 1418 1617 1896 1920 602 505 511 983 564 1792 731 1530 585 1002 1077 832 17 296 632 1525 1752 790 664 1309 1430 437 1222 1889 16 613 276 31 53 1145 1823 24 ...

result:

ok 20000 numbers

Test #4:

score: 4
Accepted
time: 5ms
memory: 9956kb

input:

4 10
2000 1999
784 341
1065 321
32 1422
1304 237
612 803
997 1751
336 1145
1201 1585
104 93
1037 1640
1465 831
1924 124
131 908
196 1680
1367 1341
459 1089
1029 1457
981 226
302 737
900 1594
83 1065
616 1897
1329 36
1822 1544
1499 1811
420 1005
487 886
1805 754
1985 1235
1951 1204
36 1732
1417 96
37...

output:

1 2 199 771 1158 1762 74 540 1637 1086 1582 1663 117 699 1513 881 1808 1121 1619 1730 1628 350 871 933 968 972 1316 1486 1618 1070 1827 1326 10 326 1092 1514 999 1179 1970 246 1397 1882 1249 688 28 1940 1727 354 1656 1788 59 1751 5 30 159 99 877 1144 1602 1333 1975 1729 1978 604 451 990 1361 1405 10...

result:

ok 20000 numbers

Test #5:

score: 0
Wrong Answer
time: 6ms
memory: 10084kb

input:

5 10
2000 2807
1355 1348
364 367
809 816
640 643
1813 1747
1014 1010
571 559
1717 1766
1582 1577
1240 1237
921 926
1874 1824
589 588
472 463
1727 1880
1943 1882
767 776
1956 1811
1004 1005
1872 1684
1234 1239
649 648
587 588
1163 1161
1552 1551
914 913
1008 1007
829 825
229 228
730 728
160 157
468 4...

output:

1 2 3 6 7 9 11 12 14 15 16 17 18 20 28 31 32 33 39 40 41 44 45 46 47 48 52 53 54 55 56 57 59 60 64 65 66 67 70 71 72 76 78 80 81 82 84 85 87 88 89 91 92 93 95 97 101 102 107 108 111 114 116 122 123 124 125 126 128 129 136 137 138 140 141 143 144 145 147 149 152 155 158 159 161 164 165 167 171 173 17...

result:

wrong answer 803rd numbers differ - expected: '2000', found: '1950'

Test #6:

score: 0
Wrong Answer
time: 6ms
memory: 10044kb

input:

6 10
2000 2813
1585 1586
439 436
1960 1616
737 738
564 562
1099 1098
1732 1941
244 242
1979 1938
701 702
367 373
430 431
440 456
1447 1461
856 857
578 577
766 769
504 502
1488 1479
655 654
1189 1191
1570 1571
995 999
27 26
1428 1430
1521 1522
359 356
959 954
1445 1450
1904 1783
1098 1101
1342 1353
1...

output:

1 2 3 8 9 10 11 12 15 16 18 20 21 22 25 26 27 28 29 31 34 35 36 37 41 42 43 45 46 48 50 51 57 59 62 63 64 65 66 68 71 72 73 74 75 76 77 81 86 87 89 94 96 97 100 102 103 105 106 108 110 111 114 117 118 119 121 122 123 124 125 127 128 133 135 137 139 140 142 148 149 150 151 152 153 154 157 160 162 165...

result:

wrong answer 805th numbers differ - expected: '1724', found: '1666'

Test #7:

score: 4
Accepted
time: 3ms
memory: 9840kb

input:

7 10
2000 265
2 5
1553 1654
1 78
95 68
11 17
83 182
7 25
1023 918
1375 1429
833 870
173 154
171 153
129 84
24 41
27 35
136 91
92 123
651 711
72 147
185 115
101 186
1861 1778
864 787
124 79
26 4
67 80
136 153
169 118
28 15
1431 1334
79 108
711 784
21 10
739 742
17 24
774 850
651 709
1083 1068
178 93
...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 157 139 176 107 123 140 158 177 93 159 178 108 124 141 80 94 125 109 160 179 142 68 81 95 143 126 180 110 161 57 69 82 96 144 111 162 181 127 47 112 58 70 83 128 145 182 97 163 38 59 48 71 113 146 183 84 98 129 164...

result:

ok 20000 numbers

Test #8:

score: 4
Accepted
time: 2ms
memory: 7704kb

input:

8 10
2000 258
1180 1250
129 113
611 630
67 179
1797 1697
926 820
144 82
147 165
591 610
157 176
40 131
1946 1907
1724 1576
177 92
1250 1188
27 44
78 171
551 570
111 82
123 177
50 23
168 88
134 43
168 187
75 42
134 151
81 143
188 76
52 75
1513 1497
105 78
84 183
895 886
156 175
160 125
1460 983
19 16...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 175 156 122 157 176 139 107 123 140 158 177 93 108 124 141 159 178 80 125 94 109 142 160 179 68 81 143 95 110 180 161 126 57 127 162 69 96 82 111 144 181 47 58 70 83 97 128 145 163 182 112 38 59 71 98 113 129 48 84 183 146 164...

result:

ok 20000 numbers

Test #9:

score: 0
Wrong Answer
time: 3ms
memory: 7788kb

input:

9 10
2000 365
187 150
890 1771
89 64
1916 839
291 310
89 76
27 152
72 99
1496 1271
97 112
129 146
28 120
124 159
1288 1433
182 58
890 1470
31 40
149 11
1378 1756
85 184
151 103
14 2
1312 890
17 167
330 311
890 1204
1221 1018
651 1227
71 129
24 116
77 9
1288 890
47 163
51 62
91 10
146 71
135 119
1766...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 175 156 122 139 157 176 107 123 140 177 158 93 124 159 108 141 178 80 94 109 125 142 160 179 68 81 95 110 161 180 143 126 57 96 111 69 82 127 144 162 181 47 163 58 70 83 182 112 128 97 145 38 48 71 98 129 146 164 183 59 84 113...

result:

wrong answer 35th numbers differ - expected: '108', found: '93'

Test #10:

score: 0
Wrong Answer
time: 2ms
memory: 7780kb

input:

10 10
2000 345
128 182
103 53
38 84
33 18
916 937
78 120
411 430
170 77
123 158
78 10
937 1079
26 169
128 163
94 179
164 48
23 100
33 42
1723 1711
50 86
11 41
1849 1788
1926 1996
156 138
54 14
31 23
93 178
171 15
170 9
97 145
17 24
1575 1430
768 761
111 144
1361 1346
1211 1224
34 103
1423 1331
43 13...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 139 176 157 107 123 158 140 177 93 108 124 141 159 178 80 94 125 160 179 109 142 68 81 161 95 110 126 143 180 57 111 144 181 127 162 96 69 82 47 58 70 83 97 112 145 163 128 182 38 113 84 48 59 146 71 183 164 98 129...

result:

wrong answer 35th numbers differ - expected: '124', found: '93'

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 7808kb

input:

11 10
2000 347
96 111
1676 1975
157 106
112 97
79 108
1476 1481
158 177
1343 1272
57 69
119 170
97 47
123 140
37 128
175 156
1161 1272
88 102
109 94
411 430
1525 1447
1525 1229
112 58
147 184
139 122
162 181
118 134
189 65
53 26
184 39
28 66
2 5
163 83
650 631
16 50
58 182
1889 1907
1487 1500
48 146...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 139 176 157 107 123 140 158 177 93 124 108 141 159 178 80 94 109 142 125 160 179 68 95 126 143 180 161 110 81 57 69 82 96 111 144 181 162 127 47 70 97 58 182 112 83 163 145 128 38 48 183 84 146 59 113 71 98 129 164...

result:

wrong answer 37th numbers differ - expected: '141', found: '108'

Test #12:

score: 4
Accepted
time: 345ms
memory: 32616kb

input:

12 10
100000 99999
38713 38712
10423 10424
60786 60788
17814 17813
17806 17805
21451 21450
42622 42620
98943 89658
60580 60587
65533 65534
65694 65692
90029 98399
91031 83382
75066 75067
70730 70732
8551 8553
67796 67795
82344 84505
28845 28844
36772 36771
55893 55894
52517 52512
4442 4437
96699 915...

output:

1 2 3 5 6 7 8 11 17 21 22 25 26 27 29 30 31 32 34 35 36 37 38 40 42 45 47 49 50 51 52 53 56 57 59 60 61 63 64 67 68 69 70 72 78 80 81 84 86 87 88 89 91 94 95 96 98 100 102 104 107 110 114 115 117 118 119 120 121 123 124 125 126 127 131 134 135 136 138 141 142 143 144 145 148 150 151 153 154 155 157 ...

result:

ok 1000000 numbers

Test #13:

score: 4
Accepted
time: 274ms
memory: 21932kb

input:

13 10
100000 99999
2584 2589
18907 18904
45291 45295
53366 53369
82199 82198
75263 75265
30917 30922
89204 89205
67815 67813
6130 6128
43579 43576
99737 99739
29356 29359
13193 13197
71494 71489
63209 63212
33390 33385
9694 9697
94748 94746
93751 93746
45915 45912
73343 73344
75709 75713
26213 26218...

output:

1 2 4 5 8 9 10 11 13 15 17 16 18 20 19 21 22 23 27 28 30 31 32 33 34 39 40 45 47 51 52 53 56 48 35 36 38 37 41 42 44 46 49 54 50 55 57 59 60 61 65 62 63 64 67 66 69 70 71 73 74 77 78 80 84 86 88 91 95 92 93 76 81 85 87 89 90 94 96 100 102 105 106 110 112 115 117 122 125 128 129 132 131 133 134 136 1...

result:

ok 1000000 numbers

Test #14:

score: 4
Accepted
time: 256ms
memory: 17000kb

input:

14 10
100000 99999
84684 84675
88188 88181
33421 33407
13918 13925
73577 73582
57025 57017
59614 59620
7394 7404
97191 97184
5307 5316
58721 58725
54786 54781
95529 95542
67785 67781
83587 83593
23707 23724
26038 26053
56310 56305
57673 57663
82007 82016
65321 65304
87213 87219
16017 16035
16679 166...

output:

1 2 10 13 17 4 7 16 33 9 12 18 35 37 11 14 24 20 36 26 38 46 29 43 53 56 8 28 44 58 48 66 71 87 102 111 3 19 23 31 41 47 59 60 72 77 61 65 78 67 80 63 70 64 79 98 100 114 118 76 82 91 92 112 129 75 89 105 109 116 113 132 134 141 147 159 166 122 123 138 157 173 174 179 153 155 168 184 185 196 213 197...

result:

ok 1000000 numbers

Test #15:

score: 4
Accepted
time: 265ms
memory: 21216kb

input:

15 10
100000 99999
99957 24077
68893 64085
40592 53866
47600 12237
57882 36154
21183 73851
2039 63871
96171 95588
49391 60916
63824 45458
224 53524
85193 61961
22473 70009
28676 99567
31347 80063
55242 79407
797 86489
60571 98319
80297 58702
33213 12169
19359 7977
21808 41838
12130 52643
29697 40895...

output:

1 2 160 360 2596 18169 58826 74797 94628 72716 13018 37314 40294 56879 45405 89634 81404 46857 59775 77361 33437 45320 17210 21299 59020 61494 34451 49681 31968 59125 12896 36801 95166 32720 5266 8084 98136 77215 78030 87532 88161 77712 53522 74756 10578 66540 9441 51878 23459 77788 48531 8483 11120...

result:

ok 1000000 numbers

Test #16:

score: 0
Wrong Answer
time: 351ms
memory: 24056kb

input:

16 10
100000 141024
54355 54354
50848 50845
72634 72635
13429 13428
18304 18320
92388 82478
50791 50787
33523 33527
68246 68243
64701 64700
67414 67409
16731 16730
49469 49461
25804 25802
93281 95485
79652 79651
30573 30560
75470 75471
7508 7507
21586 21587
17969 17970
12008 12004
25362 25368
28312 ...

output:

1 2 3 6 8 11 13 17 18 20 21 23 25 26 27 29 31 33 34 38 39 42 44 47 51 53 55 56 57 58 62 64 66 67 68 70 74 77 78 81 82 83 85 87 88 89 92 93 94 95 97 98 99 102 103 105 109 110 111 112 115 118 123 124 125 127 129 130 131 132 133 135 137 142 143 144 146 147 150 151 152 154 157 158 160 161 162 163 165 16...

result:

wrong answer 40006th numbers differ - expected: '89820', found: '83506'

Test #17:

score: 0
Wrong Answer
time: 372ms
memory: 22764kb

input:

17 10
100000 139995
7004 46649
16473 94621
76352 79695
77097 11101
74603 39332
66902 17826
98657 64175
21167 54716
93208 30603
70253 28914
1913 19908
17772 52803
81509 74293
10312 54368
23538 99311
40065 78272
52677 72621
33154 3059
95554 32344
61626 55779
31846 23853
5736 61214
66104 48822
30218 53...

output:

1 2 45506 3 3511 46562 59024 81301 84959 8448 6 7 54833 26181 10428 18757 28226 88268 84557 69 42011 43259 75 63224 25678 47847 8023 96 42078 98007 44142 58370 38880 95093 13449 281 10173 30275 51335 97038 539 21883 397 11081 39388 15696 27977 466 48216 50250 74923 79346 89071 529 55478 75346 69517 ...

result:

wrong answer 2nd numbers differ - expected: '20452', found: '2'

Test #18:

score: 0
Wrong Answer
time: 346ms
memory: 22384kb

input:

18 10
100000 140876
19332 19334
95714 98017
41762 41761
50347 50349
94800 83232
86751 88192
58562 58540
17838 17836
84715 96456
64246 64245
37693 37678
98657 97400
56080 56079
52659 52658
48230 48226
85934 81211
46907 46911
426 427
15646 15645
53982 53970
40253 40243
96497 91296
52887 52888
73990 73...

output:

1 2 3 4 5 6 7 8 9 11 14 19 20 22 24 25 30 32 34 35 36 39 41 42 43 45 46 49 50 58 62 63 64 67 73 74 75 76 78 80 81 82 83 85 86 87 89 90 94 97 99 102 105 106 108 110 111 113 114 116 118 122 125 126 128 132 134 135 137 138 139 140 144 145 146 148 152 154 161 164 165 167 170 171 175 176 177 178 181 183 ...

result:

wrong answer 40002nd numbers differ - expected: '91480', found: '85778'

Test #19:

score: 4
Accepted
time: 66ms
memory: 13288kb

input:

19 10
100000 5447
38191 38267
75676 75683
11150 11131
21551 21570
92125 92117
38005 38130
96789 96819
62981 63057
61210 61183
91505 91477
67459 67447
99451 99407
62232 62225
5190 5171
56118 56139
99925 99859
87552 87584
60 49
91420 91477
64499 64532
89148 89182
5470 5451
871 890
76172 76137
25471 25...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 157 139 176 107 158 177 123 140 93 108 124 178 141 159 80 94 109 125 160 179 142 68 81 95 126 143 180 161 110 57 82 96 162 111 69 127 181 144 47 58 70 97 112 145 163 182 128 83 38 71 129 84 183 164 146 48 59 113 98...

result:

ok 1000000 numbers

Test #20:

score: 4
Accepted
time: 69ms
memory: 12028kb

input:

20 10
100000 5395
61358 61240
53946 54000
65035 65241
3251 3270
3 1
27571 27590
75554 75434
54453 54648
82154 82526
92448 92594
27650 27631
18310 18291
81423 81913
31431 31450
64686 64384
69462 69693
75725 75786
91219 91429
24470 24451
61429 61561
74775 74847
99485 99231
97456 97803
18351 18370
5287...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 139 157 176 107 158 123 140 177 93 124 159 178 108 141 80 94 160 125 142 179 109 68 95 110 180 161 81 126 143 57 69 111 127 162 144 82 96 181 47 58 83 70 97 145 163 112 128 182 38 48 59 71 129 164 183 146 113 84 98...

result:

ok 1000000 numbers

Test #21:

score: 4
Accepted
time: 65ms
memory: 13972kb

input:

21 10
100000 5327
62300 62254
11650 11631
99543 99525
6551 6570
55460 55405
42699 42662
18430 18411
2071 2090
24531 24550
130 60
71062 70943
87070 87051
30630 30611
69673 69669
95963 95914
28470 28451
65409 65435
48363 48318
9610 9591
76708 76726
98956 98882
2351 2370
44204 44124
49149 49055
1731 17...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 157 139 176 107 140 158 177 123 93 108 159 124 178 141 80 142 160 179 94 109 125 68 81 143 161 95 126 180 110 57 69 144 181 82 127 96 111 162 47 58 97 145 163 128 70 83 112 182 38 59 146 71 84 98 113 129 183 164 48...

result:

ok 1000000 numbers

Test #22:

score: 0
Wrong Answer
time: 70ms
memory: 13924kb

input:

22 10
100000 6781
17771 17790
79825 50780
32891 32910
52209 76601
94217 74350
29671 29690
65643 63773
67523 76082
87504 98609
19691 19710
98273 91179
77788 68146
59764 47997
60295 43167
31370 31351
74269 72759
53983 84484
53852 50095
68146 65343
59091 78305
112 83
98120 91616
95786 99429
8810 8791
9...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 139 157 176 107 158 177 123 140 93 108 124 178 159 141 80 94 109 125 142 179 160 68 81 95 126 143 161 180 110 57 144 181 96 127 162 82 69 111 47 58 70 83 97 128 112 145 163 182 38 48 84 98 164 146 113 59 71 129 183...

result:

wrong answer 30th numbers differ - expected: '123', found: '107'

Test #23:

score: 0
Wrong Answer
time: 71ms
memory: 13544kb

input:

23 10
100000 6940
30011 30030
19170 19151
37597 37451
11191 11210
79130 79146
13371 13390
64141 64187
47268 47267
98764 95260
8550 8531
82369 82350
90262 92826
14531 14550
84332 84327
87518 94712
68618 68597
73707 73729
4510 4491
11090 11071
17510 17491
78247 78339
66656 66700
17310 17291
54243 5411...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 157 176 139 107 177 123 140 158 93 159 124 108 178 141 80 94 125 142 179 160 109 68 110 81 95 126 143 161 180 57 82 127 144 181 69 96 111 162 47 97 163 58 128 182 70 83 112 145 38 71 84 98 113 129 146 164 183 48 59...

result:

wrong answer 32nd numbers differ - expected: '158', found: '123'

Test #24:

score: 0
Wrong Answer
time: 70ms
memory: 12652kb

input:

24 10
100000 7158
33389 60063
26 19
16470 16451
53763 55728
42305 95179
5570 5551
38631 49321
6511 6530
33517 77902
59629 92726
56004 67304
72203 79471
95 110
73227 99479
96504 37245
93327 91852
9531 9550
13290 13271
39297 41565
9771 9790
58974 84411
48272 77934
22651 22670
33994 61058
1891 1910
797...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 157 176 139 107 123 140 177 158 93 108 141 159 178 124 80 94 160 125 142 109 179 68 81 95 110 126 143 161 180 57 69 82 144 162 181 111 127 96 47 58 70 83 97 112 128 145 163 182 38 164 48 71 183 129 59 146 84 98 113...

result:

wrong answer 27th numbers differ - expected: '176', found: '157'

Test #25:

score: 0
Wrong Answer
time: 75ms
memory: 12524kb

input:

25 10
100000 6782
80681 80578
8 4
15871 15890
50279 50235
55393 55237
74335 73716
90223 93880
68435 68484
15011 15030
93561 94960
16651 16670
30771 30790
40194 40138
52260 52272
77448 77349
10431 10450
92844 87841
3931 3950
43348 43343
93365 99981
41434 41399
25350 25331
79006 79018
67539 67701
6038...

output:

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 173 155 174 138 156 175 122 139 157 176 107 140 158 177 123 93 108 124 141 159 178 80 94 179 142 109 125 160 68 95 110 143 126 81 161 180 57 144 69 181 162 96 111 127 82 47 58 112 128 163 182 145 97 83 70 38 59 71 164 84 129 146 48 183 98 113...

result:

wrong answer 28th numbers differ - expected: '176', found: '157'