QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#808475#9874. Matrix ConstructionWhiteBreadWA 2ms3716kbC++14625b2024-12-10 21:02:012024-12-10 21:02:02

Judging History

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

  • [2024-12-10 21:02:02]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3716kb
  • [2024-12-10 21:02:01]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int t;int a[1004][1004];
void solve()
{
    int p,q,cnt=1;cin>>p>>q;
    for(int j=1;j<=2*q;j++)
    {
        int w=j;
        for(int i=1;w>0;i++,w--)
        {
            if(i<=p&&w<=q)
            a[i][w]=cnt++;
        }
    }
    cout<<"YES\n";
    for(int i=1;i<=p;i++,cout<<'\n')
    {
        for(int j=1;j<=q;j++)
        {
            cout<<a[i][j]<<' ';
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3716kb

input:

2
1 1
2 3

output:

YES
1 
YES
1 2 4 
3 5 6 

result:

ok All test cases passed. (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3712kb

input:

361
4 9
11 12
16 14
3 7
17 13
1 19
12 3
15 19
11 3
8 18
13 10
8 13
9 18
14 11
7 13
6 16
12 13
1 6
11 15
18 19
5 6
17 19
2 3
17 11
16 19
6 14
5 9
7 2
5 11
15 16
3 15
7 11
16 2
19 15
5 19
2 17
13 12
3 5
19 14
6 3
18 2
16 4
6 8
10 9
17 4
5 16
17 9
16 11
6 9
16 5
3 19
18 9
13 9
12 19
6 13
17 15
13 7
12 ...

output:

YES
1 2 4 7 11 15 19 23 27 
3 5 8 12 16 20 24 28 31 
6 9 13 17 21 25 29 32 34 
10 14 18 22 26 30 33 35 36 
YES
1 2 4 7 11 16 22 29 37 46 56 67 
3 5 8 12 17 23 30 38 47 57 68 78 
6 9 13 18 24 31 39 48 58 69 79 88 
10 14 19 25 32 40 49 59 70 80 89 97 
15 20 26 33 41 50 60 71 81 90 98 105 
21 27 34 42 ...

result:

wrong answer Integer parameter [name=a[16][14]] equals to 0, violates the range [1, 224] (test case 3)