QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#284472#7937. Fast XORtingucup_team_qiuly#AC ✓210ms24172kbC++141.2kb2023-12-16 13:37:052023-12-16 13:37:06

Judging History

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

  • [2023-12-16 13:37:06]
  • 评测
  • 测评结果:AC
  • 用时:210ms
  • 内存:24172kb
  • [2023-12-16 13:37:05]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;
int n,a[1000005];
int pos[1000005];
int val1[20],val2[20];
struct node{
	int p,c;
	bool operator <(const node &x)const{
		return p<x.p;
	}
}d[1000005];
void dfs(int l,int r,int w){
	if (l==r-1){
		if (pos[l]>pos[r])val1[w]++;
		if (pos[l]<pos[r])val2[w]++;
		return;
	}
	int mid=(l+r)/2;
	int c0=0,c1=0;
	for (int i=l;i<=r;i++){
		d[i].p=pos[i];
		if (i<=mid)d[i].c=0,c0++;
		else d[i].c=1,c1++;
	}
	sort(d+l,d+1+r);
	for (int i=l;i<=r;i++)
		if (d[i].c==1)val1[w]+=c0,c1--;
		else val2[w]+=c1,c0--;
	dfs(l,mid,w-1);
	dfs(mid+1,r,w-1);
	return;
}
struct DS{
	int tree[1000005],n=1000000;
	void add(int p){
		while(p<=n)tree[p]++,p+=(p&(-p));
		return;
	} 
	int ask(int p){
		int ans=0;
		while(p)ans+=tree[p],p-=(p&(-p));
		return ans;
	}
}bit;
signed main(){
	cin>>n;
	for (int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		pos[a[i]]=i;
	}
	int w=0;
	while((1<<w)!=n)w++;
	dfs(0,n-1,w);
	int ans=0;
	for (int i=1;i<=w;i++)ans+=min(val1[i],val2[i]);
	ans++;
	int t=0;
	for (int i=n-1;i>=0;i--)t+=bit.ask(a[i]+1),bit.add(a[i]+1);
	ans=min(ans,t);
	cout<<ans<<endl;
	return 0;
}

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

详细

Test #1:

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

input:

8
0 1 3 2 5 4 7 6

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

8
2 0 1 3 4 5 6 7

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 210ms
memory: 22124kb

input:

262144
47482 131703 90418 122675 166494 247529 196154 16950 66501 50357 246808 25929 10418 50538 26955 151884 63776 58023 20073 26544 74785 44064 41836 148543 87920 54172 3270 131495 130960 112122 167229 215767 77499 195004 21391 11039 168999 256346 109690 180904 172679 157200 78594 201857 52784 147...

output:

17137565829

result:

ok 1 number(s): "17137565829"

Test #4:

score: 0
Accepted
time: 208ms
memory: 22252kb

input:

262144
14207 154745 21702 203084 49988 1853 104664 62971 102664 211126 35057 170586 75653 27474 189094 4988 207149 255640 140879 82517 224575 43198 49395 235775 251474 41544 258165 5501 13321 109993 9272 92321 55714 89738 14682 88517 145206 198849 196461 178924 145814 171363 135465 20289 15464 17330...

output:

17139892655

result:

ok 1 number(s): "17139892655"

Test #5:

score: 0
Accepted
time: 210ms
memory: 22232kb

input:

262144
180251 249291 219134 130302 197583 182366 41641 101673 224486 137556 259500 113821 166158 61157 173258 239365 70116 201476 128657 175988 111376 238687 246130 122796 208819 59677 48726 233600 240993 61957 34730 188272 178604 126029 92914 179571 19449 237489 210566 218808 91711 111776 90866 139...

output:

17134596850

result:

ok 1 number(s): "17134596850"

Test #6:

score: 0
Accepted
time: 95ms
memory: 15032kb

input:

