QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#256515#7629. Make SYSU Great Again IIucup-team2580WA 1ms3504kbC++201.9kb2023-11-18 19:48:092023-11-18 19:48:10

Judging History

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

  • [2023-11-18 19:48:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3504kb
  • [2023-11-18 19:48:09]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int cnt[2020];
int a[2020];
mt19937 rnd(26381);
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int x=1;
	while(x<=n) x*=2;
	x--;
	cnt[0]++;
	for(int i=1;i<n;i++)
	{
		int rm=x-a[i-1];
		vector<int> vec;
		for(int j=0;j<=x;j++)
			if((j&rm)==j&&cnt[j]<1)
				vec.pb(j);
		if(!sz(vec))
			for(int j=0;j<=x;j++)
				if((j&rm)==j&&cnt[j]<2)
					vec.pb(j);
//		if(!sz(vec))
//			for(int j=0;j<=x;j++)
//				if((j&rm)==j&&cnt[j]<3)
//					vec.pb(j);
//		if(!sz(vec))
//			for(int j=0;j<=x;j++)
//				if((j&rm)==j&&cnt[j]<4)
//					vec.pb(j);
//		if(!sz(vec))
//			for(int j=0;j<=x;j++)
//				if((j&rm)==j&&cnt[j]<5)
//					vec.pb(j);
//		if(!sz(vec))
//			for(int j=0;j<=x;j++)
//				if((j&rm)==j&&cnt[j]<6)
//					vec.pb(j);
//		cerr<<"! "<<sz(vec)<<endl;
		sort(ALL(vec),[&](int x,int y){return __builtin_popcount(x)>__builtin_popcount(y);});
		while(__builtin_popcount(vec[0])>__builtin_popcount(vec.back())+2) vec.pop_back();
		int p=rnd()%sz(vec);
		cnt[vec[p]]++;
		a[i]=vec[p];
//		cout<<a[i]<<endl;
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
			cout<<a[(i+j)%n]*(x+1)+a[(i+n-j+1)%n]<<" ";
		cout<<'\n';
	}
	return 0;
}

详细

Test #1:

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

input:

4

output:

Yes
7 56 1 8 
56 7 8 1 
1 8 7 56 
8 1 56 7 

result:

ok 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 3400kb

input:

1

output:

Yes
0 

result:

ok 1

Test #3:

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

input:

2

output:

Yes
3 12 
12 3 

result:

ok 1

Test #4:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

3

output:

Yes
3 12 0 
12 3 0 
0 0 15 

result:

ok 1

Test #5:

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

input:

5

output:

Yes
7 56 4 9 32 
56 7 8 36 1 
1 8 39 0 60 
12 33 0 63 0 
32 4 57 0 15 

result:

ok 1

Test #6:

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

input:

8

output:

Yes
14 224 19 40 148 73 130 49 
225 30 32 147 72 132 57 2 
18 33 158 64 131 56 4 233 
41 146 65 142 48 3 232 20 
148 73 130 49 14 224 19 40 
72 132 57 2 225 30 32 147 
131 56 4 233 18 33 158 64 
48 3 232 20 41 146 65 142 

result:

ok 1

Test #7:

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

input:

13

output:

Yes
14 224 21 32 157 66 140 51 200 36 217 2 81 
225 30 32 149 64 141 50 204 35 216 4 89 2 
18 33 158 64 133 48 205 34 220 3 88 4 233 
41 146 65 142 48 197 32 221 2 92 3 232 20 
148 73 130 49 206 32 213 0 93 2 236 19 40 
72 132 57 194 33 222 0 85 0 237 18 44 147 
131 56 196 41 210 1 94 0 229 16 45 14...

result:

ok 1

Test #8:

score: 0
Accepted
time: 1ms
memory: 3408kb

input:

21

output:

Yes
29 928 87 768 175 272 681 342 33 476 547 396 113 910 33 714 309 520 485 24 738 
930 93 768 183 256 687 336 41 470 545 412 99 908 49 718 289 522 501 8 741 24 
88 770 189 256 695 320 47 464 553 406 97 924 35 716 305 526 481 10 757 8 933 
773 184 258 701 320 55 448 559 400 105 918 33 732 291 524 49...

result:

ok 1

Test #9:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

34

output:

Yes
47 3008 1028 2115 824 3143 152 3846 105 918 2057 1492 554 3537 36 1946 2053 1008 3087 352 1694 2304 1143 2696 1303 608 1422 2625 444 1538 497 3596 225 272 
3024 1071 2112 772 3139 184 3847 88 902 2089 1494 521 3540 42 1937 2084 986 3077 368 1679 2336 1118 2688 1335 584 1431 2656 398 1537 508 358...

result:

ok 1

Test #10:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

55

output:

Yes
47 3008 1068 2131 812 3154 141 3890 77 930 2069 1512 518 3577 4 1931 2100 970 3125 322 1693 2338 1113 2692 1283 632 1415 2648 390 1577 470 3593 212 298 1617 2212 1882 133 3440 655 3360 734 256 3703 392 2583 1376 2190 833 3260 834 1201 2828 1249 2832 
3024 1071 2112 812 3155 172 3858 77 946 2061 ...

result:

ok 1

Test #11:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

89

output:

Yes
94 12032 151 7488 8374 5448 10403 1304 14567 536 13798 2049 5884 256 14969 1030 10713 4134 3544 8743 7248 9003 4308 9512 2773 13608 709 11554 4701 3202 12905 2326 9960 6163 908 15409 390 7753 8212 3809 12314 1509 6664 8566 1673 12642 1165 15170 1076 12939 3424 12445 2624 9404 771 6392 1543 2480 ...

result:

ok 1

Test #12:

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

input:

100

output:

Yes
94 12032 172 7491 8348 5472 10383 1392 14478 561 13774 2065 5864 279 14912 1078 10696 4131 3480 8807 7192 9062 4225 9596 2688 13689 646 11609 4646 3288 12839 2384 9899 6228 936 15445 424 7749 8226 3805 12290 1513 6678 8552 1683 12556 1201 15110 1097 12948 3425 12442 2661 9352 886 6281 1634 2445 ...

result:

wrong answer The integer 5216 appears more than 5 times