QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521089#7151. Tree embeddingAllSolvedin1557AC ✓23ms14704kbC++173.3kb2024-08-15 21:08:312024-08-15 21:08:43

Judging History

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

  • [2024-08-15 21:08:43]
  • 评测
  • 测评结果:AC
  • 用时:23ms
  • 内存:14704kb
  • [2024-08-15 21:08:31]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,ll> pii;

vector<pii>v[1005];

ll sz[1005],c0,ans,A[20][1005],n;
bool vis[1005];
ll dis[1005][1005];
map<pii,ll>mp[20],mp2[20];

void getdis(ll st)
{
    for(ll i=1;i<=n;i++) dis[st][i]=-1;
    dis[st][st]=0; queue<ll>q; q.push(st);
    while(!q.empty())
    {
        ll x=q.front(); q.pop();
        for(auto i:v[x])
        {
            if(dis[st][i.fi]!=-1) continue;
            dis[st][i.fi]=dis[st][x]+i.se;
            q.push(i.fi);
        }
    }
}

void getans(ll st)
{
    for(ll j=0;j<=ans;j++)
    {
        fill(vis+1,vis+1+n,0);
        vis[st]=1; queue<ll>q; q.push(st);
        while(!q.empty())
        {
            ll x=q.front(); q.pop();
            for(auto i:v[x])
            {
                if(vis[i.fi]) continue;
                ll c=mp2[j][{x,i.fi}];
                if(!vis[c]&&dis[st][c]==dis[st][i.fi]+dis[i.fi][c]) mp[j][{x,i.fi}]*=-1;
                A[j][i.fi]=A[j][x]+i.se*mp[j][{x,i.fi}];
                q.push(i.fi); vis[i.fi]=1;
            }
        }
    }
}
void init(ll x,ll p)
{
    sz[x]=1;
    for(auto i:v[x])
    {
        if(vis[i.fi]||i.fi==p) continue;
        init(i.fi,x);
        sz[x]+=sz[i.fi];
    }
}
ll get_cent(ll x,ll p,ll nn)
{
    for(auto i:v[x]) if(i.fi!=p&&!vis[i.fi]&&sz[i.fi]*2>nn) return get_cent(i.fi,x,nn);
    return x;
}
void dfs(ll x,ll p,ll t,ll b,ll c)
{
    if(p) mp[b][{x,p}]=mp[b][{p,x}]=t, mp2[b][{x,p}]=mp2[b][{p,x}]=c;
    for(auto i:v[x])
    {
        if(i.fi==p||vis[i.fi]) continue;
        dfs(i.fi,x,t,b,c);
    }
}
void f(ll x,ll b)
{
    init(x,0); ans=max(ans,b);
    ll nn=sz[x],c=get_cent(x,0,sz[x]);
    if(nn==1) return;
    if(b==0) c0=c;
    if(nn==2)
    {
        ll a;
        for(auto i:v[c]) if(!vis[i.fi]) a=i.fi;
        mp[b][{a,c}]=mp[b][{c,a}]=1;
        return;
    }
    init(c,0);
    vector<ll>v1,v2;
    vector<pii>tmp;
    for(auto i:v[c])
    {
        if(!vis[i.fi])
            tmp.push_back({sz[i.fi],i.fi});
    }
    sort(tmp.begin(),tmp.end()); reverse(tmp.begin(),tmp.end());
    int a1=0,a2=0;
    for(auto i:tmp)
    {
        if(a1<=a2) v1.push_back(i.se), a1+=i.fi;
        else v2.push_back(i.se), a2+=i.fi;
    }

    for(auto i:v1) vis[i]=1;
    dfs(c,0,1,b,c);
    f(c,b+1);
    for(auto i:v1) vis[i]=0;
    for(auto i:v2) vis[i]=1;
    dfs(c,0,-1,b,c);
    f(c,b+1);
    for(auto i:v2) vis[i]=0;
}


int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for(ll i=1;i<n;i++)
    {
        ll a,b,c; cin>>a>>b>>c;
        v[a].push_back({b,c}); v[b].push_back({a,c});
    }
    for(ll i=1;i<=n;i++) getdis(i);
    f(1,0);
    cout<<ans+1<<'\n';
    getans(c0);
    for(ll j=1;j<=n;j++, cout<<'\n') for(ll i=0;i<=ans;i++) cout<<A[i][j]<<' ';
    /*for(ll i=1;i<=n;i++) for(ll j=i+1;j<=n;j++)
    {
        ll d=0;
        for(ll k=0;k<=ans;k++) d=max(d,abs(A[k][i]-A[k][j]));
        if(d!=dis[i][j])
        {
            cout<<i<<' '<<j<<'\n';
            for(ll k=0;k<=ans;k++) cout<<A[k][i]<<' ';
            cout<<'\n';
            for(ll k=0;k<=ans;k++) cout<<A[k][j]<<' ';
            cout<<'\n';
            cout<<dis[i][j]<<' '<<d<<'\n';
        }
    }*/
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
1 2 2

output:

1
0 
2 

result:

ok 

Test #2:

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

input:

4
1 2 1
1 3 1
1 4 1

output:

3
0 0 0 
-1 1 1 
1 1 0 
-1 -1 1 

result:

ok 

Test #3:

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

input:

10
8 2 33305
2 6 69148
3 2 78693
5 9 4671
4 9 60174
7 2 53555
9 2 44205
1 5 51522
4 10 8094

output:

5
56193 -56193 56193 56193 0 
-44205 44205 44205 44205 44205 
-122898 -34488 -34488 122898 122898 
60174 60174 -60174 60174 0 
4671 -4671 4671 4671 0 
-113353 113353 113353 113353 44205 
-97760 -9350 97760 97760 44205 
-77510 77510 10900 77510 44205 
0 0 0 0 0 
68268 68268 -68268 68268 0 

result:

ok 

Test #4:

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

input:

7
3 2 84583
1 2 99813
2 6 69523
4 2 85328
5 7 95654
5 4 79707

output:

4
99813 -99813 99813 99813 
0 0 0 0 
84583 84583 84583 0 
-85328 -85328 85328 0 
-165035 -165035 5621 79707 
69523 -69523 -69523 69523 
-260689 -260689 -90033 175361 

result:

ok 

Test #5:

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

input:

7
3 1 81630
4 3 90999
7 5 34787
4 2 45864
6 4 22160
3 7 70320

