QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218953 | #7629. Make SYSU Great Again II | PhantomThreshold# | AC ✓ | 170ms | 36692kb | C++20 | 2.3kb | 2023-10-18 21:05:36 | 2023-10-18 21:05:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=4100;
int n;
int ans[maxn+50][maxn+50];
int a[maxn+50];
int b[maxn+50];
int main(){
ios_base::sync_with_stdio(false);
cin >> n;
if (n<=2){
cout << "Yes" << "\n";
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
cout << 0 << " ";
}
cout << "\n";
}
return 0;
}
int L=0,N=1;
for (;N<=n;) N<<=1,L++;
vector<int> gray;
gray.push_back(0);
for (int t=0;t<=L-2;t++){
int sz=gray.size();
for (int j=sz-1;j>=0;j--) gray.push_back(gray[j]|(1<<t));
}
/*
{
cerr << "------------" << endl;
cerr << "L,N : " << L << " " << N << endl;
for (auto x:gray){
cerr << bitset<6>(x) << endl;
}
cerr << "----------" << endl;
}
*/
{
int sz=gray.size();
for (int i=0;i<sz;i++) a[i*2]=gray[i];
for (int i=0;i<sz;i++) a[i*2+1]=(~(a[i*2]|a[i*2+2]))&(N-1);
for (int i=0;i<sz;i++) b[i*2+1]=a[i*2]&a[i*2+2];
for (int i=0;i<sz;i++){
b[i*2]|=a[i*2+1];
b[i*2+2]|=a[i*2+1];
}
}
/*
{
cerr << "------------" << endl;
cerr << "L,N : " << L << " " << N << endl;
for (int i=0;i<N;i++){
cerr << bitset<6>(a[i]) << " " << bitset<6>(b[i]) << endl;
}
cerr << "----------" << endl;
}
*/
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
int tmp1=a[i];
int tmp2=a[j];
if (i%2==1) tmp2=b[j];
if (j%2==1) tmp1=b[i];
ans[i][j]=(tmp1<<L)|tmp2;
}
}
cout << "Yes" << "\n";
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
cout << ans[i][j] << " ";
}
cout << "\n";
}
/*
{
for (int i=0;i<n-1;i++){
for (int j=0;j<n-1;j++){
if ((ans[i][j]&ans[i+1][j])!=0){
cerr << "WA : " << i << " " << j << " " << i+1 << " " << j << endl;
}
if ((ans[i][j]&ans[i][j+1])!=0){
cerr << "WA : " << i << " " << j << " " << i << " " << j+1 << endl;
}
}
}
vector<int> cnt(4*n*n);
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
if (ans[i][j]<0 || ans[i][j]>4*n*n-1){
cerr << "[0,4n^2-1] : " << i << " " << j << endl;
}
cnt[ans[i][j]]++;
if (cnt[ans[i][j]]>5){
cerr << "ex 5 times : " << i << " " << j << " " << ans[i][j] << endl;
}
}
}
}
*/
/*
{
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
cerr << bitset<8>(ans[i][j]) << " ";
}
cerr << "\n";
}
}
*/
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
4
output:
Yes 0 54 1 52 54 0 54 1 8 54 9 52 38 8 38 9
result:
ok 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1
output:
Yes 0
result:
ok 1
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2
output:
Yes 0 0 0 0
result:
ok 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
3
output:
Yes 0 10 1 10 0 10 4 10 5
result:
ok 1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5
output:
Yes 0 54 1 52 3 54 0 54 1 52 8 54 9 52 11 38 8 38 9 36 24 38 25 36 27
result:
ok 1
Test #6:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8
output:
Yes 0 238 1 236 3 236 2 233 238 0 238 1 236 2 237 2 16 238 17 236 19 236 18 233 206 16 206 17 204 18 205 18 48 206 49 204 51 204 50 201 206 32 206 33 204 34 205 34 32 222 33 220 35 220 34 217 158 32 158 33 156 34 157 34
result:
ok 1
Test #7:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
13
output:
Yes 0 238 1 236 3 236 2 233 6 232 7 232 5 238 0 238 1 236 2 237 2 233 6 232 5 234 16 238 17 236 19 236 18 233 22 232 23 232 21 206 16 206 17 204 18 205 18 201 22 200 21 202 48 206 49 204 51 204 50 201 54 200 55 200 53 206 32 206 33 204 34 205 34 201 38 200 37 202 32 222 33 220 35 220 34 217 38...
result:
ok 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
21
output:
Yes 0 990 1 988 3 988 2 985 6 984 7 984 5 986 4 979 12 978 13 976 15 990 0 990 1 988 2 989 2 985 6 984 5 986 4 987 4 979 12 978 13 976 32 990 33 988 35 988 34 985 38 984 39 984 37 986 36 979 44 978 45 976 47 926 32 926 33 924 34 925 34 921 38 920 37 922 36 923 36 915 44 914 45 912 96 926 97 924 ...
result:
ok 1
Test #9:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
34
output:
Yes 0 4030 1 4028 3 4028 2 4025 6 4024 7 4024 5 4026 4 4019 12 4018 13 4016 15 4016 14 4017 10 4020 11 4020 9 4022 8 4007 24 4006 4030 0 4030 1 4028 2 4029 2 4025 6 4024 5 4026 4 4027 4 4019 12 4018 13 4016 14 4017 10 4021 10 4020 9 4022 8 4023 8 4007 24 64 4030 65 4028 67 4028 66 4025 70 4024 71 ...
result:
ok 1
Test #10:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
55
output:
Yes 0 4030 1 4028 3 4028 2 4025 6 4024 7 4024 5 4026 4 4019 12 4018 13 4016 15 4016 14 4017 10 4020 11 4020 9 4022 8 4007 24 4006 25 4004 27 4004 26 4001 30 4000 31 4000 29 4002 28 4003 20 4010 21 4008 23 4008 22 4030 0 4030 1 4028 2 4029 2 4025 6 4024 5 4026 4 4027 4 4019 12 4018 13 4016 14 4017 1...
result:
ok 1
Test #11:
score: 0
Accepted
time: 1ms
memory: 6164kb
input:
89
output:
Yes 0 16254 1 16252 3 16252 2 16249 6 16248 7 16248 5 16250 4 16243 12 16242 13 16240 15 16240 14 16241 10 16244 11 16244 9 16246 8 16231 24 16230 25 16228 27 16228 26 16225 30 16224 31 16224 29 16226 28 16227 20 16234 21 16232 23 16232 22 16233 18 16236 19 16236 17 16238 16 16207 48 16206 49 16204 ...
result:
ok 1
Test #12:
score: 0
Accepted
time: 1ms
memory: 5916kb
input:
100
output:
Yes 0 16254 1 16252 3 16252 2 16249 6 16248 7 16248 5 16250 4 16243 12 16242 13 16240 15 16240 14 16241 10 16244 11 16244 9 16246 8 16231 24 16230 25 16228 27 16228 26 16225 30 16224 31 16224 29 16226 28 16227 20 16234 21 16232 23 16232 22 16233 18 16236 19 16236 17 16238 16 16207 48 16206 49 16204 ...
result:
ok 1
Test #13:
score: 0
Accepted
time: 2ms
memory: 6176kb
input:
200
output:
Yes 0 65278 1 65276 3 65276 2 65273 6 65272 7 65272 5 65274 4 65267 12 65266 13 65264 15 65264 14 65265 10 65268 11 65268 9 65270 8 65255 24 65254 25 65252 27 65252 26 65249 30 65248 31 65248 29 65250 28 65251 20 65258 21 65256 23 65256 22 65257 18 65260 19 65260 17 65262 16 65231 48 65230 49 65228 ...
result:
ok 1
Test #14:
score: 0
Accepted
time: 5ms
memory: 8144kb
input:
300
output:
Yes 0 261630 1 261628 3 261628 2 261625 6 261624 7 261624 5 261626 4 261619 12 261618 13 261616 15 261616 14 261617 10 261620 11 261620 9 261622 8 261607 24 261606 25 261604 27 261604 26 261601 30 261600 31 261600 29 261602 28 261603 20 261610 21 261608 23 261608 22 261609 18 261612 19 261612 17 261...
result:
ok 1
Test #15:
score: 0
Accepted
time: 4ms
memory: 9972kb
input:
400
output:
Yes 0 261630 1 261628 3 261628 2 261625 6 261624 7 261624 5 261626 4 261619 12 261618 13 261616 15 261616 14 261617 10 261620 11 261620 9 261622 8 261607 24 261606 25 261604 27 261604 26 261601 30 261600 31 261600 29 261602 28 261603 20 261610 21 261608 23 261608 22 261609 18 261612 19 261612 17 261...
result:
ok 1
Test #16:
score: 0
Accepted
time: 13ms
memory: 11860kb
input:
500
output:
Yes 0 261630 1 261628 3 261628 2 261625 6 261624 7 261624 5 261626 4 261619 12 261618 13 261616 15 261616 14 261617 10 261620 11 261620 9 261622 8 261607 24 261606 25 261604 27 261604 26 261601 30 261600 31 261600 29 261602 28 261603 20 261610 21 261608 23 261608 22 261609 18 261612 19 261612 17 261...
result:
ok 1
Test #17:
score: 0
Accepted
time: 14ms
memory: 12504kb
input:
600
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #18:
score: 0
Accepted
time: 20ms
memory: 14556kb
input:
700
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #19:
score: 0
Accepted
time: 24ms
memory: 16648kb
input:
800
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #20:
score: 0
Accepted
time: 37ms
memory: 18412kb
input:
900
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #21:
score: 0
Accepted
time: 42ms
memory: 20788kb
input:
1000
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #22:
score: 0
Accepted
time: 63ms
memory: 24268kb
input:
1200
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #23:
score: 0
Accepted
time: 91ms
memory: 26484kb
input:
1400
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #24:
score: 0
Accepted
time: 106ms
memory: 29184kb
input:
1600
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #25:
score: 0
Accepted
time: 138ms
memory: 34388kb
input:
1800
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #26:
score: 0
Accepted
time: 154ms
memory: 35684kb
input:
1900
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #27:
score: 0
Accepted
time: 142ms
memory: 34732kb
input:
1920
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #28:
score: 0
Accepted
time: 170ms
memory: 36692kb
input:
2000
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #29:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
62
output:
Yes 0 4030 1 4028 3 4028 2 4025 6 4024 7 4024 5 4026 4 4019 12 4018 13 4016 15 4016 14 4017 10 4020 11 4020 9 4022 8 4007 24 4006 25 4004 27 4004 26 4001 30 4000 31 4000 29 4002 28 4003 20 4010 21 4008 23 4008 22 4009 18 4012 19 4012 17 4014 4030 0 4030 1 4028 2 4029 2 4025 6 4024 5 4026 4 4027 4 4...
result:
ok 1
Test #30:
score: 0
Accepted
time: 1ms
memory: 5808kb
input:
130
output:
Yes 0 65278 1 65276 3 65276 2 65273 6 65272 7 65272 5 65274 4 65267 12 65266 13 65264 15 65264 14 65265 10 65268 11 65268 9 65270 8 65255 24 65254 25 65252 27 65252 26 65249 30 65248 31 65248 29 65250 28 65251 20 65258 21 65256 23 65256 22 65257 18 65260 19 65260 17 65262 16 65231 48 65230 49 65228 ...
result:
ok 1
Test #31:
score: 0
Accepted
time: 2ms
memory: 5968kb
input:
126
output:
Yes 0 16254 1 16252 3 16252 2 16249 6 16248 7 16248 5 16250 4 16243 12 16242 13 16240 15 16240 14 16241 10 16244 11 16244 9 16246 8 16231 24 16230 25 16228 27 16228 26 16225 30 16224 31 16224 29 16226 28 16227 20 16234 21 16232 23 16232 22 16233 18 16236 19 16236 17 16238 16 16207 48 16206 49 16204 ...
result:
ok 1
Test #32:
score: 0
Accepted
time: 1ms
memory: 6088kb
input:
66
output:
Yes 0 16254 1 16252 3 16252 2 16249 6 16248 7 16248 5 16250 4 16243 12 16242 13 16240 15 16240 14 16241 10 16244 11 16244 9 16246 8 16231 24 16230 25 16228 27 16228 26 16225 30 16224 31 16224 29 16226 28 16227 20 16234 21 16232 23 16232 22 16233 18 16236 19 16236 17 16238 16 16207 48 16206 16254 0 ...
result:
ok 1
Test #33:
score: 0
Accepted
time: 46ms
memory: 20604kb
input:
1021
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #34:
score: 0
Accepted
time: 35ms
memory: 20872kb
input:
1022
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #35:
score: 0
Accepted
time: 39ms
memory: 20760kb
input:
1023
output:
Yes 0 1047550 1 1047548 3 1047548 2 1047545 6 1047544 7 1047544 5 1047546 4 1047539 12 1047538 13 1047536 15 1047536 14 1047537 10 1047540 11 1047540 9 1047542 8 1047527 24 1047526 25 1047524 27 1047524 26 1047521 30 1047520 31 1047520 29 1047522 28 1047523 20 1047530 21 1047528 23 1047528 22 104752...
result:
ok 1
Test #36:
score: 0
Accepted
time: 49ms
memory: 20368kb
input:
1024
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #37:
score: 0
Accepted
time: 46ms
memory: 22168kb
input:
1025
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #38:
score: 0
Accepted
time: 53ms
memory: 20944kb
input:
1026
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Test #39:
score: 0
Accepted
time: 46ms
memory: 20880kb
input:
1027
output:
Yes 0 4192254 1 4192252 3 4192252 2 4192249 6 4192248 7 4192248 5 4192250 4 4192243 12 4192242 13 4192240 15 4192240 14 4192241 10 4192244 11 4192244 9 4192246 8 4192231 24 4192230 25 4192228 27 4192228 26 4192225 30 4192224 31 4192224 29 4192226 28 4192227 20 4192234 21 4192232 23 4192232 22 419223...
result:
ok 1
Extra Test:
score: 0
Extra Test Passed