QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#806032#9862. AntivirusKevin5307AC ✓983ms59220kbC++236.6kb2024-12-08 20:42:202024-12-08 20:42:30

Judging History

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

  • [2024-12-08 20:42:30]
  • 评测
  • 测评结果:AC
  • 用时:983ms
  • 内存:59220kb
  • [2024-12-08 20:42:20]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
namespace domtree
{
	constexpr int MAX = 3e5 + 5;
	constexpr int INF = 0x5ffffff;

	struct E {
	int v, x;
	} e[MAX * 4];

	int n, m, tot, dfc;
	int ans[MAX], dfn[MAX], pos[MAX], sdm[MAX], idm[MAX], fa[MAX], mn[MAX],
		fth[MAX];
	int h[3][MAX * 2];

	void add(int x, int u, int v) {
	e[++tot] = {v, h[x][u]};
	h[x][u] = tot;
	}

	void dfs(int u) {
	dfn[u] = ++dfc;
	pos[dfc] = u;
	for (int i = h[0][u]; i; i = e[i].x) {
		int v = e[i].v;
		if (!dfn[v]) {
		dfs(v);
		fth[v] = u;
		}
	}
	}

	int find(int x) {
	if (fa[x] == x) {
		return x;
	}
	int tmp = fa[x];
	fa[x] = find(fa[x]);
	if (dfn[sdm[mn[tmp]]] < dfn[sdm[mn[x]]]) {
		mn[x] = mn[tmp];
	}
	return fa[x];
	}

	void tar(int st) {
	dfs(st);
	for (int i = 1; i <= n; ++i) {
		mn[i] = fa[i] = sdm[i] = i;
	}
	for (int i = dfc; i >= 2; --i) {
		int u = pos[i], res = INF;
		for (int j = h[1][u]; j; j = e[j].x) {
		int v = e[j].v;
		if (!dfn[v]) {
			continue;
		}
		find(v);
		if (dfn[v] < dfn[u]) {
			res = std::min(res, dfn[v]);
		} else {
			res = std::min(res, dfn[sdm[mn[v]]]);
		}
		}
		sdm[u] = pos[res];
		fa[u] = fth[u];
		add(2, sdm[u], u);
		u = fth[u];
		for (int j = h[2][u]; j; j = e[j].x) {
		int v = e[j].v;
		find(v);
		if (u == sdm[mn[v]]) {
			idm[v] = u;
		} else {
			idm[v] = mn[v];
		}
		}
		h[2][u] = 0;
	}
	for (int i = 2; i <= dfc; ++i) {
		int u = pos[i];
		if (idm[u] != sdm[u]) {
		idm[u] = idm[idm[u]];
		}
	}
	}

