QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#383389#4633. Coprime MatricesSlongodWA 0ms3596kbC++14941b2024-04-09 12:19:342024-04-09 12:19:35

Judging History

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

  • [2024-04-09 12:19:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-04-09 12:19:34]
  • 提交

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