QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#877718#3508. SprinklerDe3b0o#9 159ms39112kbC++209.2kb2025-02-01 01:34:382025-02-01 01:34:38

Judging History

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

  • [2025-02-01 01:34:38]
  • 评测
  • 测评结果:9
  • 用时:159ms
  • 内存:39112kb
  • [2025-02-01 01:34:38]
  • 提交

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];

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]=1;
    dfs(1,0);
    cin >> q;
    while(q--)
    {
        ll T;
        cin >> T;
        if(T==1)
        {
            ll x , d , w;
            cin >> x >> d >> w;
            h[x]*=w;
            h[x]%=l;
            if(d>=1)
            {
                e[x][1]*=w;
                e[x][1]%=l;
                ll pp = p[x];
                h[pp]*=w;
                h[pp]%=l;
            }
            if(d>=2)
            {
                e[x][2]*=w;
                e[x][2]%=l;
                ll pp = p[p[x]];
                h[pp]*=w;
                h[pp]%=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]*e[p[x]][1]%l*e[p[p[x]]][2]%l;
            cans
        }
    }
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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
43378680
509278870
417494919
313574910
300536828
275157500
350517806
106786594
55190798
33612243
115417021
479391407
199433113
28310592
274208907
308815867
405598991
372205010
156303449
379723597
347413502
418395009
431342792
303367897
166315296
53790...

result:

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

Subtask #2:

score: 9
Accepted

Test #6:

score: 9
Accepted
time: 131ms
memory: 31468kb

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

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: 153ms
memory: 34916kb

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: 146ms
memory: 30056kb

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: 139ms
memory: 30100kb

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: 143ms
memory: 31112kb

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: 124ms
memory: 31704kb

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: 152ms
memory: 39112kb

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: 159ms
memory: 37048kb

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: 139ms
memory: 31692kb

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: 137ms
memory: 30044kb

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: 110ms
memory: 31956kb

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: 124ms
memory: 30468kb

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: 108ms
memory: 31136kb

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: 118ms
memory: 30352kb

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: 123ms
memory: 32476kb

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: 0ms
memory: 11888kb

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

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

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

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

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

Dependency #2:

100%
Accepted

Test #27:

score: 0
Wrong Answer
time: 137ms
memory: 31148kb

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:

wrong answer 220th lines differ - expected: '714103061', found: '374780063'

Subtask #4:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 145ms
memory: 37736kb

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: 143ms
memory: 35300kb

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%