	void domtree(int _n,int _m,vector<pii> E)
	{
		tot=dfc=0;
		n=_n;
		m=_m;
		for(int i=0;i<=n+10;i++)
		{
			ans[i]=dfn[i]=pos[i]=0;
			mn[i]=idm[i]=sdm[i]=0;
			fa[i]=fth[i]=0;
		}
		for(int i=0;i<3;i++)
			for(int j=0;j<=n+n+10;j++)
				h[i][j]=0;
		for(auto pr:E)
		{
			add(0,pr.first,pr.second);
			add(1,pr.second,pr.first);
		}
		tar(1);
	}
}
ll c[100100];
int p[100100];
vector<int> G[100100];
ll ans[100100];
int siz[100100],son[100100],tp[100100],dfn[100100],ind[100100],tot;
void dfs1(int u)
{
	siz[u]=1;
	son[u]=0;
	tp[u]=0;
	for(auto v:G[u])
	{
		dfs1(v);
		siz[u]+=siz[v];
		if(siz[v]>siz[son[u]])
			son[u]=v;
	}
}
void dfs2(int u)
{
	if(!tp[u]) tp[u]=u;
	tot++;
	dfn[u]=tot;
	ind[tot]=u;
	if(son[u])
	{
		tp[son[u]]=tp[u];
		dfs2(son[u]);
	}
	for(auto v:G[u])
		if(v!=son[u])
			dfs2(v);
}
namespace segt
{
	#define ls (x<<1)
	#define rs (ls|1)
	ll c[100100<<2];
	ll mn1[100100<<2],mn2[100100<<2];
	ll mx[100100<<2],smx[100100<<2];
	ll add[100100<<2],addmx[100100<<2];
	void build(int x,int l,int r)
	{
		mx[x]=0;
		smx[x]=-1ll*inf*inf;
		mn1[x]=c[x];
		mn2[x]=1ll*inf*inf;
		add[x]=addmx[x]=0;
		if(l==r) return ;
		int mid=(l+r)/2;
		build(ls,l,mid);
		build(rs,mid+1,r);
	}
	void modify(int x,int l,int r,int p,ll vc)
	{
		if(l==r)
		{
			c[x]=vc;
			return ;
		}
		int mid=(l+r)/2;
		if(p<=mid) modify(ls,l,mid,p,vc);
		else modify(rs,mid+1,r,p,vc);
		c[x]=min(c[ls],c[rs]);
	}
	void pushdown(int x,int l,int r)
	{
		if(l!=r)
		{
			if(mx[ls]+addmx[ls]+add[ls]==mx[x])
				addmx[ls]+=addmx[x];
			if(mx[rs]+addmx[rs]+add[rs]==mx[x])
				addmx[rs]+=addmx[x];
			add[ls]+=add[x];
			add[rs]+=add[x];
		}
		mx[x]+=add[x];
		smx[x]+=add[x];
		mx[x]+=addmx[x];
		mn1[x]+=add[x]+addmx[x];
		mn2[x]+=add[x];
		add[x]=0;
		addmx[x]=0;
	}
	void pushup(int x,int l,int r)
	{
		int mid=(l+r)/2;
		pushdown(ls,l,mid);
		pushdown(rs,mid+1,r);
		mx[x]=max(mx[ls],mx[rs]);
		smx[x]=max(smx[ls],smx[rs]);
		mn1[x]=1ll*inf*inf;
		mn2[x]=min(mn2[ls],mn2[rs]);
		if(mx[ls]!=mx[x])
		{
			smx[x]=max(smx[x],mx[ls]);
			mn2[x]=min(mn2[x],mn1[ls]);
		}
		else
			mn1[x]=min(mn1[x],mn1[ls]);
		if(mx[rs]!=mx[x])
		{
			smx[x]=max(smx[x],mx[rs]);
			mn2[x]=min(mn2[x],mn1[rs]);
		}
		else
			mn1[x]=min(mn1[x],mn1[rs]);
	}
	void range_add(int x,int l,int r,int ql,int qr,ll v)
	{
		pushdown(x,l,r);
		if(ql<=l&&r<=qr)
		{
			add[x]+=v;
			return ;
		}
		int mid=(l+r)/2;
		if(ql<=mid) range_add(ls,l,mid,ql,qr,v);
		if(qr>mid) range_add(rs,mid+1,r,ql,qr,v);
		pushup(x,l,r);
	}
	void update(int x,int l,int r,int ql,int qr,ll v)
	{
		pushdown(x,l,r);
		if(v>=mx[x]) return ;
		if(ql<=l&&r<=qr)
		{
			if(v>smx[x])
			{
				addmx[x]+=v-mx[x];
				return ;
			}
			else
			{
				int mid=(l+r)/2;
				update(ls,l,mid,ql,qr,v);
				update(rs,mid+1,r,ql,qr,v);
				pushup(x,l,r);
				return ;
			}
		}
		int mid=(l+r)/2;
		if(ql<=mid) update(ls,l,mid,ql,qr,v);
		if(qr>mid) update(rs,mid+1,r,ql,qr,v);
		pushup(x,l,r);
	}
	ll query(int x,int l,int r,int ql,int qr)
	{
		pushdown(x,l,r);
		if(l==ql&&r==qr) return min(mn1[x],mn2[x]);
		int mid=(l+r)/2;
		if(qr<=mid) return query(ls,l,mid,ql,qr);
		if(ql>mid) return query(rs,mid+1,r,ql,qr);
		return min(query(ls,l,mid,ql,mid),query(rs,mid+1,r,mid+1,qr));
	}
	#undef ls
	#undef rs
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		int n,m,q;
		cin>>n>>m>>q;
		vector<pii> E;
		for(int i=1;i<=m;i++)
		{
			int u,v;
			cin>>u>>v;
			E.pb(v,u);
		}
		domtree::domtree(n,m,E);
		for(int i=1;i<=n;i++)
			cin>>c[i];
		for(int i=1;i<=n;i++)
			G[i].clear();
		for(int i=2;i<=n;i++)
		{
			p[i]=domtree::idm[i];
			G[p[i]].pb(i);
		}
		tot=0;
		dfs1(1);
		dfs2(1);
		for(int i=1;i<=n;i++)
			segt::modify(1,1,n,dfn[i],c[i]);
		segt::build(1,1,n);
		for(int i=1;i<=q;i++)
		{
			int u;
			ll cost;
			cin>>u>>cost;
			ans[i]=ans[i-1]+cost;
			int tmp=u;
			vector<pii> vec;
			while(tmp)
			{
				int L=dfn[tp[tmp]];
				int R=dfn[tmp];
				vec.pb(L,R);
				tmp=p[tp[tmp]];
			}
			srt(vec);
			for(auto pr:vec)
				ans[i]=min(ans[i],segt::query(1,1,n,pr.first,pr.second));
			int cur=1;
			for(auto pr:vec)
			{
				if(cur<pr.first)
					segt::range_add(1,1,n,cur,pr.first-1,cost);
				cur=pr.second+1;
			}
			if(cur<=n)
				segt::range_add(1,1,n,cur,n,cost);
			segt::update(1,1,n,1,n,ans[i]);
			cout<<ans[i]<<" ";
		}
		cout<<'\n';
	}
	return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 38688kb