output:

4
81630 81630 81630 0 
-136863 -136863 136863 45864 
0 0 0 0 
-90999 -90999 90999 0 
105107 -105107 -105107 105107 
-113159 -113159 68839 22160 
70320 -70320 -70320 70320 

result:

ok 

Test #6:

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

input:

9
5 9 52
7 9 97888
4 7 72858
1 6 71334
6 2 19443
8 2 31727
5 3 14365
2 7 75461

output:

4
-166238 -166238 15316 166238 
-75461 -75461 -75461 75461 
112305 112305 -83471 112305 
72858 -72858 72858 72858 
97940 97940 -97836 97940 
-94904 -94904 -56018 94904 
0 0 0 0 
-107188 -43734 -107188 107188 
97888 97888 -97888 97888 

result:

ok 

Test #7:

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

input:

2
1 2 20340

output:

1
0 
20340 

result:

ok 

Test #8:

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

input:

2
2 1 51883

output:

1
0 
51883 

result:

ok 

Test #9:

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

input:

8
8 7 10751
3 4 95845
6 7 62471
6 2 19671
2 3 29382
2 5 10022
7 1 3280

output:

4
65751 -65751 65751 3280 
-19671 -19671 19671 19671 
-49053 -49053 -9711 49053 
-144898 -144898 -105556 144898 
-29693 -9649 29693 29693 
0 0 0 0 
62471 -62471 62471 0 
73222 -73222 51720 10751 

result:

ok 

Test #10:

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

input:

9
4 9 36917
1 6 23007
5 4 46177
8 7 54587
1 7 71340
2 1 56998
6 3 27648
4 1 33264

output:

4
0 0 0 0 
-56998 -56998 56998 56998 
50655 50655 -50655 50655 
-33264 33264 -33264 33264 
-79441 79441 12913 79441 
23007 23007 -23007 23007 
71340 -71340 -71340 71340 
125927 -125927 -125927 125927 
-70181 70181 -70181 70181 

result:

ok 

Test #11:

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

input:

10
7 5 75030
7 6 72683
10 7 21009
1 10 98067
8 6 78011
2 6 37017
3 7 59811
7 9 75484
4 9 29913

output:

5
119076 -119076 119076 119076 0 
-109700 -109700 -109700 109700 37017 
-59811 59811 59811 59811 0 
105397 105397 105397 105397 0 
-75030 75030 -75030 75030 0 
-72683 -72683 -72683 72683 0 
0 0 0 0 0 
-150694 -150694 -150694 -5328 78011 
75484 75484 75484 75484 0 
21009 -21009 21009 21009 0 

result:

ok 

Test #12:

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

input:

9
6 4 45480
1 3 73208
8 5 48334
2 8 85607
9 3 26872
6 7 38398
6 8 56313
8 3 34234

output:

4
107442 107442 38974 107442 
85607 -85607 85607 85607 
34234 34234 -34234 34234 
-101793 101793 -10833 101793 
-48334 -48334 48334 48334 
-56313 56313 -56313 56313 
-94711 94711 -94711 94711 
0 0 0 0 
61106 61106 -61106 61106 

result:

ok 

Test #13:

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

input:

10
3 2 43219
1 2 36963
5 10 33305
6 9 69148
4 9 78693
2 9 4671
9 7 60174
10 9 53555
10 8 44205

output:

5
41634 41634 41634 41634 0 
4671 4671 4671 4671 0 
47890 47890 -38548 47890 0 
-78693 78693 78693 78693 0 
-86860 -86860 20250 86860 86860 
69148 -69148 -69148 69148 0 
-60174 60174 -60174 60174 0 
-97760 -97760 97760 97760 53555 
0 0 0 0 0 
-53555 -53555 53555 53555 53555 

result:

ok 

Test #14:

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

input:

10
6 7 99813
1 9 69523
3 6 85328
9 5 95654
2 10 79707
2 8 98694
6 2 81188
6 9 62924
4 6 13856

output:

5
-132447 -132447 -6599 132447 132447 
81188 81188 81188 81188 0 
-85328 85328 85328 85328 0 
13856 -13856 -13856 13856 0 
-158578 -158578 158578 158578 62924 
0 0 0 0 0 
-99813 99813 -99813 99813 0 
179882 179882 179882 179882 0 
-62924 -62924 62924 62924 62924 
160895 160895 1481 160895 0 

result:

ok 

Test #15:

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

input:

10
1 2 90999
2 7 34787
2 6 45864
6 10 22160
6 4 70320
3 2 25420
2 9 2202
7 5 72292
8 7 40402

output:

5
-90999 90999 90999 90999 0 
0 0 0 0 0 
25420 -25420 25420 25420 0 
116184 116184 24456 116184 0 
-107079 -107079 107079 37505 34787 
45864 45864 -45864 45864 0 
-34787 -34787 34787 -34787 34787 
-75189 -75189 -5615 -75189 75189 
-2202 2202 -2202 2202 0 
68024 68024 -68024 68024 0 

result:

ok 

Test #16:

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

input:

10
9 6 14889
9 10 52
5 9 97888
9 4 72858
9 7 71334
9 8 19443
9 1 31727
2 9 14365
9 3 75461

output:

5
-31727 -31727 -31727 31727 31727 
14365 14365 14365 14365 0 
-75461 75461 75461 75461 0 
72858 -72858 72858 72858 0 
-97888 -97888 97888 97888 0 
14889 14889 -14889 14889 0 
-71334 71334 -71334 71334 0 
19443 -19443 -19443 19443 0 
0 0 0 0 0 
-52 -52 -52 -52 52 

result:

ok 

Test #17:

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

input:

10
10 6 6075
10 2 98020
10 1 58423
2 4 99364
10 7 37755
8 7 13465
9 10 52741
3 7 91030
2 5 2008

output:

5
-58423 58423 58423 58423 0 
98020 98020 98020 98020 0 
-128785 -128785 -53275 128785 128785 
197384 197384 197384 197384 0 
100028 100028 96012 100028 0 
6075 -6075 -6075 6075 0 
-37755 -37755 37755 37755 37755 
-51220 -51220 51220 51220 37755 
-52741 52741 -52741 52741 0 
0 0 0 0 0 

result:

ok 

Test #18:

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

input:

10
7 6 86861
5 2 30580
8 6 10447
10 2 25869
2 6 62961
1 2 16000
3 4 6458
2 3 399
3 9 4363

