QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#461887#8474. Matrices and Sumsucup-team052#AC ✓46ms7784kbC++231.1kb2024-07-03 09:44:492024-07-03 09:44:50

Judging History

你现在查看的是最新测评结果

  • [2024-07-03 09:44:50]
  • 评测
  • 测评结果:AC
  • 用时:46ms
  • 内存:7784kb
  • [2024-07-03 09:44:49]
  • 提交

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.