input:

3
7 6 4
2 1
3 1
4 2
5 2
6 3
7 3
4 3 5 2 2 1 1
4 2
5 2
6 2
7 2
5 6 4
1 3
3 2
2 1
4 2
5 4
2 5
10000 10000 2 100 5
5 1000
4 1000
3 1000
4 1000
4 4 1
2 1
3 1
4 2
4 3
100 1 1 100
4 10

output:

2 3 4 4 
5 100 102 202 
10 

result:

ok 9 numbers

Test #2:

score: 0
Accepted
time: 80ms
memory: 36356kb

input:

10000
10 15 10
5 4
4 8
8 1
9 1
3 1
7 10
2 4
2 8
10 9
8 1
3 2
8 9
6 3
9 6
9 7
109573034 995191779 629441974 818963404 427826881 504492389 571193150 526828914 397022133 261597684
10 372333138
2 502585557
6 146333017
6 522319681
10 272972971
9 958277860
6 81039902
10 30321248
6 459502525
6 753468360
10...

output:

109573034 109573034 109573034 109573034 109573034 109573034 109573034 109573034 109573034 109573034 
302793882 302793882 302793882 302793882 392542446 392542446 392542446 392542446 392542446 392542446 
14673922 527692254 527692254 527692254 527692254 527692254 527692254 527692254 527692254 527692254...

result:

ok 100000 numbers

Test #3:

score: 0
Accepted
time: 79ms
memory: 36456kb

input:

10000
10 20 10
7 4
6 1
5 1
4 6
10 1
8 7
10 6
10 7
6 5
5 7
7 3
3 10
9 5
8 1
2 3
2 7
5 1
10 5
6 9
4 10
714813381 27732963 16286651 18609639 333483693 125576688 108264816 25878619 235574069 240050850
7 567613610
3 232248158
3 248483123
2 509643192
2 429418762
8 740634945
5 452715309
3 823602753
5 40063...

output:

