QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#776669#9415. MatrixoumashuWA 3ms27040kbC++17977b2024-11-23 20:02:192024-11-23 20:02:19

Judging History

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

  • [2024-11-23 20:02:19]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:27040kb
  • [2024-11-23 20:02:19]
  • 提交

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)