output:

5
-16000 16000 16000 16000 0 
0 0 0 0 0 
399 399 399 399 0 
6857 6857 6857 6857 0 
30580 -30580 -30580 30580 0 
-62961 -62961 62961 -62961 62961 
-149822 -149822 149822 23900 62961 
-73408 -73408 52514 -73408 73408 
4762 4762 -3964 4762 0 
-25869 25869 -25869 25869 0 

result:

ok 

Test #19:

score: 0
Accepted
time: 1ms
memory: 5664kb

input:

10
10 3 10751
5 8 95845
1 10 62471
3 9 19671
8 4 29382
2 3 10022
7 1 3280
1 6 18279
10 8 30909

output:

5
-62471 62471 62471 62471 62471 
20773 729 20773 20773 0 
10751 10751 10751 10751 0 
-60291 -60291 1527 60291 60291 
-126754 -126754 126754 126754 30909 
-80750 80750 44192 80750 80750 
-65751 65751 65751 65751 62471 
-30909 -30909 30909 30909 30909 
30422 30422 30422 10751 0 
0 0 0 0 0 

result:

ok 

Test #20:

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

input:

10
3 9 1937
9 6 36917
10 4 23007
5 8 46177
10 2 54587
10 6 71340
7 9 56998
8 1 27648
6 8 33264

output:

5
-60912 60912 5616 60912 60912 
-125927 -125927 16753 125927 125927 
38854 -38854 38854 1937 0 
-94347 -94347 94347 94347 71340 
-79441 79441 79441 79441 33264 
0 0 0 0 0 
93915 -93915 -20081 56998 0 
-33264 33264 33264 33264 33264 
36917 -36917 36917 0 0 
-71340 -71340 71340 71340 71340 

result:

ok 

Test #21:

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

input:

10
5 3 58531
5 8 2182
3 2 75030
7 4 72683
4 3 21009
4 1 98067
2 9 78011
2 10 37017
5 6 59811

output:

5
119076 -119076 119076 98067 0 
-75030 75030 75030 -75030 75030 
0 0 0 0 0 
21009 -21009 21009 0 0 
-58531 -58531 58531 -58531 58531 
-118342 -118342 118342 1280 58531 
93692 -93692 -51674 72683 0 
-60713 -60713 56349 -60713 60713 
-153041 153041 153041 2981 75030 
-112047 112047 38013 -112047 1120...

result:

ok 

Test #22:

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

input:

10
2 6 42660
5 6 45480
9 1 73208
3 4 48334
1 7 85607
4 8 26872
4 10 38398
6 4 56313
4 1 34234

output:

5
34234 34234 34234 34234 0 
-98973 -98973 -98973 98973 42660 
-48334 48334 48334 48334 0 
0 0 0 0 0 
-101793 -101793 -101793 10833 45480 
-56313 -56313 -56313 56313 0 
119841 119841 119841 119841 0 
26872 -26872 -26872 26872 0 
107442 107442 -38974 107442 0 
-38398 38398 -38398 38398 0 

result:

ok 

Test #23:

score: 0
Accepted
time: 1ms
memory: 5840kb

input:

14
1 8 99172
5 14 84394
3 14 7875
8 11 46747
11 12 91464
1 10 41274
4 3 51473
12 9 99888
13 14 48591
6 3 42998
12 7 9735
2 11 62362
12 3 24208

output:

5
237383 -237383 -54455 -143889 190636 
153826 -29102 153826 -29102 91464 
-24208 -24208 24208 24208 24208 
-75681 -75681 -27265 75681 75681 
-116477 -116477 116477 100727 116477 
-67206 18790 67206 67206 24208 
-9735 9735 -9735 -9735 9735 
138211 -138211 44717 -44717 91464 
99888 99888 -99888 99888...

result:

ok 

Test #24:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

20
12 17 9662
8 18 79403
9 12 39209
12 2 88815
12 4 65532
13 11 55258
15 17 57286
17 10 31472
2 19 39326
20 8 53686
17 5 16764
2 16 79545
12 13 50718
1 14 58728
2 6 50181
20 2 7766
14 11 12309
3 13 18809
14 7 953

output:

6
177013 177013 -177013 -152395 177013 121755 
-88815 -88815 -88815 -88815 88815 0 
69527 69527 -31909 -31909 69527 50718 
-65532 65532 65532 65532 65532 0 
26426 -26426 -7102 26426 7102 9662 
-138996 -138996 -38634 -38634 138996 0 
119238 119238 -119238 -92714 119238 63027 
-150267 -150267 -150267 ...

result:

ok 

Test #25:

score: 0
Accepted
time: 1ms
memory: 4076kb

input:

30
3 5 28796
4 9 10034
22 12 89509
21 8 23277
10 2 3196
4 29 59345
6 20 11469
10 13 51654
10 4 71995
7 12 28072
3 23 52059
7 26 50022
4 6 93782
10 25 13380
16 3 23595
7 9 36250
9 15 83594
11 2 1106
18 24 24090
28 3 42510
27 28 96564
10 8 34047
2 19 97541
10 17 75663
10 3 40752
30 1 16408
24 7 93194
...

output:

6
138970 138970 -138970 -138970 -138970 138970 
3196 -3196 -3196 3196 3196 3196 
40752 40752 -40752 -40752 -40752 40752 
-71995 -71995 71995 -71995 71995 71995 
69548 69548 -11956 -69548 -11956 69548 
-165777 21787 165777 -165777 -21787 165777 
-118279 -118279 25711 -118279 118279 118279 
34047 -340...

result:

ok 

Test #26:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

40
18 39 61594
12 17 36186
37 33 1532
10 6 91806
23 20 60906
19 9 15159
13 38 22702
22 3 60048
28 21 62359
22 25 6011
26 35 43190
34 31 4138
30 12 49058
25 6 89047
31 19 43124
13 4 49436
25 26 41836
25 5 16956
26 14 45706
21 36 68537
12 15 55029
33 27 52251
33 26 88024
34 21 78287
12 32 65664
12 25 ...

output:

7
141228 -141228 141228 -141228 48120 129206 141228 
158805 -158805 158805 -158805 -158805 146783 158805 
66059 -66059 66059 54037 54037 54037 66059 
-194785 -194785 -174695 -174695 -145637 194785 72138 
-16956 16956 16956 16956 16956 16956 0 
89047 -89047 -89047 89047 89047 89047 89047 
206817 -206...

