QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#256478 | #7629. Make SYSU Great Again II | ucup-team2580 | RE | 0ms | 3824kb | C++20 | 1.2kb | 2023-11-18 19:35:24 | 2023-11-18 19:35:25 |
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--;
for(int i=1;i<n;i++)
{
int rm=x-a[i-1];
vector<int> vec;
for(int j=1;j<=x;j++)
if((j&rm)==j&&cnt[j]<1)
vec.pb(j);
int p=rnd()%sz(vec);
cnt[vec[p]]++;
a[i]=vec[p];
}
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: 100
Accepted
time: 0ms
memory: 3600kb
input:
4
output:
Yes 0 11 36 25 9 32 27 4 36 25 0 11 27 4 9 32
result:
ok 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
1
output:
Yes 0
result:
ok 1
Test #3:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
2
output:
Yes 0 5 5 0
result:
ok 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
3
output:
Yes 0 6 9 5 8 2 10 1 4
result:
ok 1
Test #5:
score: -100
Runtime Error
input:
5