Submission #1013537

# Submission time Handle Problem Language Result Execution time Memory
1013537 2024-07-03T15:49:26 Z 8pete8 Sprinkler (JOI22_sprinkler) C++17
100 / 100
3257 ms 213056 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
#define int long long
using namespace std;
const int mod=1e9+7,mxn=2e5+5,inf=1e18,minf=-1e18,lg=30;
//#undef int
int n,k,m;
vector<int>adj[mxn+10];
void setIO(string name){		
	ios_base::sync_with_stdio(0); cin.tie(0);		
	freopen((name+".in").c_str(),"r",stdin);		
	freopen((name+".out").c_str(),"w",stdout);	
}
int h[mxn+10],dist[mxn+10],sz[mxn+10],del[mxn+10],id[mxn+10];
struct qry{
    int time,node,D,w,type;
    bool operator<(qry a)const{return D-dist[node]<=a.D-dist[a.node];};
};
vector<qry>have[mxn+10];
vector<qry>event,event2;
struct fen{
    int fwk[mxn+10];
    void init(int n){for(int i=0;i<=n;i++)fwk[i]=1;}
    void update(int pos,int val,int n){for(int i=pos;i<=n;i+=(i&-i))fwk[i]=(fwk[i]%k*val%k)%k;}
    int qry(int pos){
        if(pos==0)return 1;
        int ans=1;
        for(int i=pos;i>0;i-=(i&-i))ans=(ans%k*fwk[i]%k)%k;
        return ans;
    }
}t;
struct seg{
    int v[2*mxn+10];
    void init(int n){for(int i=0;i<=2*n;i++)v[i]=1;}
    void update(int pos,int val,int n){
        pos+=n;
        v[pos]=(v[pos]*val)%k;
        for(int i=pos;i>0;i>>=1)v[i>>1]=(v[i]*v[i^1])%k;
    }
    int qry(int l,int r,int n){
        int ans=1;
        for(l+=n,r+=n;l<=r;l>>=1,r>>=1){
            if(l&1)ans=(ans*v[l++])%k;
            if(!(r&1))ans=(ans*v[r--])%k;
        }
        return ans;
    }
}t2[45];
vector<qry>bro[mxn+10];
void getsz(int cur,int p){
    sz[cur]=1,dist[cur]=0;
    for(auto i:adj[cur])if(i!=p&&!del[i])getsz(i,cur),sz[cur]+=sz[i];
}
int getcen(int cur,int p,int need){
    for(auto i:adj[cur])if(i!=p&&sz[i]>=need&&!del[i])return getcen(i,cur,need);
    return cur;
}
int in[mxn+10],where[mxn+10],ans[mxn+10];
void dfs(int cur,int p,int deg){
    in[cur]=deg;
    for(auto i:have[cur]){
        if(i.type==1){
            if(i.D-dist[cur]>=0)event.pb(i);
        }
        else event.pb(i);
    }
    for(auto i:adj[cur])if(i!=p&&!del[i]){
        dist[i]=dist[cur]+1;
        dfs(i,cur,deg);
    }
}
bool cmp(qry a,qry b){return a.time<b.time;}
void solve(int cur){
    getsz(cur,-1);
    int node=getcen(cur,-1,sz[cur]/2);
    for(auto i:have[node]){
        if(i.type==1){
            if(i.D-dist[node]>=0)event.pb(i);
        }
        else event.pb(i);
    }
    for(int i=0;i<adj[node].size();i++)if(!del[adj[node][i]])dist[adj[node][i]]=1,dfs(adj[node][i],node,i);
   // for(auto i:event2)cout<<i.time<<" "<<i.D<<" "<<i.w<<' '<<dist[i.node]<<' '<<i.node<<"LLL\n";
    sort(all(event),cmp);
    for(int i=0;i<=40;i++)t2[i].init(adj[node].size()+1);
    vector<int>ex(41,1);
    for(auto i:event){
        if(i.type==1&&id[i.time]!=-1){
            if(i.node==node)ex[i.D-dist[i.node]]=(ex[i.D-dist[i.node]]*i.w)%k;
            else t2[(i.D-dist[i.node])].update(in[i.node],i.w,adj[node].size());
        }
        else if(i.type==2){
            for(int K=dist[i.node];K<=40;K++){
                ans[i.time]=(ans[i.time]*ex[K])%k;
                if(i.node==node)ans[i.time]=(ans[i.time]*t2[K].qry(0,adj[node].size()-1,adj[node].size()))%k;
                else{
                    if(in[i.node])ans[i.time]=(ans[i.time]*(t2[K].qry(0,in[i.node]-1,adj[node].size())))%k;
                    if(in[i.node]+1<adj[node].size())ans[i.time]=(ans[i.time]*(t2[K].qry(in[i.node]+1,adj[node].size()-1,adj[node].size())))%k;
                }
            }

        }

    }
    event.clear();
    del[node]=1;
    for(auto i:adj[node])if(!del[i])solve(i);
}
int32_t main(){
    fastio
    //d is less than 40 '0'
    cin>>n>>k;
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    for(int i=1;i<=n;i++)cin>>h[i];
    int q;cin>>q;
    vector<int>what;
    for(int i=0;i<q;i++){
        int a;cin>>a;
        qry x;
        x.type=a;
        x.time=i;
        if(a==1){
            cin>>x.node>>x.D>>x.w;
            x.w%=k;
            have[x.node].pb(x);
        }
        else{
            cin>>x.node;
            have[x.node].pb(x);
            what.pb(i);
            ans[i]=h[x.node];
        }
    }
    solve(1);
    for(auto i:what){
        cout<<ans[i]<<"\n";
        if(ans[i]<0)assert(0);
    }
    //solve(1);
}
/*
4 7
1 2
2 3
3 4
1
1
1
1
11
1 2 1 2
1 1 0 2
2 1
2 2
2 3
2 4
1 4 10 2
2 1
2 2
2 3
2 4

*/

