QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#256508 | #7629. Make SYSU Great Again II | ucup-team2580 | WA | 0ms | 3600kb | C++20 | 1.9kb | 2023-11-18 19:46:00 | 2023-11-18 19:46:01 |
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())) 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)%n]<<" ";
cout<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
4
output:
Yes 0 59 0 31 63 0 27 0 0 31 0 59 27 0 63 0
result:
wrong answer The integer 0 appears more than 5 times