131072
91657 50959 31003 49147 44730 127857 60301 38726 67535 80206 129385 33328 63790 54618 29254 84689 90216 108413 91038 46438 110249 6165 41499 97013 96003 34964 8394 15279 65210 104079 77031 61422 76416 113858 21106 89941 5375 39901 10560 110744 7048 103198 121198 13566 46514 3842 8148 58628 17...

output:

4284430414

result:

ok 1 number(s): "4284430414"

Test #7:

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

input:

131072
33531 42077 64803 95190 129984 30845 63846 5835 90653 26642 12397 104452 23652 103770 129670 105553 82508 89758 79902 31405 17616 57098 102004 37294 123284 119768 130672 72909 130859 39761 129975 126848 65845 102256 25924 16220 102891 71055 15376 128344 92624 113326 73215 88087 99866 36365 84...

output:

4290235115

result:

ok 1 number(s): "4290235115"

Test #8:

score: 0
Accepted
time: 93ms
memory: 21004kb

input:

131072
100473 97853 2589 64576 72337 79873 64859 40520 90118 128497 112284 48757 15963 26131 61027 110231 13808 55968 50291 22265 124370 106913 5602 8650 48416 112836 125987 32987 102155 130633 42601 62937 24569 24287 110393 124743 31303 82194 36030 122511 43829 85232 101255 22140 116224 29757 23812...

output:

4282069841

result:

ok 1 number(s): "4282069841"

Test #9:

score: 0
Accepted
time: 88ms
memory: 19060kb

input:

131072
125783 17768 13565 59580 37873 38696 48528 33772 70599 122436 7472 117940 76723 4238 62929 26941 129090 127825 32450 31396 105794 34607 67553 59869 93268 22261 56241 54373 51154 22588 91323 129003 92771 123889 107709 130109 24001 42102 76362 15026 68034 17711 37348 109322 50724 18741 64535 37...

output:

4276232475

result:

ok 1 number(s): "4276232475"

Test #10:

score: 0
Accepted
time: 210ms
memory: 23652kb

input:

262144
5148 78111 187940 184478 243842 201134 126612 60010 126614 60897 72140 160559 256655 158992 126184 137427 148579 199289 198201 1887 131338 16459 125003 128433 112770 143490 128542 153876 251538 151265 84969 251280 144117 248838 55969 158553 87832 139531 123674 261837 55640 203595 199169 16990...

output:

17138553391

result:

ok 1 number(s): "17138553391"

Test #11:

score: 0
Accepted
time: 201ms
memory: 22180kb

input:

262144
142458 96782 72403 47495 40878 204599 122627 210596 73236 182127 142753 12114 143162 234607 32601 176924 124715 9943 97910 236037 231925 187673 3419 215926 147862 70002 78966 211062 183985 229084 62518 45840 190935 59086 57437 193653 170971 248311 181417 183198 69995 173987 65966 37082 261147...

output:

17144707678

result:

ok 1 number(s): "17144707678"

Test #12:

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

input:

131072
74846 128935 10591 16850 102596 92491 126545 96022 106640 121066 23533 123173 1188 104887 57277 68631 29624 27667 985 15507 90756 83941 49756 102417 40960 86946 73939 10125 30134 65997 78949 2466 83899 114957 41858 95531 91591 42 41885 965 30239 24645 96041 58025 79111 50101 85484 19808 55870...

output:

4284742107

result:

ok 1 number(s): "4284742107"

Test #13:

score: 0
Accepted
time: 93ms
memory: 21112kb

input:

131072
29630 104529 98308 24856 32432 62197 65349 108040 81393 1700 99426 25852 93300 109854 7481 109812 76913 49747 35076 40482 73147 39091 113525 62614 98484 6291 89430 79916 71351 111826 101379 22052 26334 1043 54954 18005 76393 101994 28657 69017 70505 119505 20529 61711 10348 104965 85924 10341...

output:

4282176072

result:

ok 1 number(s): "4282176072"

Test #14:

score: 0
Accepted
time: 206ms
memory: 22136kb

input:

