UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#193043#3403. XOR就是ADDheyuzhen100183ms9124kbC++299b2023-10-14 08:53:362023-10-14 12:07:23

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,a[1000005];
bitset<1000005> ok;
int main(){
	cin >> n;
	for(ll i=0;i<n;i++){
		ll x=((~i)&((1<<29)-1)),now=(1<<28);
		while(x>=n||ok[x])x=(x&(now-1)),now>>=1;
		cout<<x<<" ";
		a[i]=x,ok[x]=1;
	}
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

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

input:

8

output:

7 6 5 4 3 2 1 0 

result:

ok ok n = 8

Test #2:

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

input:

9

output:

7 6 5 4 3 2 1 8 0 

result:

ok ok n = 9

Test #3:

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

input:

10

output:

7 6 5 4 3 2 9 8 1 0 

result:

ok ok n = 10

Test #4:

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

input:

19

output:

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

result:

ok ok n = 19

Test #5:

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

input:

20

output:

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

result:

ok ok n = 20

Test #6:

score: 10
Accepted
time: 1ms
memory: 1324kb

input:

999

output:

511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 ...

result:

ok ok n = 999

Test #7:

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

input:

1000

output:

511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 999 ...

result:

ok ok n = 1000

Test #8:

score: 10
Accepted
time: 79ms
memory: 9124kb

input:

1000000

output:

524287 524286 524285 524284 524283 524282 524281 524280 524279 524278 524277 524276 524275 524274 52...

result:

ok ok n = 1000000

Test #9:

score: 10
Accepted
time: 10ms
memory: 2348kb

input:

131315

output:

131071 131070 131069 131068 131067 131066 131065 131064 131063 131062 131061 131060 131059 131058 13...

result:

ok ok n = 131315

Test #10:

score: 10
Accepted
time: 93ms
memory: 8972kb

input:

979797

output:

524287 524286 524285 524284 524283 524282 524281 524280 524279 524278 524277 524276 524275 524274 52...

result:

ok ok n = 979797

Extra Test:

score: 0
Extra Test Passed