QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#782139 | #9415. Matrix | rdcamelot | WA | 0ms | 3640kb | C++20 | 1.1kb | 2024-11-25 19:02:44 | 2024-11-25 19:02:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64=long long;
using u64=unsigned long long;
#define ll long long
const int inf=1e9;
const ll inff=1e18;
using i128=__int128;
void solve(){
int n;
cin>>n;
//1..2n
if(n==1){
cout<<"NO"<<'\n';
return;
}
/*4*4 8
1 5 6 2
7 5 6 7
8 5 6 8
3 5 6 4
*/
cout<<"YES"<<'\n';
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==1 && j==1){
cout<<1<<' ';
}else if(i==1 && j==n){
cout<<2<<' ';
}else if(i==n && j==1){
cout<<3<<' ';
}else if(i==n && j==n){
cout<<4<<' ';
}else{
if(j==1 || j==n){
cout<<(4+n-2+i-1)<<' ';
}else{
cout<<(4+j-1)<<' ';
}
}
}
cout<<'\n';
}
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3640kb
input:
2
output:
YES 1 2 3 4
result:
wrong answer Line [name=yesno] equals to "YES", doesn't correspond to pattern "Yes|No" (test case 1)