QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#256516 | #7629. Make SYSU Great Again II | ucup-team2580 | WA | 1ms | 3488kb | C++20 | 1.9kb | 2023-11-18 19:48:28 | 2023-11-18 19:48:28 |
Judging History
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())+5) 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3404kb
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: 0ms
memory: 3440kb
input:
1
output:
Yes 0
result:
ok 1
Test #3:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
2
output:
Yes 3 12 12 3
result:
ok 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
3
output:
Yes 3 12 0 12 3 0 0 0 15
result:
ok 1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3440kb
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: 1ms
memory: 3380kb
input:
8
output:
Yes 15 240 1 198 40 130 108 16 240 15 192 33 134 104 18 12 12 192 47 128 97 22 8 242 194 44 128 111 16 1 246 8 40 130 108 16 15 240 1 198 134 104 18 12 240 15 192 33 97 22 8 242 12 192 47 128 16 1 246 8 194 44 128 111
result:
ok 1
Test #7:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
13
output:
Yes 15 240 8 195 36 137 100 17 70 152 66 60 128 240 15 192 40 131 100 25 68 145 70 56 130 12 12 192 47 128 104 19 68 153 68 49 134 8 242 194 44 128 111 16 72 147 68 57 132 1 246 8 40 130 108 16 79 144 72 51 132 9 244 1 198 134 104 18 76 144 79 48 136 3 244 9 196 33 97 22 72 146 76 48 143 0 248...
result:
ok 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
21
output:
Yes 26 832 35 780 178 269 80 143 544 350 513 462 48 970 17 484 514 424 581 408 97 833 58 768 163 268 82 141 560 335 512 478 33 974 16 490 529 420 578 392 101 24 56 769 186 256 67 140 562 333 528 463 32 990 1 494 528 426 593 388 98 8 837 773 184 257 90 128 547 332 530 461 48 975 0 510 513 430 592 ...
result:
ok 1
Test #9:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
34
output:
Yes 63 4032 1 198 313 642 1336 711 3096 419 2140 1058 789 3304 517 2458 1636 2067 1248 2329 1702 328 2611 1356 2192 1825 2246 1584 459 3604 138 3652 387 64 4032 63 192 257 646 1337 706 3128 391 2136 1059 796 3298 533 2472 1605 2074 1252 2323 1696 345 2598 1352 2227 1804 2256 1569 454 3632 139 3668 ...
result:
ok 1
Test #10:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
55
output:
Yes 63 4032 22 201 290 669 1282 717 3122 396 2161 1038 785 3310 529 2474 1604 2074 1253 2322 1708 323 2620 1345 2182 1849 2242 1592 455 3608 163 3676 418 85 3880 197 2842 1188 2387 1696 281 2726 1096 2995 1100 912 3169 774 3248 843 148 1866 2180 579 1408 4032 63 192 278 649 1314 733 3074 397 2162 1...
result:
ok 1
Test #11:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
89
output:
Yes 27 3456 604 9251 140 15987 264 10343 1432 6695 8400 7727 400 1637 6426 8260 7857 8526 3729 4422 2560 12761 3110 8920 7175 8680 5654 10665 4182 9128 2133 13602 2781 12320 1869 12464 777 14420 673 9474 4725 11528 4789 2314 13924 2451 12908 1298 6821 1114 15012 330 4229 10864 1158 6241 9870 4192 11...
result:
ok 1
Test #12:
score: -100
Wrong Answer
time: 1ms
memory: 3440kb
input:
100
output:
Yes 27 3456 608 9241 230 15881 374 10241 1522 6669 8418 7708 419 1628 6435 8204 7923 8456 3815 4376 2599 12752 3119 8848 7269 8602 5700 10673 4174 9105 2118 13568 2777 12326 1880 12423 872 14358 681 9558 4648 11605 4770 2397 13856 2509 12848 1289 6868 1057 14978 373 4232 10805 1162 6244 9875 4204 11...
result:
wrong answer The integer 4504 appears more than 5 times