QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#521465#5039. Black and WhitelyceggWA 2ms5536kbC++201.1kb2024-08-16 11:09:102024-08-16 11:09:11

Judging History

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

  • [2024-08-16 11:09:11]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5536kb
  • [2024-08-16 11:09:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int t,n,m,k;
#define M 998244353
int jiecheng[200200];
int mypow(int a,int b){
    int ret=1;
    while(b){
        if(b&1)ret=ret*a%M;
        a=a*a%M;
        b/=2;
    }
    return ret;
}
int niyuan(int a){
    return mypow(a,M-2);
}
int zuhe(int a,int b){
    if(a<b)return 0;
    return jiecheng[a]*niyuan(jiecheng[b]*jiecheng[a-b]%M)%M;
}
int jia1,jian1;
int qry(int v){
    int jianab=v+jia1-jian1;
    if(jianab%2!=0)return 0;
    jianab/=2;
    int jiaab=m;
    if((jianab+jiaab)%2!=0)return 0;
    int a=(jianab+jiaab)/2,b=(jiaab-jianab)/2;
    int ret=zuhe(jia1,a)*zuhe(jian1,b)%M;
    //printf("%lld\n",ret);
    return ret;
}
signed main(){
    scanf("%lld",&t);
    jiecheng[0]=1;
    for(int i=1;i<200200;i++)
        jiecheng[i]=jiecheng[i-1]*i%M;
    while(t--){
        scanf("%lld%lld%lld",&n,&m,&k);
        jia1=0,jian1=0;
        int sum=n+m;
        jian1=sum/2;
        jia1=sum-jian1;
        printf("%lld\n",(qry(4*k-2)+qry(4*k-1)+qry(4*k)+qry(4*k+1))%M);
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5532kb

input:

5
1 1 0
1 1 -1
2 2 1
2 2 0
4 4 1

output:

1
0
1
4
16

result:

ok 5 number(s): "1 0 1 4 16"

Test #2:

score: 0
Accepted
time: 2ms
memory: 5404kb

input:

100
1 1 -10
1 1 -9
1 1 -8
1 1 -7
1 1 -6
1 1 -5
1 1 -4
1 1 -3
1 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0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 5332kb

input:

100
2 10 -9
2 10 -8
2 10 -7
2 10 -6
2 10 -5
2 10 -4
2 10 -3
2 10 -2
2 10 -1
2 10 0
2 10 1
2 10 2
2 10 3
2 10 4
2 10 5
2 10 6
2 10 7
2 10 8
2 10 9
2 10 10
3 1 -10
3 1 -9
3 1 -8
3 1 -7
3 1 -6
3 1 -5
3 1 -4
3 1 -3
3 1 -2
3 1 -1
3 1 0
3 1 1
3 1 2
3 1 3
3 1 4
3 1 5
3 1 6
3 1 7
3 1 8
3 1 9
3 1 10
3 2 -10
...

output:

0
0
0
0
0
0
0
0
15
36
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
6
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
9
9
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
18
12
1
0
0
0
0

result:

ok 100 numbers

Test #7:

score: 0
Accepted
time: 2ms
memory: 5496kb

input:

100
3 4 7
3 4 8
3 4 9
3 4 10
3 5 -10
3 5 -9
3 5 -8
3 5 -7
3 5 -6
3 5 -5
3 5 -4
3 5 -3
3 5 -2
3 5 -1
3 5 0
3 5 1
3 5 2
3 5 3
3 5 4
3 5 5
3 5 6
3 5 7
3 5 8
3 5 9
3 5 10
3 6 -10
3 6 -9
3 6 -8
3 6 -7
3 6 -6
3 6 -5
3 6 -4
3 6 -3
3 6 -2
3 6 -1
3 6 0
3 6 1
3 6 2
3 6 3
3 6 4
3 6 5
3 6 6
3 6 7
3 6 8
3 6 9
3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
4
24
24
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
40
30
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
50
50
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
75
60
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
90
90

result:

ok 100 numbers

Test #8:

score: 0
Accepted
time: 2ms
memory: 5532kb

input:

100
3 9 2
3 9 3
3 9 4
3 9 5
3 9 6
3 9 7
3 9 8
3 9 9
3 9 10
3 10 -10
3 10 -9
3 10 -8
3 10 -7
3 10 -6
3 10 -5
3 10 -4
3 10 -3
3 10 -2
3 10 -1
3 10 0
3 10 1
3 10 2
3 10 3
3 10 4
3 10 5
3 10 6
3 10 7
3 10 8
3 10 9
3 10 10
4 1 -10
4 1 -9
4 1 -8
4 1 -7
4 1 -6
4 1 -5
4 1 -4
4 1 -3
4 1 -2
4 1 -1
4 1 0
4 1 1...

output:

20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
126
105
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
9
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
12
18
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #9:

score: 0
Accepted
time: 2ms
memory: 5496kb

input:

100
4 4 -3
4 4 -2
4 4 -1
4 4 0
4 4 1
4 4 2
4 4 3
4 4 4
4 4 5
4 4 6
4 4 7
4 4 8
4 4 9
4 4 10
4 5 -10
4 5 -9
4 5 -8
4 5 -7
4 5 -6
4 5 -5
4 5 -4
4 5 -3
4 5 -2
4 5 -1
4 5 0
4 5 1
4 5 2
4 5 3
4 5 4
4 5 5
4 5 6
4 5 7
4 5 8
4 5 9
4 5 10
4 6 -10
4 6 -9
4 6 -8
4 6 -7
4 6 -6
4 6 -5
4 6 -4
4 6 -3
4 6 -2
4 6 -1...

output:

0
1
16
36
16
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
40
60
20
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
50
100
50
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
100
150
60
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
120
225
120
15
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 5428kb

input:

100
4 9 -8
4 9 -7
4 9 -6
4 9 -5
4 9 -4
4 9 -3
4 9 -2
4 9 -1
4 9 0
4 9 1
4 9 2
4 9 3
4 9 4
4 9 5
4 9 6
4 9 7
4 9 8
4 9 9
4 9 10
4 10 -10
4 10 -9
4 10 -8
4 10 -7
4 10 -6
4 10 -5
4 10 -4
4 10 -3
4 10 -2
4 10 -1
4 10 0
4 10 1
4 10 2
4 10 3
4 10 4
4 10 5
4 10 6
4 10 7
4 10 8
4 10 9
4 10 10
5 1 -10
5 1 -9...

output:

0
0
0
0
0
0
35
210
315
140
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
245
441
245
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
12
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
24
24
4
0
0
0
0
0

result:

ok 100 numbers

Test #11:

score: 0
Accepted
time: 2ms
memory: 5536kb

input:

100
5 3 8
5 3 9
5 3 10
5 4 -10
5 4 -9
5 4 -8
5 4 -7
5 4 -6
5 4 -5
5 4 -4
5 4 -3
5 4 -2
5 4 -1
5 4 0
5 4 1
5 4 2
5 4 3
5 4 4
5 4 5
5 4 6
5 4 7
5 4 8
5 4 9
5 4 10
5 5 -10
5 5 -9
5 5 -8
5 5 -7
5 5 -6
5 5 -5
5 5 -4
5 5 -3
5 5 -2
5 5 -1
5 5 0
5 5 1
5 5 2
5 5 3
5 5 4
5 5 5
5 5 6
5 5 7
5 5 8
5 5 9
5 5 10
5...

output:

0
0
0
0
0
0
0
0
0
0
0
1
20
60
40
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
25
100
100
25
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
75
200
150
30
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
90
300
300
90
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
210
525
420
105

result:

ok 100 numbers

Test #12:

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

input:

100
5 8 3
5 8 4
5 8 5
5 8 6
5 8 7
5 8 8
5 8 9
5 8 10
5 9 -10
5 9 -9
5 9 -8
5 9 -7
5 9 -6
5 9 -5
5 9 -4
5 9 -3
5 9 -2
5 9 -1
5 9 0
5 9 1
5 9 2
5 9 3
5 9 4
5 9 5
5 9 6
5 9 7
5 9 8
5 9 9
5 9 10
5 10 -10
5 10 -9
5 10 -8
5 10 -7
5 10 -6
5 10 -5
5 10 -4
5 10 -3
5 10 -2
5 10 -1
5 10 0
5 10 1
5 10 2
5 10 3
...

output:

6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
245
735
735
245
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
56
490
1176
980
280
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4
0
0
463767689
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
16
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

wrong answer 64th numbers differ - expected: '0', found: '463767689'