108264816 124551467 124551467 152284430 152284430 178163049 511646742 527933393 567997344 676262160 
26807100 86723092 172308368 220150563 220150563 220150563 220150563 220150563 220150563 220150563 
219954028 315305437 315305437 535259465 630610874 660050539 660050539 755829134 757689273 787417404 ...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 133ms
memory: 38440kb

input:

1000
100 200 100
100 85
25 41
51 60
80 53
35 3
85 3
60 9
80 77
45 84
74 87
9 4
49 94
99 86
95 35
80 42
62 43
38 56
10 29
69 23
30 67
72 13
43 11
69 5
9 40
65 1
19 17
13 61
58 11
92 87
33 16
13 86
24 9
51 18
46 74
28 45
91 3
6 39
67 13
63 72
58 43
50 49
34 16
67 16
46 30
39 33
4 30
13 41
61 45
54 49
...

output:

64935453 70965771 71328539 84563196 101126032 182452343 183929386 189086513 189449281 198674817 212642620 458896124 486583003 502334898 504091090 504300836 533836295 535592487 552248176 557405303 598430396 604669787 615853847 621911960 628151351 628514119 637212958 640828512 670009009 670009009 6700...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 174ms
memory: 38572kb

input:

100
1000 2000 1000
580 434
648 991
698 983
127 160
396 673
132 546
769 964
619 11
930 346
927 295
346 781
790 225
346 153
771 540
417 831
278 938
831 162
334 468
181 1000
430 926
825 836
111 425
454 139
664 213
541 742
82 324
910 567
937 941
933 54
478 602
465 223
90 800
678 250
446 455
15 87
682 22...

output:

147981 6057285 6763519 8324914 12134004 60851566 61199876 61783409 62637532 62718179 63255476 64828340 73262762 77883615 78817240 79419339 79446296 79502338 79951733 81341716 81847946 87020064 88412512 89728687 90965454 91926421 93371746 94054227 115092673 122095986 125048869 125323752 125381706 125...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 236ms
memory: 41836kb

input:

10
10000 20000 10000
6196 1463
7511 8792
2131 9398
896 3914
2977 9715
6897 4298
2547 1947
6436 5395
7836 2909
2278 5947
3783 1405
3177 9748
6280 348
3913 6678
5250 5153
5850 3470
1235 1974
6303 8570
6185 2060
6435 3492
2333 2856
9193 8923
8003 4365
5334 9689
632 3118
591 4799
1339 3380
6453 5082
546...

output:

32265 618864 632948 737344 761241 789193 894444 1076258 1164521 1999194 2175573 3059944 3064809 3127704 3154368 3159912 3180311 3261891 3409778 3424562 3489319 3567017 3724551 3781325 3795404 4402433 4405941 4694408 4786783 4854528 4862930 4868817 8159854 8201632 8280925 8903595 8988190 9055965 9132...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 333ms
memory: 56896kb

input:

1
100000 200000 100000
40517 64052
42036 17071
37780 52362
86808 24357
89653 74468
42769 89912
71292 44370
31818 78852
84553 7078
3258 9500
11388 52056
42673 78015
49296 65204
28466 57602
7547 75680
14931 13489
16195 25975
62425 71782
80892 83445
82033 10050
66265 86587
38331 88357
31078 89962
71594...

output:

26734 28727 30146 32253 40375 60341 62478 89325 97996 107091 111825 114407 127041 149531 167269 170485 192794 194176 287594 295279 1958976 1963133 1970337 1974055 2001413 2040525 2041839 2050592 2056769 2073363 2082803 2097474 2109669 2115430 2121140 2128333 2130757 2134698 2139041 2153097 2156553 2...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 314ms
memory: 57536kb

input:

1
100000 200000 100000
25508 70004
75638 20043
9718 63526
72022 95936
67619 1003
72446 94411
81273 13282
46237 792
20571 5800
39511 20749
49117 47811
50770 63360
8275 45957
39364 93191
58638 12759
61325 83734
88743 54563
38117 13205
73526 97285
16986 55135
53169 50475
54520 93704
52603 49792
70981 6...

