QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96249#125. Wild Boartricyzhkx47 294ms426504kbC++143.3kb2023-04-13 18:01:092023-04-13 18:01:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 18:01:11]
  • 评测
  • 测评结果:47
  • 用时:294ms
  • 内存:426504kb
  • [2023-04-13 18:01:09]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18;
struct Info
{
	ll d;
	int a,b;
	Info(ll _d=0,int _a=0,int _b=0):d(_d),a(_a),b(_b){}
	bool operator<(const Info &x)const{return d<x.d;}
}val[2010][2010][4],sum[300010][4];
struct node2
{
	int v;ll w;
	node2(int _v=0,ll _w=0):v(_v),w(_w){}
	bool operator<(const node2 &a)const{return w>a.w;}
};
int n,m,cnt,X[100010],head[2010],to[4010],edge[4010],nxt[4010],tot=1;
ll dis[4010][4010];
vector<Info> vec[2010][2010];
vector<pair<int,int>> G[10010];
void addedge(int u,int v,int w)
{
	to[++tot]=v;
	edge[tot]=w;
	nxt[tot]=head[u];
	head[u]=tot;
}
void add(int u,int v,int w){G[u].emplace_back(v,w);}
void Dij(int s)
{
	static bool vis[10010];
	static priority_queue<node2> que;
	static ll _dis[10010];
	fill(_dis+1,_dis+cnt+1,INF);
	memset(vis+1,0,sizeof(bool)*cnt);
	_dis[s]=edge[s];que.emplace(s,_dis[s]);
	while(!que.empty())
	{
		node2 t=que.top();que.pop();
		if(vis[t.v]) continue;
		int u=t.v;vis[u]=1;
		for(auto p:G[u])
		{
			int v=p.first,w=p.second;
			if(_dis[v]>_dis[u]+w) _dis[v]=_dis[u]+w,que.emplace(v,_dis[v]);
		}
	}
	memcpy(dis[s]+2,_dis+2,sizeof(ll)*2*m);
}
void calc(vector<Info> vec,Info *val)
{
	sort(vec.begin(),vec.end());
	fill(val,val+4,Info(INF,0,0));
	int sz=vec.size();
	if(!sz) return;
	val[0]=vec[0];
	for(int i=1;i<sz;i++)
		if(vec[i].a!=val[0].a && vec[i].b!=val[0].b)
		{
			val[1]=vec[i];
			break;
		}
	for(int i=1;i<sz;i++)
		if(vec[i].a!=val[0].a && vec[i].b!=val[1].b)
		{
			val[2]=vec[i];
			break;
		}
	for(int i=1;i<sz;i++)
		if(vec[i].a!=val[1].a && vec[i].b!=val[0].b)
		{
			val[3]=vec[i];
			break;
		}
}
void merge(Info *v,Info *v1,Info *v2)
{
	vector<Info> vec;
	for(int i=0;i<4;i++)if(v1[i].a)
		for(int j=0;j<4;j++)if(v2[j].a)
			if(v1[i].b!=v2[j].a)
				vec.emplace_back(v1[i].d+v2[j].d,v1[i].a,v2[j].b);
	calc(vec,v);
}
void build(int rt,int l,int r)
{
	if(l==r)
	{
		for(int i=0;i<4;i++) sum[rt][i]=val[X[l]][X[l+1]][i];
		return;
	}
	int mid=(l+r)/2;
	build(rt*2,l,mid);build(rt*2+1,mid+1,r);
	merge(sum[rt],sum[rt*2],sum[rt*2+1]);
}
void update(int rt,int l,int r,int x)
{
	if(l==r)
	{
		for(int i=0;i<4;i++) sum[rt][i]=val[X[l]][X[l+1]][i];
		return;
	}
	int mid=(l+r)/2;
	if(x<=mid) update(rt*2,l,mid,x);
	else update(rt*2+1,mid+1,r,x);
	merge(sum[rt],sum[rt*2],sum[rt*2+1]);
}
int main()
{
	int q,L,u,v,w;
	cin>>n>>m>>q>>L;cnt=2*m+1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d%d",&u,&v,&w);
		addedge(u,v,w);addedge(v,u,w);
	}
	for(int u=1;u<=n;u++)
	{
		int in=0,out=0;
		for(int i=head[u];i;i=nxt[i])
		{
			int w=edge[i];
			if(out) add(out,i,w),add(i^1,in,0);
			add(i^1,++cnt,0);
			if(out) add(out,cnt,0);
			out=cnt;
			add(++cnt,i,w);
			if(in) add(cnt,in,0);
			in=cnt;
		}
	}
	for(int i=2;i<=2*m+1;i++) Dij(i);
	for(int i=2;i<=2*m+1;i++)
		for(int j=2;j<=2*m+1;j++)
			if(dis[i][j]<INF)
				vec[to[i^1]][to[j]].emplace_back(dis[i][j],to[i],to[j^1]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			calc(vec[i][j],val[i][j]);
	for(int i=1;i<=L;i++) scanf("%d",&X[i]);
	build(1,1,L-1);
	while(q--)
	{
		scanf("%d%d",&u,&v);X[u]=v;
		if(u<L) update(1,1,L-1,u);
		if(u>1) update(1,1,L-1,u-1);
		ll ans=sum[1][0].d;
		if(ans<INF) printf("%lld\n",ans);
		else puts("-1");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 28ms
memory: 372816kb

input:

5 5 1 10
1 4 10
2 4 2
2 5 4
3 5 4
4 5 7
2
4
5
3
5
3
5
4
2
1
10 1

output:

-1

result:

ok single line: '-1'

Test #2:

score: 0
Accepted
time: 36ms
memory: 373004kb

input:

5 10 1 10
1 2 8
1 3 5
1 4 2
1 5 1
2 3 7
2 4 9
2 5 6
3 4 10
3 5 10
4 5 6
4
2
4
3
5
3
1
4
3
5
3 5

output:

64

result:

ok single line: '64'

Test #3:

score: 0
Accepted
time: 26ms
memory: 373092kb

input:

5 10 1 10
1 2 8
1 3 4
1 4 2
1 5 10
2 3 10
2 4 10
2 5 6
3 4 10
3 5 2
4 5 10
5
1
2
1
4
5
1
5
3
1
8 4

output:

60

result:

ok single line: '60'

Test #4:

score: 0
Accepted
time: 52ms
memory: 371000kb

input:

6 10 1 10
1 3 3
1 4 5
1 5 9
1 6 10
2 3 4
2 5 5
2 6 1
3 6 4
4 6 6
5 6 8
4
3
6
4
1
3
6
4
3
5
1 1

output:

48

result:

ok single line: '48'

Test #5:

score: 0
Accepted
time: 45ms
memory: 372968kb

input:

6 10 1 10
1 2 10
1 3 9
1 5 6
1 6 9
2 4 3
2 5 4
2 6 9
3 5 2
4 5 6
4 6 8
4
6
2
3
2
3
1
3
5
4
9 1

output:

86

result:

ok single line: '86'

Test #6:

score: 0
Accepted
time: 37ms
memory: 373020kb

input:

6 10 1 10
1 2 7
1 4 10
1 5 9
1 6 9
2 3 7
2 4 3
3 4 1
3 5 4
4 6 2
5 6 3
6
3
1
3
6
4
6
4
3
1
5 2

output:

61

result:

ok single line: '61'

Test #7:

score: 0
Accepted
time: 65ms
memory: 371016kb

input:

7 10 1 10
1 2 4
1 3 8
1 5 10
1 7 5
2 5 5
2 7 4
3 4 8
3 6 9
4 7 6
5 6 9
2
1
2
1
2
1
2
1
2
1
9 2

output:

56

result:

ok single line: '56'

Test #8:

score: 0
Accepted
time: 59ms
memory: 371020kb

input:

7 10 1 10
1 4 8
1 5 9
1 6 5
1 7 5
2 4 1
2 6 9
2 7 6
3 5 5
3 7 2
5 6 7
6
5
3
4
6
3
6
4
7
4
4 4

output:

88

result:

ok single line: '88'

Test #9:

score: 0
Accepted
time: 57ms
memory: 372952kb

input:

7 10 1 10
1 3 1
1 4 5
1 5 8
2 3 4
2 7 9
3 4 8
3 7 5
4 5 1
5 6 8
6 7 2
6
5
2
5
6
5
6
5
7
6
4 3

output:

84

result:

ok single line: '84'

Test #10:

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

input:

7 10 1 10
1 3 4
1 4 3
1 5 7
1 6 5
1 7 2
2 3 8
2 4 6
4 7 7
5 6 10
6 7 4
3
2
3
1
3
1
3
1
3
2
9 3

output:

90

result:

ok single line: '90'

Test #11:

score: 0
Accepted
time: 28ms
memory: 373048kb

input:

8 10 1 10
1 2 4
1 7 4
1 8 7
2 3 7
2 4 2
3 7 5
3 8 8
4 5 5
5 6 5
6 8 3
3
5
7
5
6
3
5
3
6
4
9 2

output:

105

result:

ok single line: '105'

Test #12:

score: 0
Accepted
time: 25ms
memory: 372944kb

input:

8 10 1 10
1 3 6
1 7 3
1 8 1
2 3 10
2 4 6
2 8 9
3 5 3
4 6 5
5 7 7
6 8 7
5
2
6
8
4
5
2
5
3
6
10 7

output:

114

result:

ok single line: '114'

Test #13:

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

input:

8 10 1 10
1 2 6
1 3 9
1 6 7
2 8 6
3 5 10
4 6 4
4 7 1
4 8 8
5 7 7
6 8 9
2
8
5
6
2
3
5
6
4
8
3 5

output:

125

result:

ok single line: '125'

Test #14:

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

input:

8 10 1 10
1 2 5
1 5 8
1 8 3
2 6 5
2 7 8
3 4 5
3 8 4
4 6 4
5 6 1
5 7 5
7
4
5
1
6
4
7
4
8
6
10 1

output:

99

result:

ok single line: '99'

Test #15:

score: 0
Accepted
time: 40ms
memory: 373016kb

input:

9 10 1 10
1 3 1
1 6 6
1 9 6
2 4 5
2 9 3
3 5 4
4 5 10
6 7 6
7 8 8
8 9 6
3
5
2
6
2
8
5
1
3
7
2 8

output:

189

result:

ok single line: '189'

Test #16:

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

input:

9 10 1 10
1 8 9
1 9 5
2 6 8
2 7 10
3 5 8
3 7 5
4 5 3
4 8 4
5 9 7
6 9 9
4
7
5
2
7
5
8
4
6
1
7 2

output:

217

result:

ok single line: '217'

Test #17:

score: 0
Accepted
time: 35ms
memory: 370996kb

input:

9 10 1 10
1 4 8
1 9 10
2 3 3
2 5 10
3 9 1
4 8 5
5 7 6
6 7 2
6 8 7
8 9 10
2
9
6
4
5
8
6
3
9
3
4 7

output:

116

result:

ok single line: '116'

Test #18:

score: 0
Accepted
time: 36ms
memory: 372960kb

input:

9 10 1 10
1 3 6
1 4 1
2 4 1
2 6 7
3 4 6
3 9 1
5 6 2
5 8 6
7 8 8
7 9 9
1
6
7
6
9
7
1
5
9
3
7 6

output:

155

result:

ok single line: '155'

Test #19:

score: 0
Accepted
time: 36ms
memory: 372928kb

input:

10 10 1 10
1 3 6
1 9 5
2 4 4
2 6 2
3 4 10
5 8 1
5 10 7
6 7 8
7 10 2
8 9 8
10
3
10
9
1
2
8
4
7
4
2 3

output:

196

result:

ok single line: '196'

Test #20:

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

input:

10 10 1 10
1 4 5
1 8 6
2 8 9
2 9 7
3 9 4
3 10 3
4 7 5
5 6 10
5 10 10
6 7 8
9
5
4
6
5
8
2
8
9
8
3 9

output:

284

result:

ok single line: '284'

Test #21:

score: 0
Accepted
time: 49ms
memory: 373024kb

input:

5 10 1 10
1 2 1
1 3 7
1 4 6
1 5 10
2 3 2
2 4 4
2 5 5
3 4 1
3 5 10
4 5 3
2
1
5
1
4
2
5
4
1
5
7 5

output:

45

result:

ok single line: '45'

Test #22:

score: 0
Accepted
time: 27ms
memory: 373020kb

input:

5 10 1 10
1 2 4
1 3 10
1 4 5
1 5 6
2 3 2
2 4 1
2 5 1
3 4 9
3 5 10
4 5 10
4
2
3
1
4
3
1
3
2
3
10 1

output:

49

result:

ok single line: '49'

Test #23:

score: 0
Accepted
time: 47ms
memory: 373044kb

input:

5 10 1 10
1 2 10
1 3 8
1 4 2
1 5 10
2 3 7
2 4 2
2 5 4
3 4 3
3 5 7
4 5 1
3
1
2
4
5
4
3
2
5
2
10 2

output:

41

result:

ok single line: '41'

Test #24:

score: 0
Accepted
time: 24ms
memory: 371012kb

input:

5 10 1 10
1 2 7
1 3 7
1 4 4
1 5 8
2 3 6
2 4 10
2 5 1
3 4 9
3 5 4
4 5 6
1
4
3
1
2
4
2
1
2
4
1 2

output:

70

result:

ok single line: '70'

Test #25:

score: 0
Accepted
time: 16ms
memory: 373036kb

input:

5 10 1 10
1 2 10
1 3 8
1 4 9
1 5 3
2 3 3
2 4 3
2 5 10
3 4 1
3 5 1
4 5 7
4
3
1
3
4
2
4
5
2
3
9 2

output:

36

result:

ok single line: '36'

Test #26:

score: 0
Accepted
time: 40ms
memory: 372988kb

input:

5 10 1 10
1 2 5
1 3 7
1 4 2
1 5 6
2 3 5
2 4 2
2 5 8
3 4 8
3 5 3
4 5 1
3
2
5
4
1
2
4
3
1
2
2 2

output:

38

result:

ok single line: '38'

Subtask #2:

score: 35
Accepted

Dependency #1:

100%
Accepted

Test #27:

score: 35
Accepted
time: 11ms
memory: 375228kb

input:

20 40 1 100
1 9 61
1 17 2
1 20 2
2 8 35
2 16 11
2 17 4
3 5 19
3 18 52
4 5 4
4 6 89
4 11 52
5 6 59
5 10 77
5 12 24
5 13 82
5 16 55
5 18 25
6 7 98
6 9 59
6 15 37
7 10 42
7 17 71
8 10 37
8 19 31
9 10 74
9 14 25
9 15 70
9 18 39
10 14 1
11 20 46
12 17 48
12 20 36
13 17 32
13 20 77
14 18 73
15 16 50
15 17...

output:

8152

result:

ok single line: '8152'

Test #28:

score: 0
Accepted
time: 68ms
memory: 377540kb

input:

100 100 1 100000
1 8 471117256
1 62 130027795
1 73 656848900
2 37 768343489
2 79 60152578
3 39 730756132
3 91 742436424
4 14 127206074
4 26 49752186
4 37 277130591
5 39 267794148
5 67 795814790
6 26 322818374
7 9 528203057
7 22 321028016
7 74 603723430
8 48 173910965
9 56 146180110
9 84 468273541
9 ...

output:

-1

result:

ok single line: '-1'

Test #29:

score: 0
Accepted
time: 48ms
memory: 377288kb

input:

100 100 1 100000
1 22 496690411
1 80 160170813
2 78 246401127
2 79 698301891
3 18 335424010
3 43 199212643
4 8 387887272
5 63 342214421
5 89 493693783
6 12 43866762
7 25 965696870
8 67 293983530
9 71 213899161
10 93 733230250
10 97 886418929
11 28 387081262
11 62 181334144
12 27 278789468
12 49 7986...

output:

-1

result:

ok single line: '-1'

Test #30:

score: 0
Accepted
time: 156ms
memory: 399740kb

input:

100 300 1 100000
1 5 365304469
1 9 179648504
1 34 59704152
1 46 817333375
2 5 583565204
2 9 785103102
2 40 480198908
2 47 835927550
2 48 354380031
2 65 486715288
2 92 950313228
2 93 374483314
3 30 82337560
3 32 308293283
3 60 646076359
3 97 197337851
4 16 366616801
4 18 585876058
4 29 61422451
4 41 ...

output:

93114286907830

result:

ok single line: '93114286907830'

Test #31:

score: 0
Accepted
time: 181ms
memory: 397884kb

input:

100 300 1 100000
1 3 912986539
1 9 197792176
1 13 246835129
1 16 344867075
1 18 967911416
1 19 441622270
1 22 775263613
1 29 968144880
1 34 820331077
1 36 757601901
1 51 502350836
1 63 474234541
1 64 113420408
1 66 153943653
1 67 199823271
1 72 138370407
1 82 774858096
1 83 139129019
1 90 916684302
...

output:

35572091890278

result:

ok single line: '35572091890278'

Test #32:

score: 0
Accepted
time: 143ms
memory: 397272kb

input:

100 300 1 100000
1 2 314864312
1 3 280386699
1 5 900829806
1 6 286123321
1 7 662490056
1 8 717445306
1 9 388158739
1 15 820246487
1 17 380616676
1 19 118295437
1 20 278592968
1 21 38694483
1 23 405950418
1 27 271185615
1 28 124119023
1 31 138766045
1 35 4292030
1 36 699435130
1 38 115953700
1 39 635...

output:

12727469493056

result:

ok single line: '12727469493056'

Test #33:

score: 0
Accepted
time: 178ms
memory: 399660kb

input:

100 300 1 100000
1 2 523087200
1 3 8625758
1 4 479922033
1 5 179521367
1 6 52560042
1 7 647680332
1 8 10574482
1 9 420818013
1 10 443941068
1 11 265762494
1 12 880093987
1 13 984518118
1 14 551970324
1 15 328833026
1 16 906486091
1 17 985112084
1 18 478403683
1 21 344890629
1 23 180458589
1 25 23751...

output:

6812101494149

result:

ok single line: '6812101494149'

Test #34:

score: 0
Accepted
time: 177ms
memory: 399788kb

input:

150 300 1 100000
1 57 878207960
1 93 703334538
1 101 68840341
2 9 609874540
2 14 524137107
2 30 948045570
2 38 438159917
2 98 989192311
3 42 257559234
3 75 152187092
3 148 440131087
4 28 567615969
4 46 776359152
4 54 179042810
4 125 426404592
5 50 265179533
5 66 877325657
5 75 700145090
5 99 1205793...

output:

156796709032107

result:

ok single line: '156796709032107'

Test #35:

score: 0
Accepted
time: 168ms
memory: 399836kb

input:

150 300 1 100000
1 16 202605724
1 34 111505563
1 76 802050519
1 95 522857534
1 97 217611266
1 124 553211647
2 84 23122883
2 106 665133149
3 83 800041101
3 89 488010281
3 142 376710381
3 148 559320220
4 7 338847173
4 26 682077064
4 36 501041950
4 58 301859723
4 62 257257630
4 68 394915954
4 131 73298...

output:

158718457185257

result:

ok single line: '158718457185257'

Test #36:

score: 0
Accepted
time: 129ms
memory: 397352kb

input:

150 300 1 100000
1 2 131562815
1 3 383393237
1 5 252538693
1 7 236824663
1 8 689269584
1 10 247469848
1 11 461280494
1 12 598561583
1 15 183046296
1 17 586816553
1 18 896988909
1 19 388930811
1 20 420628667
1 21 768353228
1 24 880805200
1 25 469471039
1 27 177584827
1 30 1802821
1 32 1752197
1 35 56...

output:

12477242437185

result:

ok single line: '12477242437185'

Test #37:

score: 0
Accepted
time: 150ms
memory: 399684kb

input:

150 300 1 100000
1 3 397335916
1 9 149871467
1 11 906429160
1 12 907834891
1 13 95045117
1 15 123378294
1 19 130873916
1 20 784547300
1 23 579232016
1 24 692840149
1 25 429494420
1 29 256646966
1 30 25479873
1 33 98932677
1 35 747188673
1 39 24829208
1 40 655452971
1 42 859426866
1 46 619182596
1 47...

output:

35395680659889

result:

ok single line: '35395680659889'

Test #38:

score: 0
Accepted
time: 144ms
memory: 399952kb

input:

150 300 1 100000
1 42 727058849
1 49 349708043
1 57 999809570
1 88 336747661
2 8 587959218
2 31 588457404
3 94 829049410
3 98 102020218
3 144 187783209
3 149 182448561
4 55 89240698
4 75 832327090
4 100 34796121
5 8 936264949
5 61 710383076
5 77 556268363
5 101 23917938
6 50 600701047
6 82 262234386...

output:

153201692683735

result:

ok single line: '153201692683735'

Test #39:

score: 0
Accepted
time: 135ms
memory: 399796kb

input:

200 300 1 100000
1 19 909805577
1 97 582775452
2 27 43163990
2 30 442296779
2 66 878591352
2 89 513837579
2 151 277200957
3 64 985251429
3 79 641905693
3 133 215658546
4 34 748196928
4 174 11100110
4 189 225851894
5 136 24998123
5 150 416236971
5 177 571026362
6 28 147828956
6 58 678254484
6 79 9310...

output:

255201255583268

result:

ok single line: '255201255583268'

Test #40:

score: 0
Accepted
time: 152ms
memory: 399560kb

input:

200 300 1 100000
1 11 50543344
1 26 175124937
1 29 726988619
1 30 489727785
1 41 707658243
1 47 64703458
1 50 222132616
1 51 278508318
1 52 495534006
1 56 449020704
1 63 303036406
1 73 356701920
1 83 898919082
1 89 767068839
1 94 894349166
1 100 57693820
1 108 31975726
1 112 232178142
1 117 61458064...

output:

53584398972763

result:

ok single line: '53584398972763'

Test #41:

score: 0
Accepted
time: 149ms
memory: 397680kb

input:

200 300 1 100000
1 32 792158817
1 137 25487399
1 155 772268784
2 63 941831574
2 98 105568022
2 156 239332109
3 92 253866448
3 122 672259455
4 9 713111912
4 19 598402833
4 30 820316864
4 114 680217866
4 152 424095465
5 48 68970188
5 143 24731629
5 156 770600892
6 119 588905532
6 133 82848267
7 38 167...

output:

267939841388462

result:

ok single line: '267939841388462'

Test #42:

score: 0
Accepted
time: 149ms
memory: 399880kb

input:

200 300 1 100000
1 22 535223654
1 142 603041735
1 186 192207208
2 44 367710248
2 55 79901099
2 134 986616264
2 182 726190801
2 193 614388294
3 28 689728406
3 71 854707789
3 100 420300867
4 51 684428208
4 85 157443457
4 94 844010383
4 118 273611275
4 200 149184217
5 29 695523255
5 52 946678086
5 61 3...

output:

268285977186522

result:

ok single line: '268285977186522'

Test #43:

score: 0
Accepted
time: 136ms
memory: 399996kb

input:

230 300 1 100000
1 2 742794410
1 3 728150284
1 20 401244033
1 21 70310741
1 34 667555409
1 36 594171145
1 42 544498443
1 61 257894401
1 84 687337304
1 85 965200707
1 86 807054423
1 93 963823263
1 99 443314390
1 107 31267844
1 108 547633577
1 111 556970671
1 118 213208555
1 125 840297483
1 129 958611...

output:

77172557277251

result:

ok single line: '77172557277251'

Test #44:

score: 0
Accepted
time: 149ms
memory: 399708kb

input:

250 300 1 100000
1 49 326167568
1 92 930782713
2 37 160107383
2 237 551533701
3 53 917311888
3 152 600286392
4 112 737862953
4 126 372037561
5 150 129855862
5 237 978322168
6 244 595435111
6 250 476977898
7 11 514404625
7 84 157813656
8 89 111824040
8 204 121230607
9 119 495099315
9 133 136354536
10...

output:

465520766059970

result:

ok single line: '465520766059970'

Test #45:

score: 0
Accepted
time: 147ms
memory: 399732kb

input:

250 300 1 100000
1 23 151374420
1 200 605870388
2 180 472093518
2 195 765657780
2 237 771384939
3 25 369658311
3 38 603813994
3 139 427985331
4 23 767911031
4 45 556624664
4 87 128653888
5 20 730849760
5 92 226785250
5 153 905678103
6 68 334063497
6 111 673737490
6 160 783223392
7 66 918450016
7 122...

output:

479631977494206

result:

ok single line: '479631977494206'

Test #46:

score: 0
Accepted
time: 68ms
memory: 395840kb

input:

300 300 1 100000
1 61 987580639
1 132 274493980
2 137 135288592
2 230 869989040
3 78 757256421
3 180 679335221
4 7 306075219
4 69 816734920
5 128 626849350
5 283 709406225
6 57 72516811
6 230 104732523
7 252 57223906
8 148 780817506
8 217 209842564
9 68 133059571
9 117 456949134
10 33 787824292
10 3...

output:

7275932816495946

result:

ok single line: '7275932816495946'

Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #47:

score: 15
Accepted
time: 294ms
memory: 426504kb

input:

200 500 1 50
1 11 34
1 32 97
1 43 30
1 55 96
1 89 88
1 92 51
1 108 16
1 121 86
2 45 64
2 51 8
2 62 60
2 73 44
2 100 74
2 117 70
2 128 15
2 178 31
2 181 5
2 189 21
3 5 77
3 166 99
4 23 6
4 33 37
4 140 42
4 198 67
5 35 38
5 39 60
5 77 38
5 109 51
6 41 2
6 86 72
6 97 66
6 116 39
6 133 42
6 147 12
6 160...

output:

5847

result:

ok single line: '5847'

Test #48:

score: -15
Runtime Error

input:

500 2000 1 100000
1 2 799202998
1 3 70814651
1 4 166275349
1 5 551769444
1 7 461096012
1 8 534263628
1 9 151173730
1 10 221493187
1 11 838959315
1 12 761142835
1 13 280847539
1 14 896759219
1 15 754519641
1 17 171545812
1 19 50980387
1 21 67949479
1 22 786655275
1 23 649900813
1 26 770954979
1 27 21...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%