QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#383389 | #4633. Coprime Matrices | Slongod | WA | 0ms | 3596kb | C++14 | 941b | 2024-04-09 12:19:34 | 2024-04-09 12:19:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace Slongod{
const int N = 505;
int n , m , x , y , w , now , a[N][N];
void main()
{
cin >> n >> m >> x >> y >> w; now = 1;
for (int j = 1; j <= m; j += 2) {
for (int i = 1; i <= n; i += 2) {
if (i == n and j == m){a[i][j] = now; now++;}
else if (i == n){a[i][j] = now; a[i][j+1] = now + 1; now += 2;}
else if (j == m){a[i][j] = now; a[i+1][j] = now + 1; now += 2;}
else{a[i][j] = now; a[i][j+1] = now + 1; a[i+1][j+1] = now + 2; a[i+1][j] = now + 3; now += 4;}
}
} w = (w - a[x][y]); cout << "Yes\n";
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cout << (a[i][j] + w + n * m - 1) % (n * m) + 1 << ' ';
} cout << '\n';
}
}
}int main()
{
ios :: sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
return Slongod :: main(),0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
3 3 2 1 3
output:
Yes 9 1 6 3 2 7 4 5 8
result:
wrong output format Expected EOLN