result:

ok 

Test #27:

score: 0
Accepted
time: 1ms
memory: 6092kb

input:

54
16 26 45496
4 34 82464
15 6 98989
25 42 37516
48 10 11511
52 12 48230
47 34 75909
48 29 62311
53 6 31322
40 31 25243
42 37 43372
26 42 21924
16 5 49734
26 36 43349
47 9 73734
39 41 89591
14 44 22016
34 1 60743
42 49 26617
4 39 29014
34 7 61100
50 2 19720
34 2 64617
43 40 2358
4 8 39665
39 33 9226...

output:

7
-60743 -60743 -60743 60743 60743 60743 60743 
-64617 64617 64617 -64617 -64617 -64617 64617 
150819 150819 -150819 -150819 150819 150819 150819 
82464 -82464 -82464 -82464 -82464 82464 82464 
-232614 -232614 111128 232614 133146 79332 137384 
99407 99407 99407 -99407 99407 99407 99407 
-61100 6110...

result:

ok 

Test #28:

score: 0
Accepted
time: 1ms
memory: 4140kb

input:

67
54 2 27000
47 1 56096
16 62 95394
45 33 93374
14 31 20926
41 6 89398
54 24 54732
36 18 64923
58 22 72499
33 40 48515
4 65 42746
40 49 50954
33 4 30319
52 36 28368
65 5 14020
23 20 64887
48 27 91661
17 32 56902
26 3 48451
59 38 38248
17 40 27460
49 57 84654
51 60 42960
24 28 39849
52 58 8142
50 35...

output:

8
-33038 -33038 33038 -33038 -33038 -33038 -27600 30319 
164321 -164321 164321 -164321 -164321 27183 164321 0 
-131859 71221 131859 -131859 -5965 -5965 -5965 68912 
0 0 0 0 0 0 0 0 
56766 -56766 56766 -56766 -56766 -28726 56766 0 
28814 28814 28814 28814 28814 -28814 28814 0 
247168 -247168 247168 1...

result:

ok 

Test #29:

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

input:

73
52 70 80451
44 32 1449
6 14 82173
24 38 56605
49 4 83134
2 53 62244
70 16 68371
69 50 60868
39 67 42364
17 19 94331
60 11 94001
71 51 91350
56 21 12570
30 73 2299
23 58 71318
71 72 78176
73 4 917
4 33 70353
40 20 30654
1 36 24366
8 10 59530
58 25 14218
1 67 45255
36 12 68333
47 40 12406
61 11 837...

output:

8
130886 -83196 -40376 -130886 -130886 130886 130886 0 
40479 40479 -7211 -7211 -7211 32023 40479 0 
-213484 213484 -213484 213484 -118786 136338 213484 0 
-152575 -11869 152575 -152575 -152575 -152575 152575 121439 
-326748 -326748 -162304 -184286 -326748 -154034 326748 71962 
-47349 47349 -47349 4...

result:

ok 

Test #30:

score: 0
Accepted
time: 1ms
memory: 6440kb

input:

87
49 25 39368
24 2 71698
58 17 91578
30 86 33561
78 43 11951
15 8 34603
66 76 61167
83 8 22548
48 63 91658
8 51 13731
70 3 61233
9 29 72302
63 21 52219
53 72 43756
56 13 78626
13 65 23833
8 11 91619
8 84 84693
64 8 51042
85 6 7205
40 68 60611
42 16 39505
59 50 94034
17 9 31620
72 78 73852
61 52 429...

output:

8
139462 139462 139462 139462 -139462 -139462 139462 115841 
-328032 -118448 -328032 148102 -118448 -27508 328032 178745 
137285 137285 137285 -90043 -137285 -137285 137285 61233 
150673 -150673 87433 1011 12587 12587 62229 73733 
-109129 109129 -100455 109129 100455 109129 109129 0 
-203382 203382 ...

result:

ok 

Test #31:

score: 0
Accepted
time: 1ms
memory: 5672kb

input:

2
2 1 27833

output:

1
0 
27833 

result:

ok 

Test #32:

score: 0
Accepted
time: 1ms
memory: 4252kb

input:

81
7 79 7136
79 21 33814
76 73 11348
18 9 98679
19 21 80484
25 68 85491
67 3 73962
63 61 99432
42 5 25124
71 45 29653
59 20 15283
42 21 8926
59 38 74175
23 49 57772
22 8 58928
13 57 35851
26 19 60247
8 1 41995
36 45 4771
60 68 9248
56 4 19565
45 7 26690
34 63 89165
18 79 19662
7 47 2497
16 73 75362
...

output:

8
244191 -244191 160201 -113405 -134377 113405 244191 120300 
114271 114271 -114271 -114271 -99999 -43477 114271 50792 
-373360 373360 219740 -373360 -219732 -219732 287368 116958 
166854 -166854 127724 3062 -127724 36068 166854 65393 
-67864 -236 -67864 236 67864 67864 67864 0 
67109 67109 52837 -6...

result:

ok 

Test #33:

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

input:

100
66 20 64331
71 93 56075
94 37 24424
22 86 23870
43 97 27051
14 51 1989
87 75 50829
58 16 63588
100 73 26141
90 52 14995
35 49 5213
86 12 47936
25 5 6213
26 87 51404
73 9 40063
37 72 57353
59 8 79465
7 4 11042
89 33 19830
100 51 63700
44 63 36365
25 63 78125
83 20 27081
73 40 90964
54 26 96279
3 ...

output:

8
-192299 192299 -41113 -15811 -41113 -41113 135375 28462 
135756 135756 -129438 129438 129438 -129438 48704 135756 
-115357 -115357 115357 115357 63075 -115357 115357 26141 
-235707 235707 -235707 -59219 -161267 -235707 178783 65682 
87497 -81179 87497 -87497 -87497 87497 87497 87497 
99521 99521 9...

result:

ok 

Test #34:

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

input:

100
56 22 62377
58 55 65266
65 51 8075
82 30 63128
41 65 98262
63 75 73348
26 78 78308
69 73 83265
32 35 51859
75 66 18818
82 23 90696
42 79 31835
38 87 46601
74 40 62693
65 64 78114
56 75 89854
39 11 40514
40 9 81703
9 92 22171
72 73 22340
56 98 67781
62 85 42175
24 83 27835
5 42 51782
38 27 54236
...