262144
245226 31300 204561 76428 174352 47890 61829 56446 236860 248758 232434 161157 96761 131293 102666 32494 187285 112012 92033 187743 248222 72299 4623 63424 194251 109298 8414 23926 237550 164554 152565 127753 213826 180672 125554 81115 90893 156576 91087 39468 52239 197088 94617 166887 55755 ...

output:

17146677958

result:

ok 1 number(s): "17146677958"

Test #15:

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

input:

131072
10473 16419 54120 102545 26192 130998 102846 9094 59658 105313 31173 125244 22585 128854 26051 40831 21180 102333 5802 16209 83901 40143 90894 92774 40933 64168 95905 12135 124935 100746 83851 19117 99504 53243 110669 114993 118509 109771 25657 64352 7301 96121 43928 78400 775 69821 112010 13...

output:

4287801749

result:

ok 1 number(s): "4287801749"

Test #16:

score: 0
Accepted
time: 210ms
memory: 22044kb

input:

262144
221598 245033 256114 111329 27986 260921 69546 255505 47316 95647 41039 166746 24426 222232 192054 227997 255861 250919 27452 217876 58676 204585 175851 6560 180602 58104 30978 120095 228324 81304 33614 257204 78014 158368 89875 94628 35333 232245 101363 31418 15775 14582 247870 96331 57094 2...

output:

17137450264

result:

ok 1 number(s): "17137450264"

Test #17:

score: 0
Accepted
time: 201ms
memory: 23652kb

input:

262144
43223 227546 79877 32173 196287 147253 218533 1280 222488 95249 60440 117004 102247 145653 173848 230481 216206 185766 181902 227751 160049 196613 183721 176326 160180 213749 196365 180210 124916 150279 150461 73524 203487 217784 251851 99387 206778 242486 86283 54642 66786 152294 157869 2254...

output:

17169955879

result:

ok 1 number(s): "17169955879"

Test #18:

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

input:

131072
25006 3138 113174 120217 37475 100624 1509 62126 95121 38930 111600 2350 5438 93931 124173 19203 71184 12882 54354 10187 102804 112347 21769 92203 45634 69118 17023 31814 123120 74725 87883 22889 6414 126867 42008 23833 126439 43579 104592 44969 19145 88510 126561 17749 76208 119393 74497 769...

output:

4279540465

result:

ok 1 number(s): "4279540465"

Test #19:

score: 0
Accepted
time: 87ms
memory: 16288kb

input:

131072
16565 68999 37671 41261 84052 89417 97026 66668 56737 24476 91654 52955 119179 93364 30614 88869 60280 66626 21459 131031 50154 71987 101951 78834 55144 129405 61471 74985 78797 38789 65497 22569 55877 107138 75694 27852 97239 44006 105817 97543 29892 53227 39831 38218 62230 61786 38804 96454...

output:

4287142860

result:

ok 1 number(s): "4287142860"

Test #20:

score: 0
Accepted
time: 207ms
memory: 24172kb

input:

262144
156208 52079 233503 233961 120402 202659 198665 170399 138573 114742 46567 92401 135626 260600 35211 27832 81283 48784 43204 222850 198692 121819 249134 240330 183164 239599 101440 88435 68302 179588 232745 186929 82162 175195 138684 220740 14484 191566 254429 83098 108501 56386 83738 73882 2...

output:

17137289942

result:

ok 1 number(s): "17137289942"

Test #21:

score: 0
Accepted
time: 210ms
memory: 22188kb

input:

262144
223559 13018 198968 240391 47917 143495 245953 10962 137069 66062 155012 71944 88238 127518 100648 179869 134783 251563 96041 44174 19387 160615 228812 89616 211042 42036 248970 123594 199424 206959 12546 86092 171276 187870 67477 9446 177807 69653 49821 169218 212795 6641 148247 162971 13216...

output:

17167085965

result:

ok 1 number(s): "17167085965"

Test #22:

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

input:

