QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#524151#5039. Black and WhiteCelebrateWA 3ms5248kbC++141.4kb2024-08-19 11:12:332024-08-19 11:12:33

Judging History

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

  • [2024-08-19 11:12:33]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5248kb
  • [2024-08-19 11:12:33]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define dwn(i,x,y) for(int i=x;i>=y;i--)
#define ll long long
using namespace std;
template<typename T>inline void qr(T &x){
    x=0;int f=0;char s=getchar();
    while(!isdigit(s))f|=s=='-',s=getchar();
    while(isdigit(s))x=x*10+s-48,s=getchar();
    x=f?-x:x;
}
int cc=0,buf[31];
template<typename T>inline void qw(T x){
    if(x<0)putchar('-'),x=-x;
    do{buf[++cc]=int(x%10);x/=10;}while(x);
    while(cc)putchar(buf[cc--]+'0');
}
const int N=2e5+10,mod=998244353;
int fc[N],ifc[N];
int power(int a,int b){
    int ret=1;
    while(b){
        if(b&1)ret=1ll*ret*a%mod;
        a=1ll*a*a%mod;b>>=1;
    }
    return ret;
}
int C(int a,int b){
    if(a<0||b<0||a<b)return 0;
    return 1ll*fc[a]*ifc[b]%mod*ifc[a-b]%mod;
}
int work(int n,int m,int k){
    if(!n||!m){
        if(!k)return 1;
        return 0;
    }
    k+=n/2;
    return 1ll*C((n+m)/2,k)*C((n+m)/2,n-k)%mod;
}
void solve(){
    int n,m,k;qr(n),qr(m),qr(k);
    if((n+m)%2==0)qw(work(n,m,k)),puts("");
    else{
        int ans=work(n,m-1,k);
        if(m&1)ans=(ans+work(n-1,m,k+1));
        else ans=(ans+work(n-1,m,k));
        qw(ans);puts("");
    }
}
int main(){
    fc[0]=1;rep(i,1,200000)fc[i]=1ll*fc[i-1]*i%mod;
    ifc[200000]=power(fc[200000],mod-2);
    dwn(i,199999,0)ifc[i]=1ll*ifc[i+1]*(i+1)%mod;
    int tt;qr(tt);
    while(tt--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3ms
memory: 5096kb

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

output:

0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1
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
0
3
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
0
0
0
0

result:

ok 100 numbers

Test #3:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6

result:

ok 100 numbers

Test #4:

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

input:

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

output:

5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
4
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6
1
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

result:

ok 100 numbers

Test #5:

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

input:

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

output:

0
0
0
6
12
3
0
0
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
0
10
20
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
25
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
30
10
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #6:

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

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: 3ms
memory: 5168kb

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: 5052kb

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: 5164kb

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: 2ms
memory: 5052kb

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: 5036kb

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: 0
Accepted
time: 0ms
memory: 5200kb

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
0
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:

ok 100 numbers

Test #13:

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

input:

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

output:

4
30
40
10
0
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
1
30
150
200
75
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
36
225
400
225
36
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
126
525
700
315
42
1
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #14:

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

input:

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

output:

0
0
0
0
7
147
735
1225
735
147
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
28
392
1470
1960
980
168
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
28
448
1960
3136
1960
448
28
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
20
10
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #15:

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

input:

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

output:

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
5
60
150
100
15
0
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
1
42
315
700
525
126
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
49
441
1225
1225
441
49

result:

ok 100 numbers

Test #16:

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

input:

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

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
8
196
1176
2450
1960
588
56
1
0
0
0
0
0
0
0
0
0
0
0
0
0
8
224
1568
3920
3920
1568
224
8
0
0
0
0
0
0
0
0
0
0
0
0
0
36
672
3528
7056
5880
2016
252
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #17:

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

input:

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

output:

10
25
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
60
75
20
0
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
0
0
0
0
0
6
105
420
525
210
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
147
735
1225
735
147
7
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #18:

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

input:

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

output:

0
0
1
56
588
1960
2450
1176
196
8
0
0
0
0
0
0
0
0
0
0
0
0
0
1
64
784
3136
4900
3136
784
64
1
0
0
0
0
0
0
0
0
0
0
0
0
9
288
2352
7056
8820
4704
1008
72
1
0
0
0
0
0
0
0
0
0
0
0
0
9
324
3024
10584
15876
10584
3024
324
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #19:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
10
30
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
90
90
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
140
315
210
35
0
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
7
168
980
1960
1470
392
28
0

result:

ok 100 numbers

Test #20:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
8
224
1568
3920
3920
1568
224
8
0
0
0
0
0
0
0
0
0
0
0
0
1
72
1008
4704
8820
7056
2352
288
9
0
0
0
0
0
0
0
0
0
0
0
0
1
81
1296
7056
15876
15876
7056
1296
81
1
0
0
0
0
0
0
0
0
0
0
0
10
405
4320
17640
31752
26460
10080
1620
90
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5

result:

ok 100 numbers

Test #21:

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

input:

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

output:

6
0
0
0
0
0
0
0
0
0
0
0
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
20
105
126
35
0
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
21
280
980
1176
490
56
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #22:

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

input:

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

output:

0
0
28
448
1960
3136
1960
448
28
0
0
0
0
0
0
0
0
0
0
0
0
0
8
252
2016
5880
7056
3528
672
36
0
0
0
0
0
0
0
0
0
0
0
0
0
9
324
3024
10584
15876
10584
3024
324
9
0
0
0
0
0
0
0
0
0
0
0
1
90
1620
10080
26460
31752
17640
4320
405
10
0
0
0
0
0
0
0
0
0
0
0
1
100
2025
14400
44100
63504
44100
14400
2025
100
1
...

result:

ok 100 numbers

Test #23:

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

input:

100
30062 71054 -100000
30062 71054 -100000
30062 71054 -100000
30062 71054 40992
30062 71054 40991
30062 71054 40993
30062 71054 -30062
30062 71054 -30063
30062 71054 -30061
30062 71054 -40992
30062 71054 -40993
30062 71054 -40991
30062 71054 100000
30062 71054 100000
30062 71054 100000
30062 71054...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
328961717
795085417
795085417
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
934094839
969352177
969352177
0
0
0
0
0
0
747859250
187904707
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
355654512
451404637

result:

ok 100 numbers

Test #24:

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

input:

100
63684 22752 1
63684 22752 20364
63684 22752 69271
63684 22752 -86656
63684 22752 55933
63684 22752 -11815
63684 22752 70378
63684 22752 13354
63684 22752 14668
63684 22752 24671
63684 22752 11054
23704 37810 -61514
23704 37810 -61515
23704 37810 -61513
23704 37810 14106
23704 37810 14105
23704 3...

output:

451404637
0
0
0
0
0
0
0
0
0
872411452
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
509601357
228091250
228091250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
551068346
847872047
847872047
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #25:

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

input:

100
24004 64934 24004
24004 64934 24003
24004 64934 24005
24004 64934 -64934
24004 64934 -64935
24004 64934 -64933
24004 64934 64934
24004 64934 64933
24004 64934 64935
24004 64934 0
24004 64934 -1
24004 64934 1
24004 64934 42215
24004 64934 10969
24004 64934 82472
24004 64934 -20662
24004 64934 770...

output:

0
0
0
0
0
0
0
0
0
460705185
110081025
110081025
0
838201440
0
0
0
476158505
0
0
0
233841145
0
0
0
977289918
924294219
674387937
0
0
0
977289918
674387937
924294219
0
0
0
0
0
0
0
0
0
0
0
0
563850706
744004222
744004222
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
371614744
6648...

result:

ok 100 numbers

Test #26:

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

input:

100
100000 28788 -71213
100000 28788 -71211
100000 28788 -100000
100000 28788 -100000
100000 28788 -99999
100000 28788 71212
100000 28788 71211
100000 28788 71213
100000 28788 100000
100000 28788 100000
100000 28788 100000
100000 28788 100000
100000 28788 99999
100000 28788 100000
100000 28788 -2878...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
17617002
828748626
828748626
0
0
810632534
0
0
0
0
290244300
0
0
0
0
0
168631746
756159424
756159424
0
0
0
168631746
756159424
756159424
0
0
0
0
0
0
0
0
0
0
0
0
168631746
756159424
756159424
0
790541780
524070713
0
120609040
0
0
0
0
262679929
0
0
0
0
0
0
0
0
0...

result:

wrong answer 96th numbers differ - expected: '86454628', found: '1084698981'