QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671813 | #9415. Matrix | REN_REN# | WA | 0ms | 3800kb | C++20 | 973b | 2024-10-24 14:33:25 | 2024-10-24 14:33:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
using i128 = __int128;
int n, k;
const int N = 1000;
void solve(){
cin >> n;
vector ans(n + 1, vector<int>(n + 1));
ans[1][1] = 1, ans[1][2] = 2;
ans[2][1] = 3, ans[2][2] = 4;
int nex = 5;
for(int i = 3; i <= n; i += 2) {
ans[1][i] = nex ++;
}
for(int i = 4; i <= n; i += 2) {
ans[2][i] = nex ++;
}
for(int i = 3; i <= n; i ++) {
for(int j = 1; j <= n; j ++) {
ans[i][j] = nex;
}
nex ++;
}
cout << "Yes\n";
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= n; j ++) {
if(ans[i][j]) cout << ans[i][j] << ' ';
else cout << 1 << ' ';
}
cout << '\n';
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while(t --){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
input:
2
output:
Yes 1 2 3 4
result:
ok Correct. (1 test case)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3588kb
input:
3
output:
Yes 1 2 5 3 4 1 6 6 6
result:
wrong answer The number of quadruples 2 is invalid. (test case 1)