131072
86896 108179 81716 62330 25233 8901 64264 34989 98017 103564 50765 61205 43294 7666 38839 33705 87587 10904 72125 128080 73285 37265 12969 88490 101522 121527 90644 86629 52169 110467 89521 96009 16800 69730 13132 18913 116682 54820 94481 48239 93515 70340 104192 66753 118859 61724 9680 29932...

output:

4289285840

result:

ok 1 number(s): "4289285840"

Test #23:

score: 0
Accepted
time: 201ms
memory: 22192kb

input:

262144
198593 123882 127877 236911 108400 110934 68183 106912 115215 168821 246070 36768 76119 104359 114837 47861 231119 67983 14443 147888 23 189670 148513 253835 197226 231826 135819 102530 72032 220581 66183 201610 246931 91345 46696 172600 164849 228667 216766 229564 163929 18974 194743 208939 ...

output:

17125534964

result:

ok 1 number(s): "17125534964"

Test #24:

score: 0
Accepted
time: 203ms
memory: 23468kb

input:

262144
129810 77008 75953 191002 227176 150012 144557 11879 106690 232317 45120 133283 181547 220479 202799 15310 9726 24977 255271 2473 247515 206348 158557 36037 107994 229073 51063 174814 191523 113134 221507 75424 250660 131144 120244 20327 242983 44664 150101 96486 131937 149882 5347 222718 138...

output:

17170753162

result:

ok 1 number(s): "17170753162"

Test #25:

score: 0
Accepted
time: 95ms
memory: 17000kb

input:

131072
108494 23099 99082 51543 106580 35253 65125 18229 35817 77288 30066 10714 76551 30616 102652 41503 124591 18796 53425 48640 83218 28950 129427 96114 41337 97819 15087 3118 74835 74145 112898 34193 2835 20968 8096 97541 63802 49045 82363 86771 117196 80419 93688 11744 71852 96661 42413 91124 8...

output:

4286358770

result:

ok 1 number(s): "4286358770"

Test #26:

score: 0
Accepted
time: 205ms
memory: 22184kb

input:

262144
100269 203319 166527 185676 243873 128471 3497 77743 26661 216496 88927 168181 103171 146425 179563 106104 234334 233189 122884 157963 75400 216308 126342 153459 56334 8629 110310 27950 166976 77111 51042 248516 130870 224908 259324 25769 195948 71416 258149 94959 79773 231274 100677 176694 8...

output:

17148006698

result:

ok 1 number(s): "17148006698"

Test #27:

score: 0
Accepted
time: 87ms
memory: 14944kb

input:

131072
12897 122960 115421 26553 6476 63339 13360 19293 97667 35810 71335 99956 116062 128883 34106 104851 82866 83408 116181 10416 120895 103534 997 44012 106275 12916 81503 94147 70391 75649 15473 31044 42057 98046 36056 79233 16759 84691 102268 52408 55350 7912 104612 128484 66349 40623 55141 111...

output:

4284723011

result:

ok 1 number(s): "4284723011"

Test #28:

score: 0
Accepted
time: 206ms
memory: 22980kb

input:

262144
236125 130336 49407 35814 210171 234458 39309 77890 203366 40248 1045 52441 244015 31345 232319 234391 77951 75011 100303 100484 15246 10369 61558 230262 109710 148514 159274 174854 115367 158267 165405 131878 186131 40012 94211 83105 32825 73009 44711 85147 131789 196468 246786 219550 228123...

output:

17129592119

result:

ok 1 number(s): "17129592119"

Test #29:

score: 0
Accepted
time: 87ms
memory: 17128kb

input:

131072
77842 88599 57109 119122 3797 99416 128546 52846 49265 38310 15697 10514 73097 25337 119687 28572 127325 15206 42931 13686 47999 113544 47129 103402 28978 44261 66293 105225 121024 27372 14734 120904 21071 53426 74033 12436 92443 37147 98269 27617 41311 93761 124135 7573 84113 50613 70257 250...

output:

4282963990

result:

ok 1 number(s): "4282963990"

