QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263861#6833. My University Is Better Than Yoursvp_account#AC ✓272ms114808kbC++141.8kb2023-11-25 09:10:372023-11-25 09:10:37

Judging History

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

  • [2023-11-25 09:10:37]
  • 评测
  • 测评结果:AC
  • 用时:272ms
  • 内存:114808kb
  • [2023-11-25 09:10:37]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
using namespace std;
constexpr int N=5e5+5,mod=998244353;
int n,m,scc,tim,top,dfn[N],low[N],bel[N],stk[N],deg[N],dp[N],ans[N];
bool ins[N];
vector<int>G[N],ele[N],E[N];
inline void tarjan(int x){
    dfn[x]=low[x]=++tim;
    stk[++top]=x,ins[x]=true;
    for(auto y:G[x]){
        if(!dfn[y]){
            tarjan(y);
            low[x]=min(low[x],low[y]);
        }
        else if(ins[y])low[x]=min(low[x],dfn[y]);
    }
    if(dfn[x]==low[x]){
        ++scc;
        int w;
        do{
            w=stk[top],--top;
            ins[w]=false;
            ele[scc].emplace_back(w);
            bel[w]=scc;
        }while(w!=x);
    }
}
queue<int>q;
inline void topsort(){
    rep(i,1,scc)dp[i]=ele[i].size();
    rep(i,1,scc)if(!deg[i])q.push(i);
    while(!q.empty()){
        int u=q.front();q.pop();
        for(auto v:E[u]){
            dp[v]+=dp[u];
            if(!--deg[v])q.push(v);
        }
    }
    rep(i,1,scc){
        for(auto x:ele[i])ans[x]=dp[i];
    }
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    rep(i,1,m){
        int x,lst=0;
        rep(j,1,n){
            cin>>x;
            if(lst)G[x].emplace_back(lst);
            lst=x;
        }
    }
    rep(i,1,n)if(!dfn[i])tarjan(i);
    rep(i,1,n)
        for(auto x:G[i])if(bel[i]^bel[x])
            E[bel[i]].emplace_back(bel[x]);
    rep(i,1,scc){
        sort(E[i].begin(),E[i].end());
        E[i].resize(unique(E[i].begin(),E[i].end())-E[i].begin());
        for(auto x:E[i])++deg[x];
    }
    topsort();
    rep(i,1,n)cout<<ans[i]-1<<' ';cout<<'\n';
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 49424kb

input:

4 2
1 2 3 4
1 3 2 4

output:

3 2 2 0 

result:

ok 4 number(s): "3 2 2 0"

Test #2:

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

input:

4 2
1 2 3 4
4 3 2 1

output:

3 3 3 3 

result:

ok 4 number(s): "3 3 3 3"

Test #3:

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

input:

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

output:

0 1 2 3 4 

result:

ok 5 number(s): "0 1 2 3 4"

Test #4:

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

input:

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

output:

8 3 9 0 3 8 8 3 8 8 

result:

ok 10 numbers

Test #5:

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

input:

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

output:

9 5 1 1 9 5 9 5 6 5 

result:

ok 10 numbers

Test #6:

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

input:

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

output:

6 3 3 3 9 3 9 9 6 6 

result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 3ms
memory: 50024kb

input:

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

output:

10 99 35 23 35 35 99 65 23 99 23 35 99 77 35 35 65 23 35 52 46 46 77 99 77 35 99 99 99 10 23 99 65 65 65 52 77 23 77 46 10 46 65 52 65 65 77 99 35 99 99 35 46 23 99 52 23 99 23 77 77 46 65 99 10 52 23 77 46 77 35 10 52 99 46 65 46 99 77 77 10 99 10 65 46 35 99 65 99 23 10 10 23 99 46 10 99 23 65 10 

result:

ok 100 numbers

Test #8:

score: 0
Accepted
time: 3ms
memory: 50060kb

input:

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

output:

91 91 91 61 49 22 61 22 61 32 32 49 78 78 78 8 99 78 99 61 22 49 22 22 78 61 49 91 49 91 8 22 99 49 49 8 8 49 78 99 91 78 49 32 22 8 91 91 99 49 91 61 78 78 22 61 91 32 78 91 8 49 22 99 32 49 78 78 61 49 78 78 32 22 49 61 22 61 91 99 32 22 99 49 8 8 32 49 8 61 78 22 61 91 78 78 32 49 32 22 

result:

ok 100 numbers

Test #9:

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

input:

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

output:

22 34 99 34 84 22 72 22 72 22 49 62 22 99 49 62 6 72 99 22 62 99 49 62 22 6 99 84 62 84 49 62 22 6 84 34 99 6 49 22 62 34 6 34 84 22 72 34 99 34 62 99 72 84 84 99 72 49 22 99 84 49 84 62 6 34 99 99 99 72 22 22 84 99 22 49 84 49 62 34 49 62 72 84 34 49 99 6 34 49 62 22 49 62 49 34 72 49 22 72 

result:

ok 100 numbers

Test #10:

score: 0
Accepted
time: 4ms
memory: 50924kb

input:

3000 30
2850 2083 2621 666 1485 2488 2724 2240 2420 902 2198 1373 2838 857 2514 1847 2552 396 1724 2374 2647 927 106 2827 1134 2812 1878 2575 1984 920 1250 518 2383 2319 2221 2569 1694 2049 693 926 68 2846 535 782 1637 2922 1194 692 1062 159 1130 2860 1604 1528 1540 2824 440 575 1943 2220 638 2487 1...

output:

2101 1812 540 1613 2493 1530 2306 2008 438 823 2898 1423 1709 823 1022 2580 2580 2898 1316 2390 823 931 540 105 216 105 639 2675 1812 1709 2580 1530 2780 1530 1225 1902 438 2780 931 2675 2008 105 540 1530 2306 1121 2203 1225 1709 2580 2780 1530 2999 438 2580 2898 1812 316 2008 2493 931 1423 1812 540...

result:

ok 3000 numbers

Test #11:

score: 0
Accepted
time: 10ms
memory: 50884kb

input:

3000 30
2568 1369 1963 197 594 2823 2603 1256 2936 784 2050 474 1152 2529 84 786 826 1367 2013 1581 1436 714 2195 2892 1522 1463 1430 528 2896 1837 1499 1728 140 1403 2783 1606 1807 1251 2340 1876 982 1103 1144 1427 2737 2364 1041 1380 5 2049 2045 1765 2489 491 2763 634 2877 1870 2718 31 973 215 477...

output:

864 566 1474 2896 2999 2501 2501 1778 781 864 683 1565 1369 1369 566 1778 2701 477 2383 1260 781 975 2600 1175 1074 864 975 1369 1778 683 2999 2701 2383 2383 864 1881 781 781 2794 204 2270 1175 1982 864 2794 2701 975 2176 1369 975 2071 1474 1474 781 1881 2383 379 204 379 1474 1565 2600 2383 2600 250...

result:

ok 3000 numbers

Test #12:

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

input:

3000 30
2722 1084 373 2550 4 1389 1704 812 676 2775 559 2738 2354 2392 138 1981 729 2208 64 1091 1809 1186 44 1356 2469 1129 2441 2298 2667 822 833 2389 1681 1660 1277 2303 2003 1284 2083 137 403 1326 174 298 304 1780 1890 2425 2287 802 1542 1480 2842 1395 1822 2379 531 1329 821 228 470 707 2411 168...

output:

1582 2007 294 2999 95 199 799 703 2819 2117 799 1180 2117 2198 2819 2198 1896 2915 2117 1278 199 2117 2293 1896 2680 2680 2680 1478 799 1278 2819 381 2198 2293 1788 2480 1278 1691 1896 2378 799 1691 2480 2999 2293 1691 703 2007 2117 1090 1691 2580 2198 2007 1478 2819 2480 2198 2915 199 703 2480 1582...

result:

ok 3000 numbers

Test #13:

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

input:

3000 333
680 1795 1926 242 2778 468 264 2132 102 221 2992 2723 2394 2095 2203 1787 1130 1211 2830 2296 2973 1584 2843 2511 2255 1825 2099 1183 1248 2501 2735 2733 1923 1363 2703 2113 2193 2526 2851 2845 2320 1430 1800 2769 1963 1159 2134 2821 1945 661 2555 1002 59 2257 1047 708 2800 30 1182 390 765 ...

output:

92 1581 2171 282 1481 1767 485 2902 1398 1208 485 2171 1208 2280 2819 905 2902 687 687 185 185 2902 1662 1581 485 2506 687 485 1303 2999 1767 1581 687 1398 2095 1767 2280 1004 584 2716 2391 2391 2999 2506 1481 1398 2391 801 1767 2819 485 185 801 2391 400 400 485 400 2999 2819 485 687 282 2612 2506 4...

result:

ok 3000 numbers

Test #14:

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

input:

3000 333
2970 219 1115 2730 2394 2110 1630 246 1440 2023 1031 970 2719 2467 2131 1712 394 1277 302 629 576 662 1653 2699 757 167 929 543 254 918 1469 2834 1770 1130 2907 2494 1655 1144 2001 1736 1473 534 87 2175 2041 181 1846 705 2370 91 65 1544 1704 2521 1570 2697 2869 654 2565 32 2053 147 1579 82 ...

output:

277 805 1601 2495 2284 1496 2184 194 2601 700 1422 2495 1086 1798 1086 603 1896 2601 805 700 1798 899 1896 2284 2388 277 1798 2699 603 2601 1321 2999 2388 2799 2904 1798 390 700 277 93 277 996 899 1086 1422 1496 1207 277 1422 390 2699 194 996 277 2699 1601 2699 1496 2495 2999 1086 603 390 805 2999 2...

result:

ok 3000 numbers

Test #15:

score: 0
Accepted
time: 108ms
memory: 62180kb

input:

100000 10
87622 15440 99929 63938 32210 16179 89583 9979 62875 51423 87887 76227 50916 59602 3454 29414 60989 63192 64574 41259 38684 13606 54802 9695 70894 39678 80292 72357 36545 17295 64261 3794 38384 32653 32229 48301 41998 81383 95781 98420 64899 51642 44597 45736 60273 84733 40945 96408 23768 ...

output:

18289 46488 17298 51922 64855 87826 4621 93958 32132 37357 46488 54328 10274 87826 13627 11241 94930 84410 66256 52596 20652 27913 55969 78457 45788 77786 15299 54328 1933 50264 5924 78106 63858 80102 43758 96653 66915 40705 5614 9567 52251 60231 99999 30524 67250 47842 38716 70612 57947 70280 9253 ...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 101ms
memory: 62696kb

input:

100000 10
38952 45137 8328 76738 17830 22666 23245 90615 69197 9079 81528 14072 10882 53343 72179 54893 94553 18420 59624 70159 18566 79801 12125 52386 41406 50931 33028 38579 20057 83112 59225 93909 17262 96021 77983 70071 73110 16148 28263 29549 62967 69186 13246 35973 59392 75357 76895 18367 6095...

output:

16611 96992 68368 35096 25294 34439 7928 78476 10880 70349 8889 15236 93009 48540 94666 90038 41335 71685 59573 99292 51210 83059 15596 54582 45461 73985 53563 30994 50849 93685 30994 58921 26936 41335 63629 40692 75635 24589 30640 54251 32708 75938 1301 56559 51537 4021 66293 3659 39345 46523 96992...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 92ms
memory: 59468kb

input:

100000 10
27556 5190 6330 97131 77410 22985 72703 94441 25175 87158 24005 10589 48589 4737 81840 16398 40308 89524 66077 46048 55046 57116 48230 91537 71378 71267 66028 57315 30919 3899 46595 12595 51936 46757 18311 5414 43657 96632 86440 35145 31928 76201 79149 60375 24443 7842 52014 10443 43279 14...

output:

83014 75071 59088 82357 85246 91730 45462 93118 43606 74907 73424 31805 18425 16305 23757 25735 45121 64242 12687 45585 59668 67514 42580 65792 97016 47781 28373 88559 74837 80057 93791 32339 82557 68529 24021 97495 38018 30881 60124 12000 68897 25871 4105 28133 58521 20183 55184 73187 64050 88488 1...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 101ms
memory: 60852kb

input:

100000 10
78955 48058 22974 27565 30018 8461 89813 33317 9683 63141 75863 38473 60151 56040 16128 42391 33567 43360 21203 25874 41090 47850 81262 87143 73296 65112 64152 98783 38726 37759 44336 62321 11156 32760 41512 74612 69342 30137 42354 27431 7457 63221 90724 19641 20809 14899 10789 9236 7780 1...

output:

41272 94111 22620 45497 97503 6731 45522 64317 36281 86697 36818 42647 6867 32026 12454 97240 18459 11008 75037 62070 5933 95554 99888 75408 2024 78361 99395 27389 41747 54085 61662 22275 93640 23757 68058 1041 66166 71146 366 30435 87117 56120 39936 63305 89365 80862 74886 89329 61593 28485 92134 5...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 116ms
memory: 62008kb

input:

100000 10
86419 18202 19817 86136 8685 38741 5212 9472 92095 38638 49349 7129 92261 62984 25799 72862 76089 75105 42003 95240 54490 589 85877 64752 99450 79220 53399 24513 18807 77519 90809 22390 846 24058 1385 37687 35001 37015 42418 96554 13509 67153 5057 71612 21028 88148 89779 28839 45873 4567 5...

output:

99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 ...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 120ms
memory: 61008kb

input:

100000 10
1558 62470 18623 86045 3914 92470 27161 86277 64678 80644 10382 16443 7597 66265 65409 92326 26844 67905 11894 11153 76112 12103 55319 65018 3979 59300 11873 28107 31194 26534 74660 71496 98994 61622 49124 7873 92449 62373 75476 77816 31788 8259 67545 28395 7261 91368 21813 36390 177 45918...

output:

99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 ...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 118ms
memory: 61044kb

input:

100000 10
38358 31811 63084 99022 30906 15373 71490 14628 93168 76881 3827 17598 78055 67001 90901 17026 31596 41660 74727 70584 42871 35586 91173 8738 78098 58455 2004 70996 42477 92071 64429 54725 84355 66435 96085 15921 75935 92146 54614 96438 48684 87814 99828 92519 5735 81611 58395 5584 65009 9...

output:

99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 ...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 106ms
memory: 61180kb

input:

100000 10
44917 60537 3221 34598 56607 77416 79015 83980 30215 7786 68705 73871 16352 32601 93214 77601 99725 49397 19522 78946 17330 61504 66443 6177 5237 96876 60309 12738 92333 60125 11157 25068 91090 9020 28258 54075 68861 93222 91567 40147 31274 78013 84095 58048 35460 9804 860 48763 79122 4945...

output:

99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 ...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 140ms
memory: 67548kb

input:

250000 4
180232 166328 75094 216446 134095 129461 212003 219655 87009 180613 194653 107324 82457 225769 150707 68499 242501 136965 184963 222453 216636 135619 167662 160672 193456 208064 26381 137077 25119 40990 134908 89855 9518 6671 164327 25774 171968 4153 118969 46738 212694 225778 78930 144367 ...

output:

249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999...

result:

ok 250000 numbers

Test #24:

score: 0
Accepted
time: 140ms
memory: 66764kb

input:

250000 4
59552 210073 172990 120661 126828 1560 74707 238638 37083 31761 49259 208323 81735 207558 34721 35807 131425 12451 225779 58530 142011 29268 81536 81922 58103 146797 155739 41393 92977 249184 212369 149004 26846 19428 100713 234184 175288 240686 47228 27775 104016 42585 165521 112746 184462...

output:

249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999 249999...

result:

ok 250000 numbers

Test #25:

score: 0
Accepted
time: 112ms
memory: 65512kb

input:

250000 4
20883 145602 35209 42804 47208 183752 128538 239798 216114 130085 94992 70723 157209 61109 153208 214433 242039 105710 230178 173385 120862 12493 191485 227914 35566 201251 227077 129323 73820 124909 226562 5636 190413 173631 7573 72598 222710 10899 167376 185183 63770 81124 241610 218583 5...

output:

211640 62228 170694 29212 190645 111402 182345 55521 235701 43356 20862 44121 38427 112234 194916 110536 118111 217407 168221 189059 60517 175654 160734 188234 60517 27501 105531 225587 65681 186623 147361 30885 103042 157454 170694 86356 199102 41699 28345 97191 240861 68147 189884 178174 145678 19...

result:

ok 250000 numbers

Test #26:

score: 0
Accepted
time: 123ms
memory: 64016kb

input:

250000 4
35629 160582 117103 89768 79791 161283 116845 139098 110778 191821 91665 151163 171697 130089 248170 190998 243916 75550 99846 128124 70995 103052 121305 173617 40940 243023 182745 80236 79913 106835 122605 150713 32977 60794 69903 128641 192356 1475 97901 55823 21314 103265 115766 64513 24...

output:

205284 126045 30528 124214 207969 157144 16835 80828 9344 170091 140008 240746 128914 83642 30156 219531 61173 42126 46925 99773 103413 66747 38745 83322 224988 76870 190660 23840 187917 237509 52146 15086 111459 122402 125213 170941 63225 19571 100998 89760 3476 161789 39238 157215 67882 221612 914...

result:

ok 250000 numbers

Test #27:

score: 0
Accepted
time: 124ms
memory: 65372kb

input:

250000 4
20525 150559 72099 232048 180278 90154 146922 56493 10794 31246 234012 204574 249822 110200 192899 66597 135118 111608 34817 226942 29397 73671 65973 31857 96980 167491 85621 18102 73827 131660 187991 11788 92416 229842 146399 183353 40105 49359 247760 152039 142995 115944 152122 83847 4001...

output:

146006 221502 70767 214893 92955 196635 74618 221880 121328 25493 219063 96203 76933 88485 40676 13164 62802 219176 224073 116728 104442 91365 77129 223210 129718 186913 205326 182137 106707 70488 129072 75119 10201 81975 64974 162303 28092 110912 193101 86577 197286 185894 64603 145506 142303 21218...

result:

ok 250000 numbers

Test #28:

score: 0
Accepted
time: 181ms
memory: 79892kb

input:

500000 2
28142 90632 270504 483140 428735 411425 135010 89211 87243 401284 160738 176477 368897 19718 329067 411461 78423 282370 404698 404764 25729 263084 175181 216796 234580 265042 185330 140317 338381 193049 364045 12864 164789 496720 82882 269992 315408 21152 296889 49903 50926 424337 174530 22...

output:

269348 470151 150646 73430 330054 29377 352672 362416 57756 116363 90874 450282 432882 396686 157858 413078 369012 413389 431521 305411 342704 414121 454358 395859 61865 364202 409714 499332 125535 462432 254368 161700 109252 286730 458930 132609 223885 185833 121225 494904 281413 496272 319681 3660...

result:

ok 500000 numbers

Test #29:

score: 0
Accepted
time: 174ms
memory: 85856kb

input:

500000 2
211968 289838 431204 275288 435362 189573 222143 438773 57091 395754 473072 73777 30407 303674 117661 477540 40003 280795 134152 340203 72322 493473 49409 8124 218943 338769 4483 32404 31551 143802 215110 89554 430596 18468 451233 458273 403639 394820 69496 495309 40543 467155 86453 246149 ...

output:

117645 124044 119979 225824 292936 75612 254706 292129 196816 440646 147238 452815 480349 382137 482047 25494 289148 166285 65457 337056 355299 484542 145285 286788 337753 216378 215789 39696 57177 175765 58404 293458 222702 45727 345349 335671 187468 135269 483787 269981 234953 262047 195399 31668 ...

result:

ok 500000 numbers

Test #30:

score: 0
Accepted
time: 161ms
memory: 79128kb

input:

500000 2
410381 174651 292981 185693 88794 5324 156123 143721 221645 233407 364318 227224 5358 289532 71940 468722 431724 377205 10673 445010 317018 261714 39216 396939 323830 91620 16865 256479 273340 1123 13943 309238 338651 477385 375742 342805 489330 265143 202610 359288 226656 66926 272569 9968...

output:

289269 249364 302311 482533 327396 227422 480149 365282 290935 499890 85139 419177 259631 59183 102675 476647 493875 291402 470051 161798 218379 332354 170911 398060 338472 41500 5959 442511 76684 209109 413957 25101 378435 395272 295876 182732 132435 372608 217150 16501 215103 322381 308116 431291 ...

result:

ok 500000 numbers

Test #31:

score: 0
Accepted
time: 198ms
memory: 84512kb

input:

500000 2
70222 491674 277519 375084 489104 476934 143957 76313 330681 336620 388797 128829 22081 9025 131021 370307 28933 133550 264575 380580 307587 85540 270440 472732 419442 93801 186367 74532 190480 496231 180345 87050 444917 168315 315713 318658 477099 411878 75601 236880 306313 233353 89685 24...

output:

147563 139008 379163 277510 175416 476530 54577 94012 340266 210339 303907 423335 149591 59773 244916 439873 102196 15201 478940 328645 420527 284356 429637 28393 377173 227904 171836 7276 235320 55285 123692 213499 47711 401553 423893 475501 289360 479442 407258 335589 387741 408218 254193 13886 86...

result:

ok 500000 numbers

Test #32:

score: 0
Accepted
time: 240ms
memory: 86776kb

input:

500000 2
156177 286070 418450 92681 24550 31827 270609 308157 420951 318284 464668 382627 277077 157939 143087 19152 103382 27301 422162 140718 455933 180457 393075 442593 41851 299366 331950 362283 1016 489055 426681 372193 55298 310336 251166 267299 25782 103394 253358 345760 470253 451679 437889 ...

output:

499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999...

result:

ok 500000 numbers

Test #33:

score: 0
Accepted
time: 239ms
memory: 86768kb

input:

500000 2
321572 405701 451540 130306 200638 88146 185340 491079 213774 486549 453295 408534 368299 357662 81806 112132 409074 427989 200704 26183 136074 140255 93962 261456 311525 280557 432623 343686 264513 390973 349072 342763 182715 54370 170356 379422 301157 99080 185801 40474 214304 119067 4442...

output:

499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999...

result:

ok 500000 numbers

Test #34:

score: 0
Accepted
time: 225ms
memory: 86916kb

input:

500000 2
387697 366295 448019 249668 50449 149086 193811 293516 156396 451408 112180 411366 249263 260076 48316 484557 183111 394445 207702 62579 439469 360276 491095 322428 25810 25850 165869 270619 360393 196915 352913 261261 482917 461750 342284 299204 292551 53942 493647 485793 57254 19875 13329...

output:

499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999 499999...

result:

ok 500000 numbers

Test #35:

score: 0
Accepted
time: 272ms
memory: 114808kb

input:

500000 2
231318 381794 444804 475462 121853 202263 286412 136842 134553 151012 147667 420012 327648 109135 330390 40013 372707 282290 75725 107368 445492 497245 207610 114797 309591 225658 401018 344953 486959 389188 330890 317569 264872 28169 481958 334337 141006 347091 450936 440829 473622 10688 4...

output:

421802 21521 252334 243070 143357 396907 170680 195113 15066 271254 390138 308376 472527 371087 231796 494590 440373 314652 381681 156490 213008 241494 199640 427695 201589 429615 325618 301985 33503 306068 393143 90593 212658 335020 114994 458403 294776 457725 441358 15728 178099 438915 174524 2958...

result:

ok 500000 numbers

Test #36:

score: 0
Accepted
time: 270ms
memory: 106484kb

input:

500000 2
383113 13676 84166 348518 124882 86405 20604 177009 64676 173014 28539 495248 205377 467938 248708 64560 415652 174778 231343 349972 415842 147299 144898 434258 242725 382352 241102 297454 165337 142673 489128 495271 147973 339010 68206 317784 64564 437037 491545 162129 459380 116385 76353 ...

output:

358115 442020 352694 393149 260776 185262 5611 360618 384829 227322 28564 173988 79669 276135 168794 64089 306663 81866 226836 255365 110010 51826 386259 340212 17949 173044 335911 307943 448204 83627 119879 159471 329026 211722 89976 408463 411979 130181 257738 323846 458695 78041 221373 495635 199...

result:

ok 500000 numbers

Test #37:

score: 0
Accepted
time: 211ms
memory: 109712kb

input:

500000 1
242378 218739 254316 392550 153934 493655 35458 218159 193307 301423 311974 291838 377561 32630 71569 419438 101396 102972 236487 105871 182747 82904 375178 473869 440474 477075 419847 214990 465379 78774 439498 317773 222907 224263 117188 95219 193050 214435 432714 450634 360012 115917 414...

output:

335738 71674 57401 135534 456218 75159 74262 486506 276061 3358 36112 304018 134728 273369 458191 13724 223091 200266 304946 57160 407081 126877 348397 194632 225657 290141 134295 278312 322547 453197 68747 438143 265051 28203 285522 255680 110252 211773 145943 106744 242487 418363 175879 244363 378...

result:

ok 500000 numbers

Test #38:

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

input:

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

0 

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 35ms
memory: 53360kb

input:

2 500000
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2...

output:

1 0 

result:

ok 2 number(s): "1 0"

Test #40:

score: 0
Accepted
time: 34ms
memory: 49280kb

input:

3 333333
2 3 1
2 3 1
1 2 3
2 3 1
2 3 1
2 1 3
1 3 2
3 2 1
1 3 2
2 3 1
2 1 3
3 2 1
2 3 1
1 3 2
3 1 2
2 1 3
3 2 1
3 1 2
2 3 1
2 3 1
2 3 1
2 1 3
1 3 2
1 2 3
1 2 3
2 1 3
3 2 1
2 3 1
2 1 3
2 1 3
1 3 2
2 3 1
3 2 1
1 3 2
3 1 2
2 1 3
2 3 1
2 3 1
3 1 2
1 2 3
1 3 2
1 3 2
3 1 2
3 2 1
1 2 3
1 2 3
2 3 1
2 3 1
2 1...

output:

2 2 2 

result:

ok 3 number(s): "2 2 2"

Test #41:

score: 0
Accepted
time: 36ms
memory: 58420kb

input:

4 250000
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2...

output:

3 2 1 0 

result:

ok 4 number(s): "3 2 1 0"

Test #42:

score: 0
Accepted
time: 35ms
memory: 51292kb

input:

5 200000
1 2 5 4 3
4 3 5 2 1
2 4 5 1 3
4 5 2 3 1
5 2 1 4 3
3 5 1 2 4
2 4 5 1 3
4 5 1 2 3
1 4 5 3 2
3 5 2 4 1
3 5 1 4 2
2 3 4 5 1
1 3 2 4 5
1 3 2 5 4
2 4 5 1 3
5 2 1 4 3
1 3 5 4 2
4 5 2 3 1
1 3 4 5 2
2 4 1 5 3
5 1 4 2 3
3 2 4 5 1
5 3 2 1 4
1 4 5 2 3
5 3 2 4 1
2 3 1 5 4
1 2 5 4 3
2 5 1 3 4
4 5 1 2 3
1...

output:

4 4 4 4 4 

result:

ok 5 number(s): "4 4 4 4 4"

Test #43:

score: 0
Accepted
time: 37ms
memory: 56248kb

input:

6 166666
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2...

output:

5 4 3 2 1 0 

result:

ok 6 numbers

Test #44:

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

input:

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

output:

6 6 6 6 6 6 6 

result:

ok 7 numbers

Test #45:

score: 0
Accepted
time: 36ms
memory: 56636kb

input:

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

output:

7 6 5 4 3 2 1 0 

result:

ok 8 numbers

Test #46:

score: 0
Accepted
time: 37ms
memory: 51836kb

input:

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

output:

8 8 8 8 8 8 8 8 8 

result:

ok 9 numbers

Test #47:

score: 0
Accepted
time: 37ms
memory: 57268kb

input:

10 100000
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 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 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 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 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9...

output:

9 8 7 6 5 4 3 2 1 0 

result:

ok 10 numbers

Test #48:

score: 0
Accepted
time: 163ms
memory: 73824kb

input:

333333 3
326645 178736 21049 34668 193384 209654 324582 216044 68480 292852 173252 204670 244201 144814 24971 75420 126743 58315 90226 287729 217385 223095 300662 184230 65441 139799 143154 288713 210624 292170 92348 143321 205697 130768 107699 182698 220454 100814 317656 256831 42544 78180 301700 6...

output:

55436 11025 221950 288630 266518 199768 121783 144119 66558 99682 132910 88631 266518 333332 11025 166331 221950 288630 77593 77593 132910 266518 221950 333332 333332 188657 110723 255388 99682 266518 55436 22204 99682 44485 121783 110723 244226 22204 22204 333332 88631 277564 188657 121783 266518 1...

result:

ok 333333 numbers

Test #49:

score: 0
Accepted
time: 137ms
memory: 74700kb

input:

333333 3
59566 67449 290316 27037 213738 300101 166327 184444 211991 155780 14655 57571 175308 275258 205713 255894 170213 255488 294783 247937 240099 104777 128164 12086 92825 59275 272594 314034 124029 28016 127087 298293 30499 109286 190301 274290 35291 38000 4073 166551 152377 250730 212345 2860...

output:

61085 154500 286841 210545 226256 176946 257076 312537 139084 221817 225194 232847 117942 284678 200456 254867 225194 208302 276983 168043 8668 171430 106706 4282 123619 117942 202679 183667 20982 160159 86670 50912 324729 81128 250467 208302 204879 321361 156783 285779 271485 120277 295738 187000 1...

result:

ok 333333 numbers

Test #50:

score: 0
Accepted
time: 135ms
memory: 75304kb

input:

333333 3
215028 57235 192921 181421 227788 73293 308405 14537 258987 239470 306687 275889 162443 324645 84211 36673 54864 8383 277216 189574 142842 77647 3594 309884 21752 108140 17891 328211 177321 156809 200173 182859 203530 325212 70761 294903 185008 144312 331338 292564 158921 257346 150380 7960...

output:

24455 144563 313730 100698 164302 157411 47198 222072 26442 315726 249254 317146 180423 40493 311561 132378 322880 94713 38968 123114 60136 79958 82102 48783 124492 13998 266292 280415 67506 88172 5572 236924 124064 124492 286045 210191 173702 288595 296818 35425 38020 72902 273138 153839 159586 913...

result:

ok 333333 numbers

Test #51:

score: 0
Accepted
time: 157ms
memory: 68628kb

input:

333333 3
63938 245366 268104 52433 123542 161697 206796 125877 175967 142562 179877 333008 256928 305320 107815 312704 278485 149511 196040 258845 224910 74198 53899 6580 80525 2443 235868 48961 121806 219097 239423 227155 189501 114189 278584 135190 131706 44135 247002 252217 66279 88404 214532 236...

output:

315290 229248 150577 184064 218835 143142 136749 248850 297825 272682 283189 325580 171457 174564 165306 94580 102323 176577 229005 74132 304397 295335 161048 314989 305065 115798 276695 27571 21390 78382 199523 119167 204112 269733 289788 329500 291208 87800 55936 282387 144139 183803 104942 45191 ...

result:

ok 333333 numbers

Test #52:

score: 0
Accepted
time: 171ms
memory: 87616kb

input:

333333 3
275101 184886 199509 315635 166175 121073 51725 110219 8943 5231 258284 26222 128397 282093 64682 241679 8996 54083 250446 272778 254175 203350 62542 173444 258230 242277 324816 74378 167475 113281 109644 148575 150437 179511 180968 21372 94306 326498 332833 295657 280387 20759 150987 65472...

output:

23352 226611 61468 294236 74333 197313 106886 84836 276775 108730 248209 235213 39661 87242 269365 333098 128278 75328 95071 4345 257015 294921 244345 144891 327979 203129 229290 158040 203415 81213 65944 97320 314702 72181 68026 240881 25199 263347 306381 120926 62829 130156 55222 106849 60367 2573...

result:

ok 333333 numbers

Test #53:

score: 0
Accepted
time: 197ms
memory: 87488kb

input:

333333 3
169466 153592 48548 44691 164665 267442 129619 19718 303266 6952 113448 248057 48735 312096 53793 244905 276077 279690 158522 127701 73941 312593 330246 247797 121084 76565 17247 110897 194214 323767 55536 197756 207849 240597 134312 28833 255642 306558 250867 302185 90363 132999 308230 226...

output:

215053 301762 170008 218457 136296 281379 36955 183828 118516 264373 28481 280707 2111 221873 300391 297826 191705 193307 327769 165794 164858 201737 161548 265295 286687 153852 310871 172373 180311 150708 196710 56736 118387 195246 240357 276032 321544 324863 18127 326756 264895 2647 176 164581 203...

result:

ok 333333 numbers