QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#776669 | #9415. Matrix | oumashu | WA | 3ms | 27040kb | C++17 | 977b | 2024-11-23 20:02:19 | 2024-11-23 20:02:19 |
Judging History
answer
#include<bits/stdc++.h>
#define int unsigned long long
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
const int N=1e6+10,mod=998244353;
typedef pair<int,int> pii;
int T;
int n,q,k,m,t;
// int a[N],b[N],c[N];
vector<int>g[N];
int a[60][60];
void solve()
{
cin>>n;
int cnt=1;
cout<<"Yes\n";
if(n==2)
{
cout<<1<<' '<<2<<'\n'<<3<<' '<<4;
return;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)a[i][j]=1;
for(int i=2;i<=n-1;i++)a[i][1]=++cnt;
for(int i=2;i<=n-1;i++)a[1][i]=++cnt;
a[1][n]=n+n;
int num=n+n-1-cnt;
for(int i=2;i<=n-1&&cnt<n+n-1;i++)a[n][i]=++cnt;
num++;
for(int i=num+1;i<=n;i++)a[n][i]=a[1][i];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<a[i][j]<<' ';
cout<<'\n';
}
}
signed main()
{
ios;
T=1;
// cin>>T;
while(T--)solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 27040kb
input:
2
output:
Yes 1 2 3 4
result:
ok Correct. (1 test case)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 27012kb
input:
3
output:
Yes 1 3 6 2 1 1 1 4 1
result:
wrong answer Integer 5 didn't appear. (test case 1)