output:

9
-286427 25703 286427 -25703 -189087 -103875 123043 124310 0 
230912 230912 -230912 -51004 -216970 115526 -51004 230912 0 
-253831 -6893 253831 6893 -156491 -51235 90447 81692 0 
76625 -76625 76625 76625 -76625 76625 76625 76625 0 
6971 6971 -6971 -6971 6971 -6971 -6971 6971 0 
257738 -257738 -1044...

result:

ok 

Test #35:

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

input:

100
37 33 60423
81 66 7160
16 11 67535
1 39 78194
31 45 4065
20 66 44706
82 75 5786
32 97 78750
79 37 77577
69 1 88048
66 28 33075
13 94 72629
41 92 54285
17 1 73982
78 54 16165
10 88 22354
15 18 44666
12 84 11147
35 64 319
68 28 80980
28 57 31900
49 55 30418
15 30 38989
20 31 45304
13 99 12193
57 7...

output:

8
183019 183019 62547 113549 62547 -44269 105041 183019 
134221 134221 13749 -13749 -64751 83029 56243 94971 
248568 -248568 248568 -248568 248568 182418 28240 110164 
-481596 481596 -481596 481596 200926 194146 347014 277754 
173633 -173633 173633 -122175 173633 88355 43683 90704 
-367587 367587 -2...

result:

ok 

Test #36:

score: 0
Accepted
time: 1ms
memory: 6100kb

input:

100
62 53 23877
7 67 40543
67 71 83890
13 34 25964
67 2 75276
57 9 50657
63 37 33265
50 57 74236
4 62 70592
27 62 24574
67 54 10045
100 67 56527
74 67 94674
72 57 52568
87 62 86921
97 62 54855
1 67 48819
32 67 73295
67 5 78468
57 20 39621
54 55 96020
25 16 61764
85 52 15551
70 67 6122
57 63 2854
28 ...

output:

8
124095 -124095 -26457 124095 -26457 -26457 -26457 124095 
0 0 0 0 0 0 0 0 
174578 -174578 -174578 -24026 -174578 -174578 -174578 174578 
153278 153278 12094 -12094 54286 153278 -12094 153278 
153744 -153744 -153744 153744 3192 3192 3192 153744 
102722 102722 102722 -102722 3730 102722 -62650 10272...

result:

ok 

Test #37:

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

input:

100
96 51 21924
11 98 49734
19 100 43349
96 29 73734
26 37 89591
91 84 22016
47 68 60743
75 10 26617
93 14 29014
89 60 61100
15 50 19720
78 85 64617
19 33 2358
53 22 39665
17 55 92268
92 86 63163
16 3 9867
83 51 2739
97 34 80808
63 64 98261
90 53 84331
50 26 50006
94 64 83601
3 90 23836
47 20 60811
...

output:

8
99186 54238 99186 -99186 -99186 99186 99186 22474 
-79700 -79700 79700 79700 -79700 79700 79700 79700 
-32399 32399 -32399 32399 -16461 32399 -16461 24430 
-79794 -63856 63856 79794 79794 79794 79794 0 
90721 -90721 -90721 90721 71721 -71721 51281 81221 
-7969 7969 -7969 7969 7969 7969 7969 0 
267...

result:

ok 

Test #38:

score: 0
Accepted
time: 1ms
memory: 4632kb

input:

100
29 77 44162
71 20 58925
60 11 27000
59 97 56096
48 31 95394
13 99 93374
16 62 20926
53 32 89398
3 85 54732
71 30 64923
9 80 72499
98 95 48515
73 54 42746
53 9 50954
61 2 30319
26 100 28368
77 56 14020
77 41 64887
13 33 91661
34 70 56902
99 91 48451
57 27 38248
61 81 27460
61 22 84654
23 60 42960...

output:

8
-171778 171778 -171778 -171778 -171778 -114150 114150 126860 
-32707 27931 32707 32707 -31827 31827 32707 30319 
-54732 54732 -54732 54732 -54732 -54732 54732 0 
270669 -270669 72867 72867 72967 -270669 270669 270669 
324342 -324342 -324342 126540 324342 126540 186308 259419 
-76799 76799 -76799 7...

result:

ok 

Test #39:

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

input:

100
52 70 74912
79 46 68115
62 97 19163
63 42 28058
56 42 66605
9 57 64733
52 13 48405
21 68 84883
45 37 80451
7 47 1449
13 71 82173
41 3 56605
12 61 83134
18 25 62244
85 33 68371
36 57 60868
1 6 42364
39 29 94331
13 10 94001
9 7 91350
69 13 12570
83 7 2299
40 34 71318
41 85 78176
94 25 917
86 73 70...

output:

9
-114438 -114438 -114438 114438 29710 114438 114438 72074 0 
347219 -347219 29165 347219 -38929 144711 250409 216625 65297 
-138944 25734 25734 -138944 -138944 -138944 138944 138944 0 
225750 225750 -56644 -105376 -225750 -37748 225750 131749 0 
101296 -101296 -4486 101296 101296 4486 4486 -4486 52...

result:

ok 

Test #40:

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

input:

100
62 55 72959
99 13 34202
93 51 35518
83 85 75828
21 46 72408
29 93 3388
74 96 75883
81 70 13073
44 73 6169
83 23 70679
74 39 59144
78 11 40503
60 79 90818
86 44 40829
32 84 6422
40 75 93369
15 59 79221
31 74 99583
59 7 72150
5 93 49991
12 7 43986
67 79 90541
86 58 39368
18 78 71698
44 17 91578
38...

output:

9
-50691 50691 50691 -50691 -50691 -43915 50691 50691 0 
302845 -302845 302845 -302845 149811 -152421 -27301 270593 0 
-373943 -373943 -373943 -61199 210483 122039 102261 135841 0 
-141193 82171 -141193 -141193 82171 82171 141193 72150 0 
-49991 49991 -49991 49991 49991 49991 49991 0 0 
296985 -2969...

result:

ok 

Test #41:

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

input:

100
19 45 3709
39 70 43393
54 24 94977
49 71 90894
89 24 10915
73 76 42043
43 38 27554
32 78 46
25 73 99183
15 68 7205
33 63 77331
39 16 14001
30 51 31206
69 13 27927
26 96 1369
85 73 25869
73 53 83374
48 10 94435
46 65 74490
48 26 8631
40 20 40810
15 39 46079
36 51 15930
13 75 32516
13 4 49535
33 1...