output:

6712 8811 18673 146439 148477 159530 179664 183150 200509 207081 210705 217659 392494 398902 523814 533774 538904 643470 652198 657065 684906 711954 720312 730309 730445 734121 750887 758464 762948 763257 768740 786682 816667 817596 830156 830782 832982 835062 839670 864485 929425 963164 990181 9922...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 320ms
memory: 56068kb

input:

1
100000 200000 100000
75856 57750
8144 79846
28171 90761
13047 34611
78592 97801
5906 38255
91274 89885
89207 22354
22251 53722
6474 56452
84774 35973
15069 63667
57488 44746
60179 32774
58536 66648
99558 82642
87314 43045
68171 37631
2068 1390
80865 22136
67893 86088
75465 89141
61251 85318
31456 ...

output:

2244 16182 17234 28317 31234 59554 60500 70910 76218 142863 968630 984604 987249 991130 1001000 1003272 1021359 1068894 1080866 1082961 1085257 1092172 1097682 1098282 2517218 2519542 2524451 2526013 2532190 2536494 2539806 2570432 2570700 2583774 2584880 2608937 2780046 2786320 2786647 2795545 2796...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 320ms
memory: 55772kb

input:

1
100000 200000 100000
45607 5725
95112 13728
81881 72369
78757 85639
10861 30074
27959 66414
15097 75809
67672 37380
3790 11649
74901 58793
16241 80379
13306 90613
25775 40577
30763 57210
37307 90450
8851 4115
73856 82785
55235 48774
54117 6814
49289 47070
49068 56982
33549 77041
15736 3653
64862 7...

output:

619993 628617 635757 712308 720211 723292 727320 731194 1025759 1039054 1183571 1193900 1195946 1203339 1205149 1206292 1210172 1214743 1216525 1220888 1312607 1313732 1323200 1329014 1332177 1333282 1334281 1340105 1340306 1375844 1379377 1381848 1385940 1386565 1387775 1390955 1402512 1405435 1422...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 313ms
memory: 56484kb

input:

1
100000 200000 100000
34214 81103
61485 84618
7161 64013
99501 74874
56237 31133
57821 96960
56325 61862
93452 5171
18438 80922
76442 93785
80586 59332
42275 62691
89623 63452
29309 99496
30469 60837
13118 40588
78498 43331
15988 14693
2388 54972
81369 78712
69487 47884
82691 40779
82137 98114
1546...

output:

19377 20242 28749 34862 43579 62503 106728 205407 214228 271605 293174 297448 299913 307477 311790 354770 360534 368977 376060 381262 384122 397659 405819 408293 419085 420800 430308 439899 440516 444206 448763 454873 472848 473155 541829 548985 549713 572046 619426 622578 627023 639054 648453 65989...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 222ms
memory: 37556kb

input:

10
10000 9999 9999
7761 8505
3944 3673
7338 9501
9031 4052
1975 8230
2065 7295
6727 9867
6961 4940
6860 5756
5791 5557
2589 933
8349 5891
6455 5423
4556 5912
8005 1626
8236 7115
780 422
4403 9199
4631 1429
5098 799
839 9641
3800 5646
4832 7155
1691 8553
9188 7191
3023 9469
318 4448
465 4853
4714 93
...

output:

28167 85044 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 17706309 ...

result:

ok 99990 numbers

Test #13:

score: 0
Accepted
time: 302ms
memory: 57348kb

input:

1
100000 99999 99999
6296 13416
40856 99982
77418 735
83419 54826
46876 92865
24478 83125
64008 57977
20939 91086
7709 90399
15198 4452
42269 34425
83724 20659
6319 41157
9422 54263
71815 33006
40460 64075
39832 83092
23050 22944
71586 72307
80950 19277
99720 483
4124 97865
22245 27145
93957 79618
5...

output:

11183 9395822 9395822 9400367 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 12279642 ...

result:

ok 99999 numbers

Test #14:

score: 0
Accepted
time: 275ms
memory: 56524kb

input:

