QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#461887 | #8474. Matrices and Sums | ucup-team052# | AC ✓ | 46ms | 7784kb | C++23 | 1.1kb | 2024-07-03 09:44:49 | 2024-07-03 09:44:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
if(nega==-1) return -ans;
return ans;
}
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
inline int Rnd(int l,int r) {return rnd()%(r-l+1)+l;}
#define N 1005
int a[N][N];
signed main()
{
int n=read();
if(n%2==1) cout<<"No\n";
else
{
cout<<"Yes\n";
int m=n/2;
for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) a[i][j]=1;
for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) a[i][j+m]=j>i?-1:0;
for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) a[i+m][j]=j>i?0:1;
for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) a[i+m][j+m]=-1;
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) printf("%d%c",a[i][j]," \n"[j==n]);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3924kb
input:
2
output:
Yes 1 0 1 -1
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
1
output:
No
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
3
output:
No
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
4
output:
Yes 1 1 0 -1 1 1 0 0 1 0 -1 -1 1 1 -1 -1
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
6
output:
Yes 1 1 1 0 -1 -1 1 1 1 0 0 -1 1 1 1 0 0 0 1 0 0 -1 -1 -1 1 1 0 -1 -1 -1 1 1 1 -1 -1 -1
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
8
output:
Yes 1 1 1 1 0 -1 -1 -1 1 1 1 1 0 0 -1 -1 1 1 1 1 0 0 0 -1 1 1 1 1 0 0 0 0 1 0 0 0 -1 -1 -1 -1 1 1 0 0 -1 -1 -1 -1 1 1 1 0 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
10
output:
Yes 1 1 1 1 1 0 -1 -1 -1 -1 1 1 1 1 1 0 0 -1 -1 -1 1 1 1 1 1 0 0 0 -1 -1 1 1 1 1 1 0 0 0 0 -1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 -1 -1 -1 -1 -1 1 1 0 0 0 -1 -1 -1 -1 -1 1 1 1 0 0 -1 -1 -1 -1 -1 1 1 1 1 0 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1
result:
ok OK, Accepted.
Test #11:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
21
output:
No
result:
ok OK, Accepted.
Test #12:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
37
output:
No
result:
ok OK, Accepted.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
73
output:
No
result:
ok OK, Accepted.
Test #14:
score: 0
Accepted
time: 1ms
memory: 4304kb
input:
100
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
result:
ok OK, Accepted.
Test #15:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
233
output:
No
result:
ok OK, Accepted.
Test #16:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
555
output:
No
result:
ok OK, Accepted.
Test #17:
score: 0
Accepted
time: 17ms
memory: 6472kb
input:
666
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.
Test #18:
score: 0
Accepted
time: 36ms
memory: 7400kb
input:
888
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.
Test #19:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
999
output:
No
result:
ok OK, Accepted.
Test #20:
score: 0
Accepted
time: 46ms
memory: 7784kb
input:
1000
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.