output:

9
-73432 2236 -2236 -73432 -73432 73432 73432 0 0 
196859 196859 196859 -59545 59545 109679 87849 196859 0 
146569 -146569 35677 35677 -146569 146569 146569 146569 0 
250448 -250448 250448 151378 -250448 -5790 120548 250448 0 
155341 155341 -18027 155341 6907 155341 144221 155341 0 
213032 -213032 9...

result:

ok 

Test #42:

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

input:

100
14 9 45032
64 30 88516
29 61 62092
83 11 60471
97 84 32298
87 57 90134
81 26 5662
1 99 33404
15 34 83812
35 7 98313
36 32 92767
41 40 73666
72 49 45942
89 47 56014
15 54 93649
22 21 72090
8 88 7136
49 73 33814
83 90 11348
31 99 98679
9 1 80484
88 81 85491
9 37 73962
13 95 99432
93 40 25124
55 4 ...

output:

9
-213958 -213958 213958 -213958 -27870 -27870 213958 55026 0 
173355 -42527 173355 -173355 173355 -173355 173355 36639 0 
-74696 -11304 -74696 74696 -74696 -74696 74696 74696 0 
-358817 358817 -358817 5727 148093 128407 -161291 191799 83509 
206933 62753 -62753 -206933 -62753 -206933 206933 77071 0...

result:

ok 

Test #43:

score: 0
Accepted
time: 13ms
memory: 11364kb

input:

694
147 589 63460
577 525 24867
168 48 46802
320 49 56053
387 45 50030
394 179 31066
25 137 52761
146 176 47924
156 69 97243
126 78 43246
299 286 98398
63 159 97810
313 340 80398
285 66 74961
471 290 91679
321 672 65088
346 145 22183
63 516 56245
262 479 75583
301 104 92046
678 270 62662
354 287 268...

output:

11
-404303 -404303 -348593 -272015 -404303 216305 116195 -348593 -404303 200575 265712 
-410130 277842 -410130 410130 277842 -227136 -227136 94848 -218598 351536 115813 
97336 -97336 97336 -78588 -97336 -97336 97336 97336 78588 97336 0 
-248391 116103 -248391 -116103 19963 19963 -248391 -152251 -248...

result:

ok 

Test #44:

score: 0
Accepted
time: 3ms
memory: 7292kb

input:

243
112 85 29656
158 90 90481
7 224 74519
234 203 84992
211 163 40562
23 207 2621
32 206 45866
139 137 88564
167 73 28471
233 118 33350
176 54 36866
232 227 54696
212 30 88043
208 192 47939
85 22 4388
203 189 54130
177 71 11667
93 6 57606
102 201 17140
149 28 62053
216 20 48661
145 158 32199
208 140...

output:

10
-174597 174597 174597 -47897 -174597 81667 -174597 47897 141139 16729 
-404785 -275221 404785 80561 275221 54063 -268387 252373 404785 0 
-297623 -168059 297623 -26601 168059 161225 -161225 162999 297623 0 
-210579 -81015 210579 -113645 -15919 113645 -113645 210579 210579 0 
377723 -377723 377723...

result:

ok 

Test #45:

score: 0
Accepted
time: 3ms
memory: 7552kb

input:

229
166 193 54447
108 132 97263
156 17 38984
110 43 31667
23 184 79564
108 111 67697
13 31 98378
86 74 74184
178 75 95633
213 19 77916
41 73 4856
216 76 87443
56 108 43031
187 107 39032
150 174 99980
168 195 47899
74 136 46680
82 196 32622
29 14 42559
27 158 93866
49 229 85484
99 61 27912
3 25 81994...

output:

10
262551 -262551 -262551 -217499 196875 -40823 66705 66705 262551 0 
267058 -267058 -267058 -222006 163020 -181940 71212 71212 267058 0 
-243226 -243226 -243226 -243226 -243226 -154292 -243226 17374 112926 0 
-238661 -91693 238661 238661 -238661 238661 -238661 20221 238661 73484 
286678 -286678 -28...

result:

ok 

Test #46:

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

input:

135
18 110 50257
93 82 38644
88 87 83809
119 60 33528
28 100 98246
16 3 4218
22 10 82711
124 21 9452
48 128 9313
67 4 53331
64 79 47618
37 75 70473
32 113 21071
52 107 89692
3 60 71663
115 123 59213
49 61 47261
57 19 30547
46 50 32041
23 86 63669
131 32 61464
67 116 1076
57 61 14112
44 121 11326
16 ...

output:

9
-356880 -238454 356880 356880 356880 356880 -34004 356880 0 
161136 -161136 -34196 34196 161136 -161136 161136 161136 0 
137812 137812 137812 72570 5514 -137812 137812 137812 0 
-176695 70033 176695 -58269 176695 48393 58269 176695 0 
450060 -450060 -450060 450060 -82454 -22868 290666 450060 0 
-1...

result:

ok 

Test #47:

score: 0
Accepted
time: 12ms
memory: 12116kb

input:

683
235 104 98616
92 434 23280
474 273 65503
23 560 76232
399 625 51375
95 541 97791
294 464 23918
1 522 35198
90 4 40934
299 644 78673
470 391 33958
630 101 40872
50 323 70111
296 52 95959
3 523 50951
428 463 84150
257 401 65337
551 601 25697
512 668 12532
327 378 62008
386 449 57976
451 411 21345
...

output:

11
390784 390784 191160 191160 327554 142396 -152216 -257158 -54574 232248 147465 
-306111 -306111 -306111 284613 19451 237035 499 -150125 -284613 306111 142556 
-224481 -224481 -224481 101081 202983 53503 -63855 -155405 -101081 224481 69564 
-221850 200352 200352 -221850 -221850 221850 -58494 -7999...

result:

ok 

Test #48:

score: 0
Accepted
time: 12ms
memory: 11308kb

input:

668
60 628 90967
90 181 51755
225 381 51207
351 335 15056
315 299 97634
533 364 80940
27 328 8478
580 222 66561
131 514 68998
408 530 33026
481 46 19385
108 186 21688
16 262 36552
118 532 99424
135 553 10812
368 488 56555
232 515 96909
169 572 86653
653 365 17004
309 571 84879
558 552 3546
374 349 1...

output:

11
-301762 301762 237372 237372 -301762 -237372 -117362 128424 301762 -9972 234702 
148630 148630 -148630 148630 148630 83954 148630 -148630 83954 -83954 148630 
-229840 229840 142078 -229840 165450 229840 -68666 -8642 109684 142078 229840 
231733 231733 -231733 231733 -167057 167057 -167057 -6249 -...

result:

ok 

Test #49:

score: 0
Accepted
time: 9ms
memory: 12540kb

input:

654
253 300 46023
74 450 58055
70 278 34456
466 79 61503
260 552 86524
280 333 15911
392 584 27739
542 112 4504
34 615 67012
621 618 7667
371 82 49159
512 124 7194
233 431 83098
235 541 13140
195 151 71573
191 45 57933
487 20 32085
386 60 61203
423 650 25500
17 252 54298
450 478 15503
30 258 43193
4...

output:

11
-318618 -128234 -318618 318618 -318618 -36470 -22486 -109364 174900 260084 29267 
-298359 298359 -298359 298359 107975 -107975 -69635 -82207 133129 259817 126872 
107242 -107242 -71438 -107242 -71438 107242 91068 71438 -91068 107242 17902 
-229640 -39256 6026 -6026 -229640 229640 -196410 -229640 ...

result:

ok 

Test #50:

score: 0
Accepted
time: 9ms
memory: 10544kb

input:

560
53 332 14502
304 546 51673
536 85 76888
466 391 18058
82 469 83789
209 219 81545
30 430 16897
153 372 31499
93 62 26371
37 97 38332
30 187 22007
288 58 92087
298 34 41813
278 344 64464
82 150 3559
334 547 87083
390 453 91183
271 182 59777
32 323 50174
506 509 43522
176 504 23582
528 62 95406
483...

output:

11
-379652 127698 -379652 -191618 -257864 69830 -191618 -68634 102920 379652 140551 
-217964 -33990 -217964 -29930 28734 -216768 -29930 217964 217964 217964 94017 
219473 -219473 219473 219473 184657 -219473 -219473 -119309 -8703 219473 0 
-233977 -17977 -233977 -45943 45943 -233977 -45943 75845 758...

result:

ok 

Test #51:

score: 0
Accepted
time: 9ms
memory: 10484kb

input:

546
206 298 75420
519 234 34209
303 439 91769
541 437 77447
220 441 66144
252 267 66928
427 429 59902
353 199 86893
74 145 4005
227 56 73170
543 33 54988
119 291 920
407 414 13805
516 124 55738
64 228 28358
415 166 96952
43 254 54136
445 132 94198
383 185 5931
197 462 65982
210 191 17224
122 352 918...

output:

11
-367217 -367217 177261 307821 -177261 -216123 -38699 367217 95139 367217 0 
-276527 86571 -276527 -86571 104135 -85821 -276527 -86571 -104135 190331 0 
392753 392753 282403 -392753 -282403 -183017 -293367 183017 -77661 229785 163356 
-81132 81132 81132 -81132 81132 81132 81132 -81132 81132 81132 ...

result:

ok 

Test #52:

score: 0
Accepted
time: 15ms
memory: 13096kb

input:

763
384 629 2722
249 734 76525
750 364 69562
269 516 98782
582 366 79581
16 142 27573
263 43 13588
59 194 11024
212 64 73238
537 484 8035
252 459 98546
731 106 23446
416 552 2794
381 658 4901
213 544 64530
336 286 56704
395 169 27669
618 231 47977
693 211 69456
246 65 32408
338 109 76053
180 216 929...

output:

12
257551 -257551 -101387 -257551 -64377 -257551 -81673 257551 -190671 247437 78082 0 
-243493 -243493 -107319 34529 -243493 -102705 -39321 -175495 121343 -121343 182418 0 
-159712 -159712 91714 23538 -44460 -91714 159712 -91714 159712 -44460 159712 0 
-286466 -286466 218468 150292 -286466 -3696 112...

result:

ok 

Test #53:

score: 0
Accepted
time: 19ms
memory: 14532kb

input:

1000
572 527 49791
32 218 21645
179 931 16785
754 301 86556
672 38 96080
467 218 14665
428 774 53050
137 701 5302
388 302 17617
730 111 39815
846 797 27547
804 631 51043
606 548 72483
772 42 87127
767 396 14101
584 651 67827
391 898 45509
529 757 87851
822 6 24457
503 796 74359
529 835 61147
507 782...

output:

12
531787 -531787 -289547 148139 -362691 62823 -45779 223919 -225889 -39991 531787 157122 
776926 776926 -776926 -258982 499290 256378 -499290 100420 399024 287790 261562 216032 
702757 702757 184813 702757 509891 -535857 -453613 -8471 239627 481807 -97279 493119 
-448419 448419 -94303 82445 -419379...

result:

ok 

Test #54:

score: 0
Accepted
time: 18ms
memory: 14484kb

input:

1000
481 332 23354
796 115 6792
367 308 46007
157 330 34563
717 189 44526
4 187 88056
862 216 76013
111 814 3711
457 772 76852
376 259 47169
786 571 72024
963 715 53630
753 74 80513
267 378 66504
901 493 41644
308 869 67462
749 281 26985
898 505 83442
560 988 84702
40 784 5179
81 874 57506
599 855 3...

output:

12
349256 -349256 -223850 349256 -193232 116588 150726 -181514 -146678 -68066 349256 173445 
473570 473570 -473570 -202690 297658 -209798 -384658 385710 17102 473570 265742 234993 
-925095 925095 -925095 144869 -15487 34891 196077 282107 148229 503530 356442 0 
591966 -591966 429680 591966 -341604 3...

result:

ok 

Test #55:

score: 0
Accepted
time: 17ms
memory: 14616kb

input:

1000
145 580 53814
865 339 48835
274 748 18333
25 232 15274
556 862 92973
685 265 28743
117 479 23168
758 677 2119
467 479 3383
474 461 21820
19 846 92308
41 704 56217
901 897 45439
833 490 78586
379 630 93378
853 941 34393
553 624 43053
479 843 79034
141 847 69138
246 290 92896
94 365 62378
37 843 ...

output:

13
355270 355270 108432 -108432 -355270 -108432 -323576 -323576 355270 -87268 -46018 324063 0 
815185 815185 -383177 383177 -444313 383177 -374897 -241967 387199 86383 329764 324063 0 
670036 670036 73330 238028 -485394 53386 -93578 -404936 400626 3988 175764 479742 0 
-162961 821 -821 -821 162961 1...

result:

ok 

Test #56:

score: 0
Accepted
time: 22ms
memory: 14704kb

input:

1000
526 58 51569
793 638 58173
402 205 47555
92 813 95985
977 807 8715
230 417 69430
983 72 46131
214 629 528
428 709 29914
752 765 29174
739 312 36785
58 56 26101
762 987 53469
141 447 57963
786 328 12408
624 985 58221
765 438 24528
560 444 74625
89 607 29383
922 450 91013
558 791 67249
482 582 63...

output:

13
-771405 49013 -771405 -354451 -136465 111205 -348325 354451 183673 189931 510226 28444 0 
833873 833873 -833873 626845 -402001 -343689 -155715 -307449 21977 120943 521731 245092 0 
645196 -645196 121474 645196 -360824 32586 85932 -394202 119878 -350842 -50656 512277 117390 
942488 -942488 418766 ...

result:

ok 

Test #57:

score: 0
Accepted
time: 18ms
memory: 14416kb

input:

1000
310 311 49325
143 789 43320
622 205 76776
194 634 43992
790 203 81353
354 477 42821
752 888 25990
50 384 23128
116 918 80637
466 627 3825
203 96 13966
748 419 52880
443 11 85691
284 649 37340
355 165 7247
567 615 92448
376 216 73300
547 4 13321
898 19 46523
941 134 21833
327 119 72120
917 419 7...

output:

12
-237599 -31423 31423 -237599 237599 -203233 -136163 181859 136155 70021 83789 0 
-206852 -676 676 -206852 166902 -132536 -105416 111162 206852 39274 83789 0 
723847 -723847 723847 -282389 -723847 606047 -633035 328937 431475 41637 -5887 569750 
571798 -571798 571798 -130340 -571798 453998 -480986...

result:

ok 

Test #58:

score: 0
Accepted
time: 18ms
memory: 14608kb

input:

1000
940 310 47081
77 619 52659
444 641 49102
410 343 24703
211 70 29799
632 42 16212
327 108 16249
878 69 88833
122 981 39872
581 204 35371
687 399 34250
860 194 55467
878 574 93722
114 388 49422
78 221 91685
380 457 92083
133 941 78968
5 182 8913
984 572 74064
164 8 76846
638 941 76992
905 46 9540...

output:

13
528831 528831 -394843 -528831 -135997 -528831 99229 -230175 -332299 238811 416463 115657 173090 
-391547 -4489 -391547 165097 -96053 102877 -181179 26321 -41365 106053 315117 63832 0 
-144301 -54225 -54225 144301 89835 -27761 -144301 -27761 -133751 116781 89548 13760 0 
-524642 128606 -524642 524...

result:

ok 

Test #59:

score: 0
Accepted
time: 15ms
memory: 14528kb

input:

1000
108 997 44836
619 32 37806
927 40 78324
385 920 72711
439 640 45541
312 295 32707
81 664 63404
232 726 54538
852 892 66403
538 728 77318
779 372 46023
287 126 58055
103 8 34456
961 927 61503
887 327 86524
491 412 15911
310 116 27739
295 473 4504
770 711 67012
264 553 7667
833 443 49159
452 989 ...

output:

12
-242962 -214130 242962 -242962 81494 242962 -90044 61212 98634 242962 96029 0 
254858 -254858 -153522 123124 -123124 -153522 254858 -224460 18016 153522 235647 115792 
219577 219577 219577 38985 121275 59317 48895 -131697 -219577 131697 124070 32755 
442062 442062 -431640 442062 -442062 -139112 3...

result:

ok 

Test #60:

score: 0
Accepted
time: 20ms
memory: 14472kb

input:

1000
597 155 18400
957 263 79848
925 963 74842
909 282 20718
635 942 85475
486 717 73394
218 625 86367
922 614 52946
789 154 17126
988 664 84672
290 658 90499
910 126 60642
526 94 66678
44 168 40881
51 912 38258
657 27 82842
414 792 76511
247 799 96
361 15 51449
154 708 5784
193 736 78223
72 293 516...

output:

12
378598 378598 -221648 147952 -8998 61792 127354 284344 -129450 -110394 68130 184800 
-483762 -3874 483762 -483762 -147894 3874 28936 -3874 331994 483762 0 0 
-404518 199412 404518 -75370 -404518 -280476 38990 75370 231974 404518 0 0 
-681600 681600 38772 -441116 -38772 161952 217986 294094 -15211...

result:

ok 

Test #61:

score: 0
Accepted
time: 23ms
memory: 14548kb

input:

1000
913 774 48859
357 308 89187
690 238 36768
481 612 1429
608 576 33921
596 376 46785
587 610 33522
880 450 75547
106 851 43657
632 552 59323
474 22 34976
566 967 63229
318 306 74708
196 648 52962
75 420 89992
587 701 82478
442 622 25283
80 369 95688
726 176 11693
557 761 93500
568 259 50390
851 6...

output:

12
687703 687703 -537529 -687703 -14495 -73535 290411 -136415 537529 -137445 436265 92252 
-541669 541669 225579 27893 225579 -160511 233981 26425 218203 94161 408389 0 
-75768 75768 75768 75768 75768 -75768 75768 75768 75768 75768 75768 0 
520562 520562 145032 -520562 348928 217632 265528 128880 26...

result:

ok 

Test #62:

score: 0
Accepted
time: 17ms
memory: 14420kb

input:

1000
464 300 12241
235 153 95587
674 581 76496
816 482 85201
257 852 75969
172 296 2281
541 492 92534
693 873 27794
788 311 89426
324 594 99692
340 2 94989
739 35 17608
781 197 5041
240 520 54475
762 786 8224
653 125 34640
395 104 74795
701 155 39491
548 156 55004
15 622 22118
759 672 50861
284 689 ...

output:

12
825188 -825188 -481142 481142 -825188 657046 -6422 -88954 -70362 825188 495170 84399 
414700 414700 343348 414700 -223202 56456 -66800 -247684 31736 -105286 302894 285428 
-486241 -24387 -486241 -486241 -138333 198635 245473 148291 -240413 83755 169481 111849 
389688 142360 389688 -389688 142360 ...

result:

ok 

Extra Test:

score: 0
Extra Test Passed