QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#609033 | #9415. Matrix | Kanate# | WA | 0ms | 3720kb | C++14 | 1.1kb | 2024-10-04 10:19:53 | 2024-10-04 10:19:56 |
Judging History
answer
#include<bits/stdc++.h>
// #define int long long
//#define mod 1000000007
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
using namespace std;
template<class T>void chkmax(T &a,T b){a=max(a,b);}
template<class T>void chkmin(T &a,T b){a=min(a,b);}
template<class T>T read(T &x)
{
x=0;T f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+(c^'0');c=getchar();}
return x*=f;
}
template<class T,class ...L>void read(T &x,L &...l){read(x),read(l...);}
template<class T>void write(T x)
{
if(x<0){putchar('-');x=-x;}
if(x>9){write(x/10);}putchar(x%10+'0');
}
template<class T>void write(T x,char c){write(x),putchar(c);}
int n,x[55][55];
void solve(int n)
{
int cnt=0;
cnt++;
rep(i,1,n)
x[i][i]=cnt;
rep(i,1,n-2)
{
cnt++;
rep(j,i+1,n)
x[i][j]=cnt;
}
rep(i,1,n-2)
{
cnt++;
rep(j,i+1,n)
x[j][i]=cnt;
}
x[n-1][n]=++cnt;
x[n][n-1]=++cnt;
x[n][n]=++cnt;
rep(i,1,n)rep(j,1,n)write(x[i][j]," \n"[j==n]);
}
signed main()
{
read(n);
puts("Yes");
solve(n);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3720kb
input:
2
output:
Yes 1 2 3 4
result:
ok Correct. (1 test case)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
input:
3
output:
Yes 1 2 2 3 1 4 3 5 6
result:
wrong answer The number of quadruples 4 is invalid. (test case 1)