QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#370636#8174. Set ConstructionHarry27182WA 1ms3828kbC++142.4kb2024-03-29 14:16:362024-03-29 14:16:37

Judging History

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

  • [2024-03-29 14:16:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3828kb
  • [2024-03-29 14:16:36]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int>res[15][105];int T,n,m;
vector<int> solve(int n,int m)
{
	if(n<6)return res[n][m];
	if(m<=n*(n-1)/2)
	{
		vector<int>ans=solve(n-1,m);
		for(int i=0;i<ans.size();i++)ans[i]=(2*ans[i])+(ans[i]&1);
		return ans; 
	}
	if(m%2==0)
	{
		vector<int>now=solve(n-1,m/2),ans;
		for(int i=0;i<now.size();i++)
		{
			ans.emplace_back(now[i]*2);
			ans.emplace_back(now[i]*2+1);
		}
		return ans;
	}
	else 
	{
		vector<int>ans=solve(n-1,m-1);
		for(int i=0;i<ans.size();i++)ans[i]=2*ans[i]+1;
		ans.emplace_back(0);return ans;
	}
}
signed main()
{
	cin.tie(0)->sync_with_stdio(0);
	res[2][2].resize(2);
	res[2][2]={0,3};
	res[2][3].resize(3);
	res[2][3]={0,1,3};
	res[3][2].resize(2);
	res[3][2]={0,7};
	res[3][3].resize(3);
	res[3][3]={0,1,7};
	res[3][4].resize(4);
	res[3][4]={0,1,3,7};
	res[3][5].resize(5);
	res[3][5]={0,1,2,3,7};
	res[3][6].resize(6);
	res[3][6]={0,1,2,3,5,7};
	res[4][2].resize(2);
	res[4][2]={0,15};
	res[4][3].resize(3);
	res[4][3]={0,1,15};
	res[4][4].resize(4);
	res[4][4]={0,1,3,15};
	res[4][5].resize(5);
	res[4][5]={0,1,2,3,15};
	res[4][6].resize(6);
	res[4][6]={0,1,2,3,7,15};
	res[4][7].resize(7);
	res[4][7]={0,1,2,3,5,7,15};
	res[4][8].resize(8);
	res[4][8]={0,1,2,3,5,7,11,15};
	res[4][9].resize(9);
	res[4][9]={0,1,2,3,4,5,6,7,15};
	res[4][10].resize(10);
	res[4][10]={0,1,2,3,4,5,6,7,11,15};
	res[5][2].resize(2);
	res[5][2]={0,31};
	res[5][3].resize(3);
	res[5][3]={0,1,31};
	res[5][4].resize(4);
	res[5][4]={0,1,3,31};
	res[5][5].resize(5);
	res[5][5]={0,1,2,3,31};
	res[5][6].resize(6);
	res[5][6]={0,1,2,3,7,31};
	res[5][7].resize(7);
	res[5][7]={0,1,2,3,5,7,31};
	res[5][8].resize(8);
	res[5][8]={0,1,2,3,5,7,15,31};
	res[5][9].resize(9);
	res[5][9]={0,1,2,3,4,5,6,7,31};
	res[5][10].resize(10);
	res[5][10]={0,1,2,3,4,5,6,7,15,31};
	res[5][11].resize(11);
	res[5][11]={0,1,2,3,4,5,6,7,11,15,31};
	res[5][12].resize(12);
	res[5][12]={0,1,2,3,4,5,6,7,11,15,23,31};
	res[5][13].resize(13);
	res[5][13]={0,1,2,3,4,5,6,7,9,11,13,15,31};
	res[5][14].resize(14);
	res[5][14]={0,1,2,3,4,5,6,7,9,11,13,15,23,31};
	res[5][15].resize(15);
	res[5][15]={0,1,2,3,4,5,6,7,12,13,14,15,19,23,31};
	cin>>T;
	while(T--)
	{
		cin>>n>>m;
		vector<int>ans=solve(n,m);
		for(int i=0;i<ans.size();i++)cout<<ans[i]<<' ';
		cout<<'\n'; 
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3828kb

input:

3
3 5
4 8
60 2

output:

0 1 2 3 7 
0 1 2 3 5 7 11 15 
0 1152921504606846975 

result:

ok AC

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3636kb

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 3 63 
0 3 7 63 
0 3 4 7 63 
0 3 4 7 15 63 
0 3 4 7 11 15 63 
0 3 4 7 11 15 31 63 
0 3 4 7 8 11 12 15 63 
0 3 4 7 8 11 12 15 31 63 
0 3 4 7 8 11 12 15 23 31 63 
0 3 4 7 8 11 12 15 23 31 47 63 
0 3 4 7 8 11 12 15 19 23 27 31 63 
0 3 4 7 8 11 12 15 19 23 27 31 47 63 
0 3 4 7 8 11 12 15 24 27 28...

result:

wrong answer Outputs are not distinct