1
100000 99999 99999
41599 51389
80642 57058
4610 59691
53781 53430
21549 85283
86646 1292
15260 27952
56098 69644
36659 93526
1866 95885
45956 97523
92945 45561
1238 55479
81755 60616
83871 90510
31736 15501
23962 96177
3710 94534
1920 99950
16207 48270
61169 75988
13870 76680
8859 4115
93802 53555...

output:

10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10737729 10744574 10752080 10753043 10758950 10786032 10786543 10792764 10815164 10822948 10945183 10945183 10945183 10945183 10945183 10945183 10945183 10945183 10945183 10945183 109...

result:

ok 99999 numbers

Test #15:

score: 0
Accepted
time: 257ms
memory: 59220kb

input:

1
100000 99999 99999
69552 81325
29339 46636
60241 52439
21904 43472
32396 88893
68363 81529
26228 54771
43086 31837
63398 64092
9186 86980
28551 77600
81698 30519
55349 54776
40813 64966
78196 75720
27804 46023
13360 93887
34524 65224
89025 53277
10351 8099
12964 79463
14807 31100
59111 7054
21174 ...

output:

6411390 6411390 6411390 6416853 6498795 8046171 8055187 8064669 10751767 10751767 10751767 10751767 10751767 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10974147 10...

result:

ok 99999 numbers

Test #16:

score: 0
Accepted
time: 274ms
memory: 41580kb

input:

10
10000 9999 9999
6304 177
9290 5667
4456 5225
7073 951
9644 5452
2213 1219
8520 2663
3656 6082
2482 2177
1992 2366
1680 1439
3037 2347
1670 9330
8052 4789
2591 7293
9531 7339
6714 3193
7142 540
5498 5385
4504 8442
3614 8421
3053 3082
3887 9934
3487 8288
127 4796
294 1429
2123 7993
6197 3719
6084 8...

output:

176780 4042271 4042271 4196329 4233477 126063463 126063463 126063463 126063463 126063463 126404969 126623458 128594183 128679154 128917104 128970240 128974813 128977719 129023819 129145262 130810693 130877263 131092767 131384195 135943840 135943840 135943840 135973734 140533379 140533379 140551935 1...

result:

ok 99990 numbers

Test #17:

score: 0
Accepted
time: 369ms
memory: 55796kb

input:

1
100000 99999 99999
84861 72308
98771 35981
62693 28557
87570 29894
84930 44017
33747 74112
54091 1538
6583 49820
60656 88373
41231 57844
49295 31586
3364 12646
22396 81200
14514 54457
22126 75780
17397 60158
67877 70986
42425 15990
59555 46169
75025 69735
11255 52109
32302 5559
68353 46431
10687 9...

output:

384 10235 745394 750207 3640677 5762057 5765625 8809578 12140184 12492215 16771813 18698262 18703700 18712737 18716026 18750949 23490596 23490596 23490596 23490596 23941266 23945847 26346019 28305810 28337150 28345875 31500543 31502439 31509411 31520335 33059074 33063007 33096256 35326853 35326853 3...

result:

ok 99999 numbers

Test #18:

score: 0
Accepted
time: 304ms
memory: 55476kb

input:

1
100000 99999 99999
74573 61528
89747 63719
74205 87153
49920 69002
63075 64452
66675 82478
52520 16834
22290 48022
36649 3016
16088 23446
18091 65389
16935 98307
44455 41239
82597 37216
46414 93350
95081 3269
82386 53717
2044 94956
9984 43369
71251 28532
46020 47501
46304 84601
34762 65963
80549 6...

output:

21773 22384 5239186 5239186 5239186 5245757 6445150 6445150 6446550 6474144 8875725 8897774 8910616 8912218 11564511 11576794 15100107 19937784 19939952 20932454 20937055 20944953 21790728 21792036 21799857 21809510 21826494 21833371 21838361 23718560 23745307 23765753 24414660 24422522 29639324 296...

result:

ok 99999 numbers

Test #19:

score: 0
Accepted
time: 277ms
memory: 56992kb

