QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#423279#8174. Set ConstructioncqbzlyRE 4ms3880kbC++141.0kb2024-05-27 22:03:482024-05-27 22:03:49

Judging History

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

  • [2024-05-27 22:03:49]
  • 评测
  • 测评结果:RE
  • 用时:4ms
  • 内存:3880kb
  • [2024-05-27 22:03:48]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long 
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define vi vector<ll>
using namespace std;
int T,n,m;
vector<ll>num;
void sol1(int x){
	assert(x>=0);
	ll y=0;
	for(int i=x;i<n;i++)y+=1ll<<i;
	num.pb(y); 
}
void sol2(int x){
	assert(x>=0);
	int sz=num.size();
	for(int i=0;i<sz;i++){
		num.pb(num[i]+(1ll<<x));
	}
}
int main(){
    //freopen("data.in","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    cin>>T;
    while(T--){
    	cin>>n>>m;
		vector<int>v;
		int tmp=m;
		while(tmp)v.pb(tmp&1),tmp>>=1;
		reverse(v.begin(),v.end());
		vector<int>vec;
		if(v[1])vec.pb(0);
		for(int i=2;i<v.size();i++){
			vec.pb(1);
			if(v[i])vec.pb(0);
		}
		int rest=n-1-vec.size();
		ll val=1ll<<n-1;int cur=n-2;
		for(int i=0;i<rest;i++){
			val+=1ll<<cur;
			cur--;
		}
		num.clear(),num.pb(0),num.pb(val);
		for(auto e:vec){
			if(!e)sol1(cur--);
			else sol2(cur--);
		}
		for(auto e:num)cout<<e<<" ";
		cout<<"\n";
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3848kb

input:

3
3 5
4 8
60 2

output:

0 4 2 6 7 
0 12 2 14 1 13 3 15 
0 1152921504606846975 

result:

ok AC

Test #2:

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

input:

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

output:

0 63 
0 62 63 
0 62 1 63 
0 60 2 62 63 
0 60 62 1 61 63 
0 56 60 2 58 62 63 
0 60 2 62 1 61 3 63 
0 56 4 60 2 58 6 62 63 
0 56 4 60 62 1 57 5 61 63 
0 48 8 56 60 2 50 10 58 62 63 
0 56 60 2 58 62 1 57 61 3 59 63 
0 48 56 4 52 60 2 50 58 6 54 62 63 
0 48 56 4 52 60 62 1 49 57 5 53 61 63 
0 32 48 8 40...

result:

ok AC

Test #3:

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

input:

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

output:

0 120 124 2 122 126 1 121 125 3 123 127 
0 112 120 4 116 124 2 114 122 6 118 126 127 
0 112 120 4 116 124 126 1 113 121 5 117 125 127 
0 96 112 8 104 120 124 2 98 114 10 106 122 126 127 
0 120 4 124 2 122 6 126 1 121 5 125 3 123 7 127 
0 112 8 120 4 116 12 124 2 114 10 122 6 118 14 126 127 
0 112 8 ...

result:

ok AC

Test #4:

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

input:

30
8 15
8 16
8 17
8 18
8 19
8 20
8 21
8 22
8 23
8 24
8 25
8 26
8 27
8 28
8 29
8 30
8 31
8 32
8 33
8 34
8 35
8 36
9 2
9 3
9 4
9 5
9 6
9 7
9 8
9 9

output:

0 224 240 8 232 248 252 2 226 242 10 234 250 254 255 
0 248 4 252 2 250 6 254 1 249 5 253 3 251 7 255 
0 240 8 248 4 244 12 252 2 242 10 250 6 246 14 254 255 
0 240 8 248 4 244 12 252 254 1 241 9 249 5 245 13 253 255 
0 224 16 240 8 232 24 248 252 2 226 18 242 10 234 26 250 254 255 
0 240 8 248 252 ...

result:

ok AC

Test #5:

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

input:

30
9 10
9 11
9 12
9 13
9 14
9 15
9 16
9 17
9 18
9 19
9 20
9 21
9 22
9 23
9 24
9 25
9 26
9 27
9 28
9 29
9 30
9 31
9 32
9 33
9 34
9 35
9 36
9 37
9 38
9 39

output:

0 504 4 508 510 1 505 5 509 511 
0 496 8 504 508 2 498 10 506 510 511 
0 504 508 2 506 510 1 505 509 3 507 511 
0 496 504 4 500 508 2 498 506 6 502 510 511 
0 496 504 4 500 508 510 1 497 505 5 501 509 511 
0 480 496 8 488 504 508 2 482 498 10 490 506 510 511 
0 504 4 508 2 506 6 510 1 505 5 509 3 50...

result:

ok AC

Test #6:

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

input:

6
9 40
9 41
9 42
9 43
9 44
9 45

output:

0 480 16 496 504 4 484 20 500 508 2 482 18 498 506 6 486 22 502 510 1 481 17 497 505 5 485 21 501 509 3 483 19 499 507 7 487 23 503 511 
0 448 32 480 496 8 456 40 488 504 4 452 36 484 500 12 460 44 492 508 2 450 34 482 498 10 458 42 490 506 6 454 38 486 502 14 462 46 494 510 511 
0 448 32 480 496 8 ...

result:

ok AC

Test #7:

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

input:

30
60 1801
60 1802
60 1803
60 1804
60 1805
60 1806
60 1807
60 1808
60 1809
60 1810
60 1811
60 1812
60 1813
60 1814
60 1815
60 1816
60 1817
60 1818
60 1819
60 1820
60 1821
60 1822
60 1823
60 1824
60 1825
60 1826
60 1827
60 1828
60 1829
60 1830

output:

0 1152921504606838784 1152921504606842880 2048 1152921504606840832 1152921504606844928 1152921504606845952 512 1152921504606839296 1152921504606843392 2560 1152921504606841344 1152921504606845440 1152921504606846464 256 1152921504606839040 1152921504606843136 2304 1152921504606841088 115292150460684...

result:

ok AC

Test #8:

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

input:

30
59 1741
59 1742
59 1743
59 1744
59 1745
59 1746
59 1747
59 1748
59 1749
59 1750
59 1751
59 1752
59 1753
59 1754
59 1755
59 1756
59 1757
59 1758
59 1759
59 1760
59 1761
59 1762
59 1763
59 1764
59 1765
59 1766
59 1767
59 1768
59 1769
59 1770

output:

0 576460752303390720 576460752303407104 8192 576460752303398912 576460752303415296 4096 576460752303394816 576460752303411200 12288 576460752303403008 576460752303419392 576460752303421440 1024 576460752303391744 576460752303408128 9216 576460752303399936 576460752303416320 5120 576460752303395840 5...

result:

ok AC

Test #9:

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

input:

30
58 1682
58 1683
58 1684
58 1685
58 1686
58 1687
58 1688
58 1689
58 1690
58 1691
58 1692
58 1693
58 1694
58 1695
58 1696
58 1697
58 1698
58 1699
58 1700
58 1701
58 1702
58 1703
58 1704
58 1705
58 1706
58 1707
58 1708
58 1709
58 1710
58 1711

output:

0 288230376151703552 288230376151707648 2048 288230376151705600 288230376151709696 1024 288230376151704576 288230376151708672 3072 288230376151706624 288230376151710720 288230376151711232 256 288230376151703808 288230376151707904 2304 288230376151705856 288230376151709952 1280 288230376151704832 288...

result:

ok AC

Test #10:

score: -100
Runtime Error

input:

30
2 2
2 3
3 2
3 3
3 4
3 5
3 6
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
4 10
5 2
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15

output:


result: