QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877725#3508. SprinklerDe3b0o#38 177ms41080kbC++209.3kb2025-02-01 01:48:162025-02-01 01:48:16

Judging History

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

  • [2025-02-01 01:48:16]
  • 评测
  • 测评结果:38
  • 用时:177ms
  • 内存:41080kb
  • [2025-02-01 01:48:16]
  • 提交

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define mid ((l+r)/2)
#define lc (2*x)
#define rc (2*x+1)

using namespace std;
using namespace __gnu_pbds;

/*

⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⣴⠟⠋⢠⣴⣾⣿⡟⠋⠉⡳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠑⠒⠦⢤⣄⡀⠀⣴⡟⠋⡀⢠⣬⣿⣿⡿⠳⣄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣴⣫⡾⠋⠀⣶⣿⢿⣿⣥⠄⠠⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⣌⣩⣿⡯⠁⣬⣭⣽⣿⣿⡟⠁⠈⠉⠝⢦⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡼⣽⣟⡀⣠⣼⣿⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠃⠀⢠⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠱⣄
⠀⠀⠀⠀⠀⠀⠸⠃⠻⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣿⣧⣀⣼⠘⣿⠿⣸⠏⠀⣄⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠀⠀⠀⠀⠇⠀⠀⠘⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣏⠀⠀⠈⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠋⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⡝⠳⠀⢰⢱⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⠀⠀⠀⠀⠀⢠⣾⣇⠀⢸⠀⠀⠀⠀⠀⠀⠀⢱⢹⣷⠀⠀⠀⠀⠀⠰⡆⠉⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣷⡄⠀⠀⡏⡇⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢠⠞⠀⢀⡔⠀⠀⠀⠀⠀⢀⣿⡿⢹⠀⢸⠀⠀⠀⠀⠀⡀⠀⠘⣿⡿⣷⠀⠀⠀⠀⠀⠹⡀⠀⢳⡀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⡄⠀⢿⣻⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡴⢣⡞⠀⠀⠀⠀⠀⢀⣾⡿⠁⢸⡇⢸⡇⠀⠀⠀⠀⣇⠀⠀⣿⠁⠙⣧⠀⠀⠀⠀⠀⢳⡀⠈⣇⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣆⢸⣟⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⣼⡿⣁⣘⣀⢧⠈⣿⠀⠀⠀⠀⠸⡄⠀⣸⣀⣀⣹⣷⡀⠀⠀⠀⠀⢧⠀⢸⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⡿⣿⣿⢀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⠀⠀⠀⠀⣰⡿⠋⡽⠉⠉⠘⡆⣿⣧⠀⠀⠀⠀⢧⠀⣿⣿⠉⠉⠙⣯⡑⠒⠀⠀⠘⣧⠘⡇⠀⠀⠀⠀⠀⢿⠐⠂⣩⠏⠀⣿⢿⡜⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢸⠃⠀⠀⠀⠀⠀⢰⣿⠃⣴⠁⠀⠀⠀⢻⣼⠹⡆⠀⠀⠀⢸⡇⣿⡟⠀⠀⠀⠈⢿⣄⠀⠀⠀⠙⡆⣷⠀⠀⠀⠀⠀⢸⣄⣠⣏⠀⢠⣿⡎⢧⣂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⣾⠏⢠⣀⣀⣀⡠⠄⠀⢿⣧⠹⡄⠀⠀⠀⣿⣿⣣⠀⠳⣄⠀⠀⠹⣧⡀⠀⠀⢻⢻⠀⠀⠀⠀⠀⠀⣿⣷⣾⣷⡾⣿⡇⠸⣿⠀⠀⠀
⠀⠀⠀⠀⠀⢰⡇⠀⠀⠀⠀⠀⣸⣿⢀⣶⡿⠟⢛⣿⣷⣄⠈⣿⣆⠹⡄⠀⠀⢸⡇⣿⣀⣴⣾⠿⢿⣷⣮⣍⡀⠀⠀⣾⠀⡀⠀⠀⠀⠀⣿⡟⢻⠋⣻⣿⡇⠀⢿⡄⠀⠀
⠀⠀⠀⠀⡀⡜⠀⠀⠀⠀⠀⠀⣿⣿⡿⠋⠀⠐⢻⣿⣿⣿⡀⠈⣿⣦⡙⣄⠀⠸⡇⢸⠛⠛⠀⠀⠠⣾⣿⣿⣿⣦⡀⢸⠀⡇⠀⠀⠀⠀⣿⣶⣾⣿⣿⣿⠃⠀⢸⡇⠀⠀
⠀⠀⠀⠀⡆⠀⠀⠀⠀⠀⠀⢠⣿⡼⠃⠀⠀⣶⣾⣿⣿⣿⡇⠀⠈⢷⡙⢮⣀⠀⣿⠈⠄⠀⠀⢠⣤⣿⣿⣿⣿⣿⣿⣾⢲⡇⠀⠀⠀⠀⡿⣿⣿⣿⣿⡟⠀⠀⢸⣷⠀⠀
⠀⠀⠀⣤⡇⢰⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀⠀⢻⡿⣿⣷⢿⠇⠀⠀⠀⠳⡄⠈⠳⢼⡀⠀⠀⠀⢸⣿⣿⣿⣿⣿⡟⢸⡏⣼⠁⠀⠀⢀⡶⣷⣿⣿⣿⣿⠃⠀⠀⠀⣿⠀⠀
⠀⠀⢰⣻⠀⢸⡇⠀⠀⠀⠀⣼⣿⣿⡄⠀⠀⠘⢧⣀⣰⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡇⠀⠤⠀⣹⠁⢠⣣⠇⠀⠀⠀⢸⡇⣿⣿⣿⣿⣿⠀⠀⠀⠀⣿⠀⠀
⠀⠀⡄⠀⠀⢸⣇⠀⢀⠀⠀⣷⣿⡿⢿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠒⠒⠚⠃⠀⣸⡿⠀⠀⠀⠀⢸⡇⣿⣿⣿⣿⣿⠀⠀⠀⠀⣿⠀⠀
⠀⢰⠁⠀⠀⠀⣿⡄⠘⢦⠀⣿⡫⠐⣺⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠀⠀⠀⠀⠀⢸⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠘⠀⠀
⠀⢸⠀⠀⠀⣷⣹⣷⠀⠈⡾⠋⠀⠀⣿⣳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⢹⡇⣼⠀⠀⠀⠀⣼⣿⡟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠈⠁⠀⠀⠀⢷⡻⢧⡞⠁⠉⠉⠭⣅⣈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⣼⣸⠃⠀⠀⠀⢀⣿⡏⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠁⠀⣿⣄⠀⠀⠀⠀⠈⠙⠳⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣷⡇⠀⠀⠀⡀⢸⡿⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡄⠀⠀⠀⠀⠀⠀⠀⠀⡟⢸⡷⣄⠀⠀⠀⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⣾⠙⣿⠁⠀⠀⢠⡇⣾⣷⣼⠥⠤⠤⣤⣄⣀⡀⠀⠀⠀⠀⠀
⡀⠀⠀⠀⠀⠀⠀⠀⢠⡇⣿⡇⣿⣳⣄⠀⠀⠀⠀⠀⠀⠈⠑⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠒⠋⣀⡾⠃⢠⡏⠀⠀⢠⣿⣿⣯⣿⡏⢀⡔⠋⠁⠀⠈⠉⠲⡄⠀⠀⠀
⡇⠀⠀⠀⠀⠀⠀⠀⢸⡇⣿⣷⢸⣿⣿⡷⢤⠀⠀⠀⠀⠀⠀⠈⢻⣓⢦⣀⣀⣤⠶⠚⠉⠀⢀⡠⠞⠁⠀⢀⡾⠀⠀⢀⣾⣯⢿⣿⠋⠰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡃⠀⠀⠀⠀⠀⠀⠀⢸⡇⢸⣹⣯⣿⠃⢧⠀⡷⡄⠀⠀⠀⠀⠀⠀⢡⡿⠛⢙⣿⣦⣠⠴⠚⠉⠀⠀⢀⣠⡿⠁⠀⣠⣾⣯⡽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⢸⡇⠈⠻⡆⠀⡾⠁⠀⠀⠀⠀⠀⠀⢀⣾⣧⠴⢺⣿⡉⠀⠀⠀⠀⢀⣤⢾⡟⠁⢀⣴⠟⠉⠁⢸⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⡇⡼⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⣼⠋⠀⠀⠀⡝⢷⠀⢀⡤⠖⠋⣀⣮⠴⠚⠋⠁⠀⠀⢠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠁⠀⠀⢠⠞⠀⠀⠀⠀⠀⠀⠀⠀⣼⡇⠀⠀⢀⣼⣧⠈⡗⣿⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⠀⡾⠁⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⣠⣶⠃⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⠀⠀⢠⣾⠉⢸⢷⣼⣿⡇⠀⠀⠀⢀⡠⠊⠀⠀⠀⡼⠁⢰⠟⢹⡗⢶⣶⡶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡼⠀⣰⣿⢿⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⡇⠀⣰⠟⢹⠀⠀⠈⡽⠛⢷⡀⠀⠀⠁⠀⠀⠀⠀⣸⠁⢠⣾⠀⣼⠃⢠⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⣧⣾⣏⢹⣿⠀⠀⠀⠀⠀⠀⠀⡸⠋⢰⡁⢰⠏⣰⣿⠀⠀⣼⣧⡴⠛⣿⠀⠀⠀⠀⠀⢀⡼⠃⠀⠘⢿⣿⣃⣀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

*/

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll N = 2e5+9;

ll n , l , q;
vector<ll> adj[N];
ll h[N] , t[2*N] , p[N];
ll ti[N] , to[N];
ll c;
ll seg[4*N] , lazy[4*N];
ll e[N][3];
ll ee[N];

void dfs(ll x , ll pr)
{
    p[x]=pr;
    t[++c]=x;
    ti[x]=c;
    for(auto it : adj[x])
    {
        if(it==pr)
            continue;
        dfs(it,x);
    }
    t[++c]=x;
    to[x]=c;
}

void ps(ll x)
{
    lazy[lc]*=lazy[x];
    lazy[lc]%=l;
    lazy[rc]*=lazy[x];
    lazy[rc]%=l;
    lazy[x]=1;
}

void sb(ll x , ll l , ll r)
{
    lazy[x]=1;
    if(l==r)
    {
        if(to[t[l]]==l)
            seg[x]=0;
        else
            seg[x]=h[t[l]]%l;
        return;
    }
    sb(lc,l,mid);
    sb(rc,mid+1,r);
}

void se(ll x , ll l , ll r , ll l1 , ll r1 , ll val)
{
    seg[x]*=lazy[x];
    seg[x]%=l;
    if(l!=r)
        ps(x);
    if(l>r1||r<l1)
        return;
    if(l>=l1&&r<=r1)
    {
        seg[x]*=val;
        seg[x]%=l;
        lazy[x]=val;
        if(l!=r)
            ps(x);
        return;
    }
    se(lc,l,mid,l1,r1,val);
    se(rc,mid+1,r,l1,r1,val);
}

ll sg(ll x , ll l , ll r , ll idx)
{
    seg[x]*=lazy[x];
    seg[x]%=l;
    if(l!=r)
        ps(x);
    if(l>idx||r<idx)
        return 0;
    if(l==r)
        return seg[x];
    return sg(lc,l,mid,idx)+sg(rc,mid+1,r,idx);
}

int main()
{
    d3
    cin >> n >> l;
    for(int i = 0 ; n-1>i ; i++)
    {
        ll u , v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    for(int i = 1 ; n>=i ; i++)
        cin >> h[i];
    for(int i = 0 ; n>=i ; i++)
        e[i][1]=e[i][2]=ee[i]=1;
    dfs(1,0);
    cin >> q;
    while(q--)
    {
        ll T;
        cin >> T;
        if(T==1)
        {
            ll x , d , w;
            cin >> x >> d >> w;
            if(d!=2)
                h[x]=h[x]*w%l;
            if(d==1)
                e[x][1]=e[x][1]*w%l;
            if(d==2)
                e[x][2]=e[x][2]*w%l;
            if(d>=1)
            {
                ll pp = p[x];
                h[pp]*=w;
                h[pp]%=l;
            }
            if(d>=2)
            {
                ll pp = p[p[x]];
                h[pp]*=w;
                h[pp]%=l;
                ee[p[x]]*=w;
                ee[p[x]]%=l;
            }
        }
        else
        {
            ll x;
            cin >> x;
            /*cout << p[x] << " " << p[p[x]] << " ";
            cout << h[x] << " " << e[p[x]][1] << " " << e[p[p[x]]][2] << " ";*/
            ll ans = h[x]%l*e[p[x]][1]%l*e[p[p[x]]][2]%l*ee[p[x]]%l*e[p[x]][2]%l;
            cans
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 11952kb

input:

1000 548641563
31 369
77 278
249 820
390 623
320 777
479 743
698 791
272 557
802 894
215 852
70 730
444 781
256 861
841 948
12 511
642 777
354 527
388 828
304 407
34 914
102 342
190 880
69 765
281 352
254 255
340 790
61 457
134 229
564 988
151 837
49 959
588 783
80 766
28 806
628 705
14 274
580 725
...

output:

268317771
47097484
407501163
102282451
333095282
260041962
509278870
417494919
313574910
300536828
275157500
350517806
106786594
55190798
220499853
115417021
479391407
199433113
28310592
274208907
308815867
405598991
372205010
156303449
379723597
347413502
418395009
431342792
303367897
166315296
537...

result:

wrong answer 3rd lines differ - expected: '421588776', found: '407501163'

Subtask #2:

score: 9
Accepted

Test #6:

score: 9
Accepted
time: 147ms
memory: 31828kb

input:

200000 892371480
22998 49553
81275 113185
5727 132878
82654 169356
71699 140286
125888 186861
100837 142296
106066 140656
74252 149480
27501 176100
83345 88242
66303 115915
12674 130725
1674 63588
1364 156886
15385 17886
75399 75822
86036 186555
1531 179090
89516 172228
115155 176119
44396 128552
14...

output:

273234182
449437106
242099755
333821140
233724926
123405654
394821271
546278602
291329778
653757142
74962316
203008878
296806541
569404826
79844982
145831433
279268910
789682109
554828797
57305870
152411988
447931917
350986222
77173213
654165447
107322515
179403121
296292234
658242000
570287501
9772...

result:

ok 359724 lines

Test #7:

score: 9
Accepted
time: 148ms
memory: 33220kb

input:

200000 892371480
59051 108138
709 18432
3373 4160
81820 138763
14879 82923
123421 149974
39235 56724
138428 142067
26518 139163
83834 155808
28218 175867
157538 176578
127227 168352
57459 73378
20717 92801
41621 131217
96587 119662
16588 56440
98874 166447
169289 179377
91422 198094
33692 196507
179...

output:

166592295
234150952
346022216
77124613
396993404
51930524
87028258
682916517
571418944
749769222
101036056
464653245
845360352
664987832
16751161
512198631
130100685
443938801
525806938
296296172
581330059
314473922
373986734
402769385
672503208
122066525
834490544
748443511
221373021
199161375
7874...

result:

ok 39673 lines

Test #8:

score: 9
Accepted
time: 177ms
memory: 36480kb

input:

200000 299686896
43575 91632
34874 171258
68367 135161
77949 176826
45957 156843
70983 137807
158756 187544
166228 194932
63061 145247
24977 72898
369 135302
88594 172689
1744 4534
26884 91588
8795 12685
7657 128097
141409 194997
41564 193750
51880 186976
113683 179533
88287 107019
26419 60202
51500...

output:

153703089
190057045
7136020
168830450
76879480
87879584
87719325
175158784
54891124
279979227
255510362
53577925
31856903
128267600
255038568
246273049
117408256
226987337
65917427
204281939
33090545
107283491
81352055
81662606
286835567
296857103
50560651
15009143
35067904
68217762
34236867
6665884...

result:

ok 199657 lines

Test #9:

score: 9
Accepted
time: 154ms
memory: 31740kb

input:

200000 838643955
94492 164730
2276 69401
168965 199995
32415 149619
5285 62321
24849 158718
121409 137255
127343 143306
10860 59336
30874 172699
54593 107388
58066 168225
93496 96759
104453 194549
95637 136061
175330 194582
84978 197679
33177 164924
85323 177163
154607 160859
72160 171674
104044 195...

output:

150279949
239544566
772318800
631522163
127335806
333963322
422318031
618695058
250373273
765301422
815124961
735825783
642708164
163793816
61924565
155726680
295497478
222237471
534822095
535965168
325904580
346513704
252783720
38659518
426821837
151230138
796936758
488862744
703201275
19235569
250...

result:

ok 200018 lines

Test #10:

score: 9
Accepted
time: 147ms
memory: 32068kb

input:

200000 97283126
78195 199069
98371 171423
133827 176140
56548 71686
33430 167348
24420 151089
11536 29535
45921 72472
72495 185053
52393 96821
153769 168875
141267 169335
63605 162319
26762 191960
92449 124826
17179 41752
134769 136743
9048 118644
53516 98316
28157 186562
79306 167664
63804 184299
4...

output:

81717490
64959421
94165084
80751499
5532863
65043181
4789120
89461299
90408913
37815589
73068866
21349361
91226766
26915871
9941908
1333155
55225179
85014627
2551676
53058470
28524407
92510940
81250073
75799400
22518341
80563542
69887489
21444944
49346167
32034550
32481227
34562669
50497378
26869833...

result:

ok 199658 lines

Test #11:

score: 9
Accepted
time: 153ms
memory: 32524kb

input:

200000 957083944
72167 164334
61424 79796
2366 129990
13044 45656
83062 147164
88207 161766
40685 73564
124918 146264
131555 138584
49209 134190
29818 55412
18951 114823
58121 159486
92105 92215
1249 160390
44097 113265
78751 134928
155205 164875
55051 154353
73409 150521
15227 74285
122002 172296
1...

output:

605094958
606526750
195579649
691174516
216138578
469992305
870832146
597427306
759452219
10446966
320553455
823784587
399699096
101905742
671398460
865184715
928982320
404977938
169518408
365494071
763819226
768915251
162048421
399829055
750586986
26297583
181412268
427023299
291501222
178094537
59...

result:

ok 200005 lines

Test #12:

score: 9
Accepted
time: 117ms
memory: 32160kb

input:

200000 620494303
110107 194555
186984 194555
140306 194555
64033 194555
98077 194555
173973 194555
74413 194555
167697 194555
194555 195790
105875 194555
145519 194555
168901 194555
145944 194555
168864 194555
194555 198185
76155 194555
64103 194555
154730 194555
145591 194555
23218 194555
70146 194...

output:

387208036
269749605
143825776
386221309
166148501
571207988
86520130
146623168
191313259
224947001
302185025
362343829
53680445
134285655
602000909
381478180
405387372
366107234
124504123
96242506
63394255
345466691
363682198
180785126
75522637
231612992
407331498
6758635
568245455
148930353
5144059...

result:

ok 199709 lines

Test #13:

score: 9
Accepted
time: 151ms
memory: 41080kb

input:

200000 210207444
40880 113562
63189 84942
44038 94475
17523 128534
971 4860
77855 118375
1874 195741
78504 105215
49547 57282
51622 120638
70123 122046
84655 168187
20248 158711
86016 161594
3249 87623
174046 185318
92703 150374
104055 148044
10040 168532
28256 84058
29262 199444
95661 110258
89502 ...

output:

66427112
49813607
65709506
95309216
48820824
157726838
65958214
199470364
125375142
71979313
655184
132264066
117706996
49221763
138345349
53361591
99450429
79852964
37046148
40284510
20359264
46796096
143956793
73782122
190442723
175127269
144757745
80292991
166449041
7571847
169064624
191309356
13...

result:

ok 359988 lines

Test #14:

score: 9
Accepted
time: 175ms
memory: 38728kb

input:

200000 277396202
134706 182577
88090 174965
17284 118366
19675 26563
53972 76358
98188 106350
89114 134859
56578 153366
27467 76764
75829 143042
111314 187242
89185 132517
78909 103096
104370 141106
113171 155958
90860 92666
130798 187617
179916 182473
34709 155321
186193 199194
20994 140011
35791 1...

output:

61971359
211732659
94197822
101967010
49532755
258380297
151367208
39145182
36037104
118590068
56170690
115922074
211204890
254479280
1184872
107466510
143174573
237645059
142663782
1584735
214544052
191408538
48863042
18232642
258857202
80710580
219275054
122524527
31442236
276858087
65401641
20777...

result:

ok 40090 lines

Test #15:

score: 9
Accepted
time: 145ms
memory: 33048kb

input:

200000 663859441
97099 132215
66284 76389
527 42627
21777 82415
55986 69105
33126 164763
82045 151137
38333 45983
19013 85129
28545 127260
100764 123787
99699 128444
4688 177262
130166 162319
133691 166019
43881 122390
92948 129723
52215 133069
24938 169712
82254 171002
139552 167491
56603 113815
10...

output:

429150847
324200889
636632593
646525880
494717234
351534682
392148941
301540911
264814346
86975357
592339700
379872161
46360788
67412424
628105156
613787311
6007585
212673835
31260951
235860987
458313526
19109503
600385154
607884448
6830430
543603370
298230208
643763133
186555189
484008078
216262484...

result:

ok 360163 lines

Test #16:

score: 9
Accepted
time: 148ms
memory: 32200kb

input:

200000 474791189
20030 76483
72905 104045
78831 163796
104384 174115
141704 146477
63086 133326
69607 89867
127531 178706
138528 138940
37518 184850
158596 190130
13616 56674
44133 194074
12887 97910
66495 186126
92687 188518
121091 127667
68215 107738
31115 104057
94396 150432
25951 163620
85439 16...

output:

123502650
199850667
431654344
2331830
448569687
72304654
241019414
355806270
104155562
318300669
87865155
73140503
431136683
283692007
416130897
103912639
173452438
124679084
472638484
257412346
2993444
147732346
246489573
466811222
378786305
226118253
5737116
212550115
257225072
446402329
192959508...

result:

ok 39919 lines

Test #17:

score: 9
Accepted
time: 120ms
memory: 33360kb

input:

200000 299686896
70964 100366
70964 164697
108536 149205
51293 70964
70964 198326
70964 147834
70964 151506
70964 130323
56203 70964
70964 158775
51567 70964
70964 112848
70964 97207
70964 137813
70964 141114
13429 124704
70964 154718
22128 77415
70964 186659
63412 70964
70964 78723
70964 110481
461...

output:

63419544
83623968
290413872
165811104
290983392
64688400
231874992
285278832
244788336
138240288
202860528
537552
247535424
28865376
172884240
94932000
45292032
43177824
272103840
242262144
162296496
281719008
19005696
243921017
88729056
5316768
111956688
84129696
51425136
21633984
276851862
1237740...

result:

ok 39930 lines

Test #18:

score: 9
Accepted
time: 112ms
memory: 33308kb

input:

200000 838643955
61269 119598
119598 142230
109276 119598
77002 119598
15927 107003
13771 126383
67458 126383
82219 126383
12247 15927
44243 119598
41257 126383
56452 126383
117425 126383
42091 126383
15927 192214
119598 148941
126383 148854
85189 171341
120593 126383
15927 142279
16973 119598
11152...

output:

97488315
415703430
468411135
332575196
754107345
14564535
645610395
798915300
301266405
522940860
6137550
461231790
301742475
468076260
300066645
332817090
104856195
621382824
306257380
1630395
42655350
462414750
389409135
345077460
229228325
611868735
276495975
538396935
327049950
409167222
7586678...

result:

ok 39762 lines

Test #19:

score: 9
Accepted
time: 116ms
memory: 33332kb

input:

200000 97283126
123408 168722
43195 58685
27180 33153
161002 184777
33153 45684
12445 185488
18380 66270
53802 134901
18380 112044
88244 168722
23969 24127
133015 177770
48859 185488
86284 88958
45522 128944
130391 147813
12863 58685
25100 53802
19827 23969
33153 130830
60954 128944
58685 84931
4975...

output:

56460514
19940512
2154890
92617092
32872222
51203112
42861794
48124982
52707920
15182838
75577068
19132464
72500924
5847226
40039772
45055290
8798475
81162006
81463833
92595866
54305258
66645846
63781088
60697654
33686346
6544562
8186428
4059932
66596814
14920228
89602870
18872082
78756146
44082410
...

result:

ok 40048 lines

Test #20:

score: 9
Accepted
time: 124ms
memory: 33360kb

input:

200000 957083944
35107 54512
59955 178657
83844 173420
89728 108858
107902 147723
22000 74350
97213 158624
143572 174444
72820 143572
107240 149591
60787 104709
15946 93241
83844 136779
51953 83844
83844 133211
45413 157075
82664 145373
150449 157072
35416 131421
35023 173073
63458 143572
105176 107...

output:

405258568
422627830
925539096
631414816
300746546
7941471
88073541
459660759
438630481
540573125
653803958
872160250
833565851
694460048
341171568
714961088
443647280
530781048
865128076
845353975
34589914
52907216
150065552
361271304
108266626
496972096
655547992
17460680
68762816
8458688
601957320...

result:

ok 39784 lines

Test #21:

score: 9
Accepted
time: 125ms
memory: 33984kb

input:

200000 620494303
42440 46628
105812 149570
108878 144601
169256 192366
56494 163953
45712 135966
54726 128235
49786 80037
46664 62820
101 96642
96417 142795
20680 29967
46628 138477
5855 125271
46230 53640
30279 54726
90511 180479
40516 81369
12774 127421
62820 160270
89644 135444
90424 173622
6420 ...

output:

360369471
226310795
485172591
177390139
57640881
466611540
243047932
152044768
56572207
366751977
576015824
373601338
217255642
170649420
288215686
551596317
574681263
153273
267652189
203573279
89558601
503443760
594420174
227143465
260634127
407964700
339861753
616837769
413856521
447434375
191312...

result:

ok 40149 lines

Test #22:

score: 9
Accepted
time: 1ms
memory: 13932kb

input:

2 820765898
1 2
107025336
215163294
1000
1 1 1 193096547
2 1
1 2 0 41852054
2 2
2 1
1 1 1 698818553
1 2 0 475139569
1 2 0 133557035
2 2
1 1 1 293954373
1 1 0 404029058
2 2
2 1
1 2 1 430222549
1 2 1 607030741
2 1
2 1
1 2 1 132640928
2 2
2 2
1 1 1 459810447
1 1 1 389362544
2 2
2 1
1 1 0 82625075
2 2
2...

output:

690320376
62869268
690320376
491381826
666758786
365602488
366310706
366310706
259492106
259492106
524101358
399495912
524101358
524101358
349854316
349854316
524101358
269508146
12742700
664489082
664489082
299846742
290238428
290238428
514362112
711807816
514362112
267093888
613273016
543228380
29...

result:

ok 492 lines

Test #23:

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

input:

5 686629684
1 5
2 3
1 3
4 5
511695984
555955461
265146213
75408357
210424340
1000
2 4
1 2 1 653398187
1 4 1 296623062
2 2
1 5 0 122518318
2 3
1 3 0 167933015
2 5
2 2
2 2
2 1
1 2 1 568012604
2 2
1 5 1 371956331
2 1
1 5 0 217982529
2 3
1 5 0 327595875
1 5 1 413231433
2 3
1 3 1 142316118
1 1 1 23245143...

output:

75408357
561632435
49765235
245620284
561632435
561632435
511695984
566731152
565167008
161221788
161221788
427565628
667953734
385727732
212591600
667953734
427565628
667953734
37734516
586373112
586373112
37734516
527023796
670916114
679580644
679580644
292022432
679580644
482693276
164972344
3043...

result:

ok 501 lines

Test #24:

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

input:

8 478269876
4 5
1 7
7 8
2 4
1 5
3 6
6 8
227392056
462547254
161908751
327683549
152259033
152555035
52187173
440610453
1000
1 7 0 256374461
1 1 1 113126554
2 3
1 5 1 470048828
1 7 0 394318553
2 5
1 8 0 106880176
2 8
1 4 1 184559304
2 7
2 2
2 4
1 2 0 437650135
1 5 1 32943844
2 3
1 7 0 209655691
2 3
2...

output:

161908751
357429432
342826524
245467894
426942732
238472988
161908751
161908751
152555035
375999090
375999090
112198020
112198020
288768732
208215960
199847364
83217820
357338160
357338160
33508356
249668160
11666268
357338160
15730296
357338160
417494112
240655944
315815832
240655944
137955288
3253...

result:

ok 492 lines

Test #25:

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

input:

11 362333726
1 10
8 11
8 10
3 9
3 5
2 9
7 11
4 6
5 7
2 4
232803083
91914477
212812736
115134220
217225700
54761676
251326707
181588813
41304573
268105683
261272685
1000
1 9 0 92348249
1 11 1 192765305
2 10
1 5 1 213687147
1 2 1 143462234
2 1
2 3
2 8
1 6 0 92112490
1 7 0 27928580
1 9 1 109042976
1 8 ...

output:

268105683
232803083
281101118
102131681
293752076
248526918
181721648
248526918
232803083
232803083
253206160
253206160
293525074
293525074
44645908
139479436
232803083
220347433
293525074
293525074
320138350
119050512
293525074
220347433
172831814
75878050
201854920
232803083
138044899
337308264
10...

result:

ok 542 lines

Test #26:

score: 9
Accepted
time: 1ms
memory: 7928kb

input:

14 764371137
3 8
1 9
3 5
11 12
12 13
7 9
1 11
2 4
4 10
2 14
6 7
8 10
6 14
389971024
383408316
522977682
252668893
7371363
165814760
11665346
468610654
204761981
362148770
406895090
662239452
175391465
696207378
1000
1 5 0 312602793
1 12 1 353306302
1 8 0 171589250
1 10 0 25448449
2 11
2 4
2 12
2 9
2...

output:

150419189
252668893
452599077
204761981
11665346
11665346
452599077
712842524
452599077
389971024
452599077
483416448
434082862
452599077
598237920
290690738
99574071
290690738
99574071
165814760
137362494
136739298
136739298
345064946
733875299
573805399
99574071
136739298
99574071
99574071
2713443...

result:

ok 512 lines

Subtask #3:

score: 29
Accepted

Dependency #2:

100%
Accepted

Test #27:

score: 29
Accepted
time: 150ms
memory: 31872kb

input:

200000 892371480
45417 110315
147359 189239
117291 180132
159630 183102
130024 189557
164855 167226
98133 157668
15053 137747
124400 181297
82219 146820
81096 113913
38664 125127
84558 173661
30562 52135
29787 76935
102436 188510
216 178861
53850 72084
58431 159839
845 47821
14410 169053
76651 15936...

output:

594284535
640239614
1464336
823224962
76651484
110879393
321529319
884603103
675372255
538518027
211857220
46971085
235439278
770194485
145826241
152434523
853775968
191686118
199123923
63352290
156639563
879240989
645130444
628337043
377902707
245900492
440107830
293610586
872950481
254331916
55399...

result:

ok 360029 lines

Test #28:

score: 29
Accepted
time: 160ms
memory: 32648kb

input:

200000 892371480
93832 154017
62437 186860
22156 88304
90665 126608
101866 194562
57254 145075
116781 162572
29477 156514
31537 89020
68429 121070
12116 80492
189844 198940
23635 142152
19049 111911
40589 147564
37556 42144
3000 95453
14424 59939
132142 172241
100344 130209
24097 39498
93242 130013
...

output:

885162606
267164248
342466731
655626099
135720761
778734912
275108279
510053977
63946474
891950741
708995024
470255169
305386347
560048820
374914433
393191349
147166271
851736999
515091198
399838418
888365757
521276202
763585836
413484820
570204461
610173912
759517342
734240232
627629167
60840288
17...

result:

ok 40135 lines

Test #29:

score: 29
Accepted
time: 151ms
memory: 40436kb

input:

200000 601047767
96401 125712
28453 108185
154921 172064
96583 131868
12499 44727
38028 120351
66743 156355
76228 112282
106994 175356
27558 176464
52648 186827
51455 173443
20175 135082
45812 59149
130531 139657
47282 115819
8228 8730
112093 132500
14450 64513
81383 150099
117654 128086
4285 176347...

output:

309315125
382372001
387846393
371731828
490941482
15082287
22418430
380337127
116634192
497573765
529941738
222177650
463802508
166516757
52731099
233205845
572967829
567974254
571234490
63237461
586341943
534834480
73133823
317733072
62925169
142087941
17027946
124701079
37034363
274045171
46655413...

result:

ok 199914 lines

Test #30:

score: 29
Accepted
time: 148ms
memory: 31972kb

input:

200000 453591910
21881 166170
65906 172039
35762 66748
168774 175609
106079 174033
133891 176503
33232 196551
186338 189227
52475 93705
85468 168691
53404 179232
125746 184674
25604 65331
95720 169465
91069 135449
18054 84274
69617 189331
85256 138335
59673 68017
98474 165982
28029 51652
47836 90601...

output:

428191326
68316955
136343022
25013884
76997372
318941688
30297201
364618072
420915541
304121045
424132343
217529143
289587538
280339715
350398925
50881484
129448994
372613444
126576895
330509380
158051872
28668772
66586042
165010395
290604410
208210313
107400245
178163204
370345748
162437972
1455414...

result:

ok 200311 lines

Test #31:

score: 29
Accepted
time: 147ms
memory: 33380kb

input:

200000 524592679
30163 50467
114682 196059
119857 173807
6269 20876
96660 184889
108900 180986
108402 124204
61996 104208
139446 187920
193455 194333
9415 191818
19891 124443
20794 107343
129313 177378
11383 138145
103236 141276
6931 184386
19721 72413
2740 20676
39723 87521
37006 153079
59464 14882...

output:

183417370
400549761
483554887
266111539
140104556
342524240
128284100
420226326
183277775
393617752
512554737
385701143
90685524
245496848
79752914
498750470
336951025
175741769
319479324
361162718
506340894
23428882
239631335
98669193
121443435
187854754
285671296
90438315
314977022
110538959
37694...

result:

ok 199813 lines

Test #32:

score: 29
Accepted
time: 160ms
memory: 33608kb

input:

200000 118435465
63873 73617
49140 79113
6462 37484
134064 160041
103681 104663
139084 184802
54180 158946
13129 66282
4142 182001
7298 196150
162189 187190
86789 118461
95140 182778
3227 29733
35671 132824
28799 39836
95178 121055
38885 100144
5222 29097
83777 150749
84499 111723
93750 134774
92751...

output:

97699939
71469978
21235837
18892198
1208219
89515425
18792274
97258345
72256415
36862514
54142869
40686443
118191097
89916258
59303019
43853925
60716260
71901304
114531656
16641661
66902971
116152633
48557779
69832530
4973483
86159886
50954221
4097167
50015036
11819838
3502942
10131264
16732741
3527...

result:

ok 200236 lines

Test #33:

score: 29
Accepted
time: 129ms
memory: 32004kb

input:

200000 794555724
143556 184414
8162 184414
86805 184414
125195 184414
124312 184414
180180 184414
94907 184414
4753 184414
184414 196582
96480 184414
21058 184414
121398 184414
36665 184414
183161 184414
151057 184414
15898 184414
18538 184414
184414 193451
161108 184414
119896 184414
2870 184414
14...

output:

321237771
36833892
191046079
691451056
92203152
588838160
358124996
521292300
106333816
143007996
747011120
307263844
221604632
316481992
189941604
225372804
400919432
91304720
623087212
711865776
591106068
662093676
274370004
149944320
371950344
632925048
367563528
383484744
88953516
286166472
7467...

result:

ok 199679 lines

Test #34:

score: 29
Accepted
time: 149ms
memory: 36988kb

input:

200000 932732894
76264 133556
30468 74583
133739 160450
156339 168900
116120 144114
71102 103424
175944 196732
39449 199731
15647 107694
141019 148408
160992 182531
111372 136704
92188 136154
10072 186242
18467 89148
108338 110225
31507 43326
8442 90107
72808 83186
84393 111116
17045 196530
37085 45...

output:

766902489
81988081
661764848
66165120
405746782
801019631
306959195
859331034
290798051
607337160
139803623
124473794
523612479
759358899
540665273
235894487
489427987
54875971
666513961
317295162
730372929
609482691
721345247
23432328
128687062
830800202
387738049
821118638
873134430
365074901
3235...

result:

ok 359624 lines

Test #35:

score: 29
Accepted
time: 155ms
memory: 39960kb

input:

200000 336686118
135366 166839
45350 139904
159671 170058
120428 191987
89668 121835
81044 177044
8391 100363
45370 67196
88711 197110
105185 190639
52533 191686
51115 87768
84729 145924
104888 132007
47826 74094
135845 137337
26681 192652
23948 90426
2779 22400
12151 116043
41007 59794
36610 138263...

output:

236619619
42646449
258150542
4582480
4816763
69595975
8026636
76204446
55974780
261332041
290758786
196023885
48420013
170585214
61740111
310935990
76999396
251752926
65296455
199635352
183230892
288373777
123674826
53543537
22205261
308353477
172404437
213258555
173768326
128417205
65075903
2358602...

result:

ok 39903 lines

Test #36:

score: 29
Accepted
time: 141ms
memory: 32664kb

input:

200000 660153402
15357 105508
30699 132572
99697 155530
26332 41270
83794 152333
77283 129270
31154 144269
68129 145165
189326 192701
175075 179460
27655 159558
140661 140858
51283 93986
5639 36360
14287 32658
16427 36856
89327 136650
27504 67243
11550 73783
64089 75619
90239 195788
36317 108641
566...

output:

322269999
123550476
469829285
131855595
337357257
250933469
584304339
636490839
193176595
280021105
528254114
367293912
417710977
248776364
536452751
379428842
16717042
386780920
4279638
579647611
404655246
391037942
164687852
490711620
231695905
64206279
348335518
602784261
46864702
266843257
56445...

result:

ok 360261 lines

Test #37:

score: 29
Accepted
time: 150ms
memory: 31600kb

input:

200000 526201007
64774 71847
77497 125603
141089 179423
140802 180328
80083 187016
147945 189180
98635 150045
1640 145973
49457 84983
93847 198846
50232 199874
97706 145645
819 54868
64301 197903
112560 116952
42657 123906
42437 160866
61936 189935
75199 107324
44597 106911
72860 94448
6450 98816
11...

output:

464642454
517279291
140648161
370322711
295601015
30327994
391447910
460232852
525578169
356413664
443150743
238489577
13000652
263516094
143880060
508582663
91928334
319789903
41784149
329031133
67227985
77167139
469207734
139977806
500832103
26234148
77723312
396661811
341388291
359569688
44258528...

result:

ok 39822 lines

Test #38:

score: 29
Accepted
time: 0ms
memory: 14064kb

input:

2 37304419
1 2
29626812
12442488
1000
1 2 0 29944224
1 1 0 29790797
1 1 0 35671101
2 2
1 2 1 5308319
1 1 0 10945865
1 2 0 20159800
1 1 2 4011276
2 1
1 2 2 1570746
2 1
1 2 0 26192449
1 1 0 19577455
2 1
1 1 2 7642770
2 2
2 2
2 2
2 2
2 2
1 2 2 15217784
1 2 2 30434890
1 1 1 30269900
2 2
2 2
1 1 1 260067...

output:

2499806
5964173
16748426
918307
13019644
13019644
13019644
13019644
13019644
28010182
28010182
30992781
24699004
24699004
20838434
5233281
12296037
12296037
12296037
6006320
6006320
6006320
34958424
16024098
9254202
26861423
27737009
27737009
17252441
29505039
29505039
29505039
34720199
8329559
2070...

result:

ok 499 lines

Test #39:

score: 29
Accepted
time: 0ms
memory: 14060kb

input:

5 555198320
1 5
1 3
2 4
2 3
383701832
300776219
26088429
411016312
61629662
1000
2 1
2 2
2 1
2 2
2 3
1 1 2 104187894
1 5 2 487610856
2 3
1 5 1 184138469
1 1 1 273019062
1 3 0 430338431
1 1 1 403637434
1 1 1 554957964
2 4
1 5 2 101615896
2 5
2 2
1 3 1 201120671
1 4 0 284571925
1 5 2 433594152
1 4 2 1...

output:

383701832
300776219
383701832
300776219
26088429
435827536
411016312
183931104
497282146
356149456
269552800
198631840
282384000
245622000
402709120
198631840
4074320
39376880
551507200
29039760
456690400
456690400
297287600
499976560
499976560
66610400
548567920
401769680
25183680
401769680
4017696...

result:

ok 491 lines

Test #40:

score: 29
Accepted
time: 0ms
memory: 7928kb

input:

8 902440550
1 4
2 6
3 5
1 6
4 7
3 8
2 5
367088587
49553470
118122846
369327908
157485348
615437631
27764020
227751499
1000
1 8 1 372179556
2 6
2 4
1 2 1 196727248
1 8 0 772734423
1 3 1 260341858
1 5 0 505341869
2 4
2 6
1 5 2 423776788
2 4
2 4
2 8
2 6
2 6
1 6 1 39676956
2 8
2 2
1 4 1 781292051
2 4
1 ...

output:

615437631
369327908
369327908
563695238
369327908
369327908
568454848
216202644
216202644
568454848
389570280
581746708
288882990
581746708
151679364
3095972
3095972
3095972
398824250
751670170
789486942
447544350
225615930
447544350
447544350
15007730
15007730
218713572
218713572
74677024
421118786...

result:

ok 505 lines

Test #41:

score: 29
Accepted
time: 0ms
memory: 11884kb

input:

11 102517931
5 11
4 10
1 3
4 11
2 9
3 6
5 7
6 7
8 10
2 8
93205850
73076419
20819297
84526973
91672399
47857436
65327125
87354488
91285121
36025628
27851064
1000
2 1
2 10
2 8
2 1
2 9
2 4
1 2 2 14653208
2 4
1 10 0 21258423
2 4
1 9 0 17641492
2 6
2 7
1 7 2 27451703
1 11 1 39116683
1 4 1 18292194
2 11
1...

output:

93205850
36025628
87354488
93205850
91285121
84526973
84526973
84526973
47857436
65327125
11935313
99811218
41442780
71390789
71390789
84564613
32128057
75286105
75286105
43231594
94364607
97072410
94364607
43231594
83339446
74211865
85022788
35457563
12250788
7136477
95571886
72931972
50268610
6292...

result:

ok 510 lines

Test #42:

score: 29
Accepted
time: 1ms
memory: 7928kb

input:

14 572275646
1 10
5 11
2 7
6 12
4 9
10 13
2 8
4 6
3 14
11 12
7 9
1 3
5 14
162681902
398647380
550212050
505842464
329150380
429736651
329722401
46771889
441707857
306200422
112576470
22210229
380938488
441572193
1000
1 7 2 502800212
2 3
2 2
2 12
1 10 0 195737779
1 13 1 111057257
1 13 2 3697026
2 7
2...

output:

550212050
368945848
22210229
45570170
408503292
376422810
550212050
368945848
368945848
551312918
213570306
312585264
329150380
368945848
2669312
329150380
441572193
441572193
288328542
220446482
151016962
220446482
441572193
368945848
368945848
270881862
386718306
448390382
497534004
497534004
1496...

result:

ok 539 lines

Subtask #4:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 156ms
memory: 40224kb

input:

200000 892371480
85218 172641
32760 178929
67472 90740
137725 140228
7283 158683
38909 179144
136916 199945
183437 185978
39771 151379
27581 52887
45716 131957
94463 189969
108714 189877
42691 162639
70675 137777
2216 64496
11562 156673
60130 75992
23866 79156
52433 110066
69048 131110
155123 164884...

output:

782082073
824401298
599790916
294215187
203019461
236590667
661026646
147203543
602124019
438408587
537428705
8355752
124805730
541572457
511706673
449606645
118068138
91082179
417223715
31471407
815086590
322359719
669024622
189907169
517409848
114211575
497857100
605205022
21390597
260171160
53244...

result:

wrong answer 190th lines differ - expected: '0', found: '126663648'

Subtask #5:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 156ms
memory: 36736kb

input:

200000 892371480
53225 130450
30850 181698
17803 177493
8780 107369
5103 129868
105068 193082
45556 96552
107511 188440
77104 166564
15995 132714
99128 181477
22868 55561
12946 104306
108248 191490
32697 180631
143427 188480
47296 68977
54677 109873
112693 132105
71875 137093
82514 158424
20701 2978...

output:

5118074
498125396
251749089
21578201
169648223
89138431
486735724
430589511
60128044
296727358
96494797
683654223
25434588
641217539
292066134
753877167
349591450
696055657
528160411
318336519
357452444
83471033
302900015
623037539
678896657
732784430
849466722
310755541
488624956
497664716
77194996...

result:

wrong answer 191st lines differ - expected: '554741724', found: '277370862'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%