Compilation message

sprinkler.cpp:32:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   32 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
sprinkler.cpp:39:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   39 | void setIO(string name){
      |                       ^
sprinkler.cpp:47:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   47 |     bool operator<(qry a)const{return D-dist[node]<=a.D-dist[a.node];};
      |                          ^~~~~
sprinkler.cpp:53:20: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   53 |     void init(int n){for(int i=0;i<=n;i++)fwk[i]=1;}
      |                    ^
sprinkler.cpp:54:38: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   54 |     void update(int pos,int val,int n){for(int i=pos;i<=n;i+=(i&-i))fwk[i]=(fwk[i]%k*val%k)%k;}
      |                                      ^
sprinkler.cpp:55:20: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   55 |     int qry(int pos){
      |                    ^
sprinkler.cpp:64:20: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   64 |     void init(int n){for(int i=0;i<=2*n;i++)v[i]=1;}
      |                    ^
sprinkler.cpp:65:38: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   65 |     void update(int pos,int val,int n){
      |                                      ^
sprinkler.cpp:70:30: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   70 |     int qry(int l,int r,int n){
      |                              ^
sprinkler.cpp:80:25: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   80 | void getsz(int cur,int p){
      |                         ^
sprinkler.cpp:84:34: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   84 | int getcen(int cur,int p,int need){
      |                                  ^
sprinkler.cpp:89:31: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   89 | void dfs(int cur,int p,int deg){
      |                               ^
sprinkler.cpp:102:21: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
  102 | bool cmp(qry a,qry b){return a.time<b.time;}
      |                     ^
sprinkler.cpp:103:19: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
  103 | void solve(int cur){
      |                   ^
sprinkler.cpp: In function 'void solve(long long int)':
sprinkler.cpp:112:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  112 |     for(int i=0;i<adj[node].size();i++)if(!del[adj[node][i]])dist[adj[node][i]]=1,dfs(adj[node][i],node,i);
      |                 ~^~~~~~~~~~~~~~~~~
sprinkler.cpp:128:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  128 |                     if(in[i.node]+1<adj[node].size())ans[i.time]=(ans[i.time]*(t2[K].qry(in[i.node]+1,adj[node].size()-1,adj[node].size())))%k;
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
sprinkler.cpp: At global scope:
sprinkler.cpp:139:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
  139 | int32_t main(){
      |              ^
sprinkler.cpp: In function 'void setIO(std::string)':
sprinkler.cpp:41:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sprinkler.cpp:42:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 14680 KB Output is correct
2 Correct 6 ms 14940 KB Output is correct
3 Correct 6 ms 14692 KB Output is correct
4 Correct 9 ms 15196 KB Output is correct
5 Correct 9 ms 15184 KB Output is correct
6 Correct 9 ms 15196 KB Output is correct
7 Correct 9 ms 15120 KB Output is correct
8 Correct 9 ms 15708 KB Output is correct
9 Correct 6 ms 14940 KB Output is correct
10 Correct 7 ms 14940 KB Output is correct
11 Correct 8 ms 15092 KB Output is correct
12 Correct 7 ms 14940 KB Output is correct
13 Correct 7 ms 15088 KB Output is correct
14 Correct 7 ms 14920 KB Output is correct
15 Correct 7 ms 14940 KB Output is correct
16 Correct 7 ms 14940 KB Output is correct
17 Correct 7 ms 15076 KB Output is correct
18 Correct 7 ms 14940 KB Output is correct
19 Correct 7 ms 14940 KB Output is correct
20 Correct 10 ms 15192 KB Output is correct
21 Correct 7 ms 14936 KB Output is correct
22 Correct 7 ms 14940 KB Output is correct
23 Correct 7 ms 14940 KB Output is correct
24 Correct 6 ms 15088 KB Output is correct
25 Correct 7 ms 14940 KB Output is correct
26 Correct 7 ms 14940 KB Output is correct
27 Correct 8 ms 14940 KB Output is correct
28 Correct 7 ms 14940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 14684 KB Output is correct
2 Correct 1944 ms 86568 KB Output is correct
3 Correct 677 ms 68860 KB Output is correct
4 Correct 1481 ms 88232 KB Output is correct
5 Correct 1282 ms 76892 KB Output is correct
6 Correct 1507 ms 76392 KB Output is correct
7 Correct 1472 ms 77216 KB Output is correct
8 Correct 2872 ms 209548 KB Output is correct
9 Correct 2013 ms 97704 KB Output is correct
10 Correct 893 ms 79984 KB Output is correct
11 Correct 1845 ms 86360 KB Output is correct
12 Correct 704 ms 68608 KB Output is correct
13 Correct 776 ms 192848 KB Output is correct
14 Correct 804 ms 115940 KB Output is correct
15 Correct 710 ms 82072 KB Output is correct
16 Correct 760 ms 71372 KB Output is correct
17 Correct 705 ms 67312 KB Output is correct
18 Correct 6 ms 14936 KB Output is correct
19 Correct 7 ms 15092 KB Output is correct
20 Correct 7 ms 14936 KB Output is correct
21 Correct 8 ms 14916 KB Output is correct
22 Correct 6 ms 15108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 14684 KB Output is correct
2 Correct 1944 ms 86568 KB Output is correct
3 Correct 677 ms 68860 KB Output is correct
4 Correct 1481 ms 88232 KB Output is correct
5 Correct 1282 ms 76892 KB Output is correct
6 Correct 1507 ms 76392 KB Output is correct
7 Correct 1472 ms 77216 KB Output is correct
8 Correct 2872 ms 209548 KB Output is correct
9 Correct 2013 ms 97704 KB Output is correct
10 Correct 893 ms 79984 KB Output is correct
11 Correct 1845 ms 86360 KB Output is correct
12 Correct 704 ms 68608 KB Output is correct
13 Correct 776 ms 192848 KB Output is correct
14 Correct 804 ms 115940 KB Output is correct
15 Correct 710 ms 82072 KB Output is correct
16 Correct 760 ms 71372 KB Output is correct
17 Correct 705 ms 67312 KB Output is correct
18 Correct 6 ms 14936 KB Output is correct
19 Correct 7 ms 15092 KB Output is correct
20 Correct 7 ms 14936 KB Output is correct
21 Correct 8 ms 14916 KB Output is correct
22 Correct 6 ms 15108 KB Output is correct
23 Correct 7 ms 14684 KB Output is correct
24 Correct 1758 ms 86596 KB Output is correct
25 Correct 671 ms 68888 KB Output is correct
26 Correct 1421 ms 88260 KB Output is correct
27 Correct 1305 ms 76960 KB Output is correct
28 Correct 1541 ms 76964 KB Output is correct
29 Correct 1613 ms 66980 KB Output is correct
30 Correct 2918 ms 208672 KB Output is correct
31 Correct 1837 ms 97028 KB Output is correct
32 Correct 925 ms 77816 KB Output is correct
33 Correct 1765 ms 81328 KB Output is correct
34 Correct 652 ms 57600 KB Output is correct
35 Correct 6 ms 14936 KB Output is correct
36 Correct 6 ms 15192 KB Output is correct
37 Correct 6 ms 14936 KB Output is correct
38 Correct 6 ms 14940 KB Output is correct
39 Correct 6 ms 15108 KB Output is correct
40 Correct 8 ms 14936 KB Output is correct
41 Correct 6 ms 14952 KB Output is correct
42 Correct 6 ms 14940 KB Output is correct
43 Correct 6 ms 14940 KB Output is correct
44 Correct 7 ms 14940 KB Output is correct
45 Correct 6 ms 15080 KB Output is correct
46 Correct 6 ms 14940 KB Output is correct
47 Correct 7 ms 14900 KB Output is correct
48 Correct 7 ms 14940 KB Output is correct
49 Correct 7 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 14932 KB Output is correct
2 Correct 1840 ms 89820 KB Output is correct
3 Correct 886 ms 77424 KB Output is correct
4 Correct 1407 ms 85368 KB Output is correct
5 Correct 1277 ms 74164 KB Output is correct
6 Correct 1551 ms 84400 KB Output is correct
7 Correct 1635 ms 84788 KB Output is correct
8 Correct 3066 ms 210120 KB Output is correct
9 Correct 2049 ms 97520 KB Output is correct
10 Correct 1033 ms 77268 KB Output is correct
11 Correct 1906 ms 86188 KB Output is correct
12 Correct 913 ms 66048 KB Output is correct
13 Correct 875 ms 67048 KB Output is correct
14 Correct 857 ms 67652 KB Output is correct
15 Correct 8 ms 14936 KB Output is correct
16 Correct 7 ms 14940 KB Output is correct
17 Correct 10 ms 15100 KB Output is correct
18 Correct 7 ms 14940 KB Output is correct
19 Correct 7 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 14684 KB Output is correct
2 Correct 2115 ms 93628 KB Output is correct
3 Correct 995 ms 75384 KB Output is correct
4 Correct 1482 ms 86844 KB Output is correct
5 Correct 1331 ms 75684 KB Output is correct
6 Correct 1717 ms 84552 KB Output is correct
7 Correct 1743 ms 84404 KB Output is correct
8 Correct 2945 ms 211080 KB Output is correct
9 Correct 1927 ms 97552 KB Output is correct
10 Correct 1002 ms 77816 KB Output is correct
11 Correct 1870 ms 86192 KB Output is correct
12 Correct 902 ms 66428 KB Output is correct
13 Correct 903 ms 67236 KB Output is correct
14 Correct 982 ms 67720 KB Output is correct
15 Correct 6 ms 15092 KB Output is correct
16 Correct 11 ms 15040 KB Output is correct
17 Correct 10 ms 15092 KB Output is correct
18 Correct 7 ms 14940 KB Output is correct
19 Correct 7 ms 14940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 14680 KB Output is correct
2 Correct 6 ms 14940 KB Output is correct
3 Correct 6 ms 14692 KB Output is correct
4 Correct 9 ms 15196 KB Output is correct
5 Correct 9 ms 15184 KB Output is correct
6 Correct 9 ms 15196 KB Output is correct
7 Correct 9 ms 15120 KB Output is correct
8 Correct 9 ms 15708 KB Output is correct
9 Correct 6 ms 14940 KB Output is correct
10 Correct 7 ms 14940 KB Output is correct
11 Correct 8 ms 15092 KB Output is correct
12 Correct 7 ms 14940 KB Output is correct
13 Correct 7 ms 15088 KB Output is correct
14 Correct 7 ms 14920 KB Output is correct
15 Correct 7 ms 14940 KB Output is correct
16 Correct 7 ms 14940 KB Output is correct
17 Correct 7 ms 15076 KB Output is correct
18 Correct 7 ms 14940 KB Output is correct
19 Correct 7 ms 14940 KB Output is correct
20 Correct 10 ms 15192 KB Output is correct
21 Correct 7 ms 14936 KB Output is correct
22 Correct 7 ms 14940 KB Output is correct
23 Correct 7 ms 14940 KB Output is correct
24 Correct 6 ms 15088 KB Output is correct
25 Correct 7 ms 14940 KB Output is correct
26 Correct 7 ms 14940 KB Output is correct
27 Correct 8 ms 14940 KB Output is correct
28 Correct 7 ms 14940 KB Output is correct
29 Correct 6 ms 14684 KB Output is correct
30 Correct 1944 ms 86568 KB Output is correct
31 Correct 677 ms 68860 KB Output is correct
32 Correct 1481 ms 88232 KB Output is correct
33 Correct 1282 ms 76892 KB Output is correct
34 Correct 1507 ms 76392 KB Output is correct
35 Correct 1472 ms 77216 KB Output is correct
36 Correct 2872 ms 209548 KB Output is correct
37 Correct 2013 ms 97704 KB Output is correct
38 Correct 893 ms 79984 KB Output is correct
39 Correct 1845 ms 86360 KB Output is correct
40 Correct 704 ms 68608 KB Output is correct
41 Correct 776 ms 192848 KB Output is correct
42 Correct 804 ms 115940 KB Output is correct
43 Correct 710 ms 82072 KB Output is correct
44 Correct 760 ms 71372 KB Output is correct
45 Correct 705 ms 67312 KB Output is correct
46 Correct 6 ms 14936 KB Output is correct
47 Correct 7 ms 15092 KB Output is correct
48 Correct 7 ms 14936 KB Output is correct
49 Correct 8 ms 14916 KB Output is correct
50 Correct 6 ms 15108 KB Output is correct
51 Correct 7 ms 14684 KB Output is correct
52 Correct 1758 ms 86596 KB Output is correct
53 Correct 671 ms 68888 KB Output is correct
54 Correct 1421 ms 88260 KB Output is correct
55 Correct 1305 ms 76960 KB Output is correct
56 Correct 1541 ms 76964 KB Output is correct
57 Correct 1613 ms 66980 KB Output is correct
58 Correct 2918 ms 208672 KB Output is correct
59 Correct 1837 ms 97028 KB Output is correct
60 Correct 925 ms 77816 KB Output is correct
61 Correct 1765 ms 81328 KB Output is correct
62 Correct 652 ms 57600 KB Output is correct
63 Correct 6 ms 14936 KB Output is correct
64 Correct 6 ms 15192 KB Output is correct
65 Correct 6 ms 14936 KB Output is correct
66 Correct 6 ms 14940 KB Output is correct
67 Correct 6 ms 15108 KB Output is correct
68 Correct 8 ms 14936 KB Output is correct
69 Correct 6 ms 14952 KB Output is correct
70 Correct 6 ms 14940 KB Output is correct
71 Correct 6 ms 14940 KB Output is correct
72 Correct 7 ms 14940 KB Output is correct
73 Correct 6 ms 15080 KB Output is correct
74 Correct 6 ms 14940 KB Output is correct
75 Correct 7 ms 14900 KB Output is correct
76 Correct 7 ms 14940 KB Output is correct
77 Correct 7 ms 14936 KB Output is correct
78 Correct 6 ms 14932 KB Output is correct
79 Correct 1840 ms 89820 KB Output is correct
80 Correct 886 ms 77424 KB Output is correct
81 Correct 1407 ms 85368 KB Output is correct
82 Correct 1277 ms 74164 KB Output is correct
83 Correct 1551 ms 84400 KB Output is correct
84 Correct 1635 ms 84788 KB Output is correct
85 Correct 3066 ms 210120 KB Output is correct
86 Correct 2049 ms 97520 KB Output is correct
87 Correct 1033 ms 77268 KB Output is correct
88 Correct 1906 ms 86188 KB Output is correct
89 Correct 913 ms 66048 KB Output is correct
90 Correct 875 ms 67048 KB Output is correct
91 Correct 857 ms 67652 KB Output is correct
92 Correct 8 ms 14936 KB Output is correct
93 Correct 7 ms 14940 KB Output is correct
94 Correct 10 ms 15100 KB Output is correct
95 Correct 7 ms 14940 KB Output is correct
96 Correct 7 ms 14936 KB Output is correct
97 Correct 7 ms 14684 KB Output is correct
98 Correct 2115 ms 93628 KB Output is correct
99 Correct 995 ms 75384 KB Output is correct
100 Correct 1482 ms 86844 KB Output is correct
101 Correct 1331 ms 75684 KB Output is correct
102 Correct 1717 ms 84552 KB Output is correct
103 Correct 1743 ms 84404 KB Output is correct
104 Correct 2945 ms 211080 KB Output is correct
105 Correct 1927 ms 97552 KB Output is correct
106 Correct 1002 ms 77816 KB Output is correct
107 Correct 1870 ms 86192 KB Output is correct
108 Correct 902 ms 66428 KB Output is correct
109 Correct 903 ms 67236 KB Output is correct
110 Correct 982 ms 67720 KB Output is correct
111 Correct 6 ms 15092 KB Output is correct
112 Correct 11 ms 15040 KB Output is correct
113 Correct 10 ms 15092 KB Output is correct
114 Correct 7 ms 14940 KB Output is correct
115 Correct 7 ms 14940 KB Output is correct
116 Correct 2163 ms 86440 KB Output is correct
117 Correct 1024 ms 68900 KB Output is correct
118 Correct 1724 ms 88228 KB Output is correct
119 Correct 1603 ms 77192 KB Output is correct
120 Correct 1891 ms 85676 KB Output is correct
121 Correct 1858 ms 86180 KB Output is correct
122 Correct 3257 ms 213056 KB Output is correct
123 Correct 2360 ms 97784 KB Output is correct
124 Correct 1206 ms 79904 KB Output is correct
125 Correct 2444 ms 86208 KB Output is correct
126 Correct 1186 ms 69116 KB Output is correct
127 Correct 983 ms 68136 KB Output is correct
128 Correct 942 ms 70036 KB Output is correct
129 Correct 928 ms 70684 KB Output is correct