Test #30:

score: 0
Accepted
time: 96ms
memory: 17024kb

input:

131072
115972 28906 113296 106159 63156 113765 19696 90555 121540 17375 112097 20438 50791 35416 71069 9047 26414 58896 81307 104005 11688 130450 41460 42936 47539 22395 66777 106691 45399 6444 66775 51448 111615 39827 120803 95294 39100 91798 128548 52937 84632 33764 83728 129338 34801 46258 97106 ...

output:

4286206586

result:

ok 1 number(s): "4286206586"

Test #31:

score: 0
Accepted
time: 94ms
memory: 15000kb

input:

131072
3036 112429 51778 78554 125967 26553 14015 120320 125872 114258 29588 99174 12968 33309 68746 5554 26395 98352 19716 126970 92750 77590 57880 99743 119191 85170 4210 89345 90514 102194 5632 62346 21633 100774 103471 127153 92757 69509 114164 87780 68163 24431 103000 123813 41984 88322 108509 ...

output:

4287351473

result:

ok 1 number(s): "4287351473"

Test #32:

score: 0
Accepted
time: 209ms
memory: 22176kb

input:

262144
259117 19548 49652 94972 88341 127521 130013 112011 41727 40418 199454 143679 208858 21814 108604 258179 143614 192215 181923 257861 262034 121741 149526 7232 206543 177112 180701 204757 50076 124474 232811 167742 235738 225415 59880 89330 82517 78686 215805 22734 172003 125969 78133 247325 2...

output:

17143098953

result:

ok 1 number(s): "17143098953"

Test #33:

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

input:

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

output:

200062

result:

ok 1 number(s): "200062"

Test #34:

score: 0
Accepted
time: 89ms
memory: 22116kb

input:

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

output:

399677

result:

ok 1 number(s): "399677"

Test #35:

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

input:

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

output:

199606

result:

ok 1 number(s): "199606"

Test #36:

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

input:

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

output:

200455

result:

ok 1 number(s): "200455"

Test #37:

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

input:

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

output:

200328

result:

ok 1 number(s): "200328"

Test #38:

score: 0
Accepted
time: 45ms
memory: 17024kb

input:

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

output:

201280

result:

ok 1 number(s): "201280"

Test #39:

score: 0
Accepted
time: 95ms
memory: 22112kb

input:

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

output:

399524

result:

ok 1 number(s): "399524"

Test #40:

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

input:

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

output:

198611

result:

ok 1 number(s): "198611"

Test #41:

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

input:

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

output:

200148

result:

ok 1 number(s): "200148"

Test #42:

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

input:

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

output:

201507

result:

ok 1 number(s): "201507"

Test #43:

score: 0
Accepted
time: 97ms
memory: 22244kb

input:

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

output:

398061

result:

ok 1 number(s): "398061"

Test #44:

score: 0
Accepted
time: 45ms
memory: 17116kb

input:

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

output:

199099

result:

ok 1 number(s): "199099"

Test #45:

score: 0
Accepted
time: 102ms
memory: 22056kb

input:

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

output:

398838

result:

ok 1 number(s): "398838"

Test #46:

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

input:

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

output:

199517

result:

ok 1 number(s): "199517"

Test #47:

score: 0
Accepted
time: 94ms
memory: 22060kb

input:

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

output:

399788

result:

ok 1 number(s): "399788"

Test #48:

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

input:

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

output:

199230

result:

ok 1 number(s): "199230"

Test #49:

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

input:

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

output:

4547

result:

ok 1 number(s): "4547"

Test #50:

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

input:

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

output:

4661

result:

ok 1 number(s): "4661"

Test #51:

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

input:

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

output:

4710

result:

ok 1 number(s): "4710"

Test #52:

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

input:

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

output:

4483

result:

ok 1 number(s): "4483"

Test #53:

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

input:

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

output:

4585

result:

ok 1 number(s): "4585"

Extra Test:

score: 0
Extra Test Passed