input:

1
100000 99999 99999
62434 43660
46776 39730
80278 28275
86847 48823
51085 47167
72544 5694
68065 36311
90256 44091
13588 84576
40712 80837
6488 80765
54154 37906
1511 63070
9051 50992
77789 42160
80243 79618
8598 81427
43300 32425
12470 66259
99776 95431
93220 53979
35938 24946
74557 77705
51473 71...

output:

4707 2181115 4247113 4252707 4262127 4264258 8739918 11725567 11726085 13396290 13396290 13396290 17442689 17871950 17977108 21244267 23644026 28119686 28128221 30304629 32603881 32941406 34124345 34125296 34134391 34135495 38611155 43334377 47868717 47868717 47880738 50057146 50061744 52150816 5282...

result:

ok 99999 numbers

Test #20:

score: 0
Accepted
time: 239ms
memory: 43748kb

input:

10
10000 9999 9999
9638 1
2091 8776
8777 1
437 1
9756 4312
6619 1
6355 5408
6246 9915
3144 987
3172 1
1136 1
7380 3820
71 2040
6986 9465
8695 9801
788 8172
6969 1
2954 2303
3638 1
5168 4738
6 1
7418 9411
7932 7678
4682 1
9773 7637
211 1
3548 1
5392 1
5724 1
9574 131
3924 1
1898 6197
3083 9719
756 1
...

output:

51725 346005 381966 450188 535556 880262 961754 1032929 1034412 1084714 1184781 1267663 1316312 1551235 1561695 1575130 1611862 1639566 1750340 1756883 1765048 1789117 1844363 1930059 1933269 1946003 1986314 2063675 2131309 2148785 2350835 2425745 2468575 2492428 2495955 2635809 2783617 2905463 3003...

result:

ok 99990 numbers

Test #21:

score: 0
Accepted
time: 314ms
memory: 52364kb

input:

1
100000 99999 99999
493 1
31592 1
10575 45254
32599 23007
18687 1
82032 15540
58095 1
30841 33978
29578 1
13023 57263
9879 1
76097 93562
55029 89168
39021 1
99275 6312
76653 1
10007 1
68797 60922
87732 56943
60049 1
24179 35417
69765 22800
58393 1
85031 54077
90554 39617
11652 45320
43543 1
81825 1...

output:

15371 22708 31786 44554 49746 53411 65977 66461 67870 70567 71020 77734 88627 90171 98302 102344 106627 144852 155974 158274 161076 165801 174918 179482 183481 184586 190037 193692 203606 206593 210330 214839 232238 237033 239757 247470 252914 274656 296809 299808 312957 316888 320522 331267 345032 ...

result:

ok 99999 numbers

Test #22:

score: 0
Accepted
time: 329ms
memory: 53144kb

input:

1
100000 99999 99999
22641 67268
66453 1
34467 19355
58748 90440
60136 68473
5041 1
50518 1
17241 1
5886 1
43792 1
17387 1
70273 1
30448 1
59338 1
68702 1
24498 18340
51068 42791
56644 1
50267 1
41720 31098
10020 17826
50681 1
4900 80354
74669 1
89968 22110
19000 97750
47640 1
51524 15975
52257 9843...

output:

3940 16407 19870 25723 32841 48247 53558 56418 61829 93933 100547 109877 112617 112909 113783 128645 129868 134303 141310 142675 149200 151029 206694 218316 224257 230760 235777 241302 264066 423469 428274 431797 446818 465045 472532 474836 492524 494370 502798 503488 506996 512478 515583 533088 540...

result:

ok 99999 numbers

Test #23:

score: 0
Accepted
time: 308ms
memory: 53640kb

input:

1
100000 99999 99999
56868 1
88114 1
73681 10511
61435 40178
72122 1
9770 78914
54681 1
35152 1
31039 5715
36959 1
38907 6387
71158 1
94938 1
91622 1
35809 90155
85477 1
39692 56449
26271 49071
33916 86549
60427 1
71766 3220
96174 88225
34761 12291
72521 1
36122 69393
64869 77230
29321 1
12070 1
153...

