QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#806505#9874. Matrix Constructionk1nsomWA 1ms5764kbC++14678b2024-12-09 11:11:512024-12-09 11:11:52

Judging History

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

  • [2024-12-09 11:11:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5764kb
  • [2024-12-09 11:11:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int a[5005][5005], vis[5005][5005];
signed main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        cin >> n >> m;
        int tot = 0;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= m; j++)
                for (int k = 0; i + k >= 1 && i + k <= n && j - k >= 1 && j - k <= m; k++)
                    if (!vis[i + k][j - k])
                        a[i + k][j - k] = ++tot, vis[i + k][j - k] = 1;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= m; j++)
                cout << a[i][j] << " \n"[j == m], vis[i][j] = 0;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5764kb

input:

2
1 1
2 3

output:

1
1 2 4
3 5 6

result:

wrong answer Token parameter [name=ok] equals to "1", doesn't correspond to pattern "[yY][eE][sS]" (test case 1)