output:

6376 13198 13843 252581 253421 256869 260753 267016 273449 279732 285336 287460 287774 293574 302254 307670 325324 325676 350518 352148 362719 365492 369134 374411 376031 380773 419964 423417 424816 438755 447752 449890 465935 495310 497498 498233 516548 527094 535967 540163 543715 544729 545511 555...

result:

ok 99999 numbers

Test #24:

score: 0
Accepted
time: 568ms
memory: 39628kb

input:

10
10000 9999 9999
4270 1100
5513 5252
5517 3334
643 6481
7063 3943
8548 1223
1410 3925
7136 520
3535 703
4251 3280
4462 6929
5193 9830
9596 8087
2183 1736
2733 2720
3094 8982
6584 3877
2160 4529
807 4161
5917 9356
5841 231
6331 7421
6236 996
3497 5471
4871 6851
5215 7749
9839 3294
6973 8670
6053 39...

output:

42908 51736 281589 288668 337995 343085 349996 368386 407350 510765 663247 696637 726430 834977 1029898 1064952 1113449 1512147 1583856 1981303 10248305 10248305 10384136 10717192 10730609 10746853 10750278 10989614 11053880 11150430 12838651 12863316 12871442 12901991 13018872 13694193 13719597 137...

result:

ok 99990 numbers

Test #25:

score: 0
Accepted
time: 972ms
memory: 52632kb

input:

1
100000 99999 99999
84098 77135
11865 76825
3397 66194
23361 35772
24618 69950
56566 38393
37841 72489
51955 52967
1889 53852
33207 22536
69718 17248
78507 93973
73124 55523
41421 27810
74933 15051
46401 14510
79023 51137
62616 95992
10083 51634
50828 53370
66230 76404
77516 88458
34431 34381
45102...

output:

6757 7940 13537 35131 37259 39248 40135 109405 151662 639895 659579 661859 664020 665141 688873 718803 730250 775504 779279 784826 836216 844197 849281 855140 862718 886309 932949 960470 992899 996247 1017478 1041142 1043689 1048817 1056989 1091236 1091471 1096129 1097858 1106333 1107323 1118280 114...

result:

ok 99999 numbers

Test #26:

score: 0
Accepted
time: 970ms
memory: 53148kb

input:

1
100000 99999 99999
435 34640
45328 3373
92021 75220
66927 71579
64414 11043
56902 69386
7246 69788
67536 81405
2532 19200
89152 4555
42910 12253
60444 66389
91369 48080
46717 72737
42984 18904
85853 71657
83193 6055
37274 25175
6844 13450
23195 44256
31295 22347
58211 83113
14595 45139
46205 10221...

output:

10443 113422 136658 157490 169924 172403 181714 188709 305645 308009 311392 380725 388746 397666 419945 432943 455374 456261 460017 471740 474187 483830 492619 499663 511694 542263 543336 588117 713069 717318 722012 736570 742382 787024 788965 809074 817893 820134 822111 825525 831071 893250 901060 ...

result:

ok 99999 numbers

Test #27:

score: 0
Accepted
time: 983ms
memory: 53952kb

input:

1
100000 99999 99999
98867 2559
52899 68196
66542 6562
85784 47893
81433 22034
24663 29406
80017 5969
53683 71589
84681 68455
14459 31688
8706 27736
97372 67696
33772 67537
5012 66192
37902 4285
39971 72225
88286 10112
28982 90116
93971 67030
47327 90004
65969 86210
65581 51682
21668 13503
36649 711...

output:

7801 11708 17288 22185 22655 24078 25163 36128 150331 156860 161907 165659 229299 243831 252104 276593 285329 294310 296443 299345 301518 305861 306911 330869 348979 465769 468297 487466 670884 673974 727119 728287 732245 733379 753001 762557 763013 771652 772002 773611 781283 788537 798708 810630 8...

result:

ok 99999 numbers

Extra Test:

score: 0
Extra Test Passed