QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#448020#4898. 基础图论练习题ttest40 583ms84184kbC++148.3kb2024-06-19 08:57:082024-06-19 08:57:09

Judging History

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

  • [2024-06-19 08:57:09]
  • 评测
  • 测评结果:40
  • 用时:583ms
  • 内存:84184kb
  • [2024-06-19 08:57:08]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define int long long
#define fir first
#define sec second
#define pii pair<int,int>
#define isz(v) (int)(v.size())
using namespace std;

const int maxn=200005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int mod=998244353;

namespace Solve {
	struct mint {
		int val;
		mint():val(0) {}
		mint(ll tval) {
			if(-mod<=tval&&tval<2*mod) {
				if(tval>=mod) {
					tval-=mod;
				} 
				if(tval<0) {
					tval+=mod;
				}
			} else {
				tval%=mod;
				if(tval<0) {
					tval+=mod;
				}			
			}
			val=tval;
		}
		mint& operator += (const mint &b) {
			val=val+b.val>=mod?val+b.val-mod:val+b.val;
			return *this;
		}
		mint& operator -= (const mint &b) {
			val=val-b.val<0?val-b.val+mod:val-b.val;
			return *this;
		}
		mint& operator *= (const mint &b) {
			val=1ll*val*b.val>=mod?1ll*val*b.val%mod:val*b.val;
			return *this;
		}
		mint& operator /= (const mint &b) {
			*this*=b.inv();
			return *this;
		}
		friend mint operator + (const mint &a,const mint &b) {
			mint ans=a;
			ans+=b;
			return ans;
		}
		friend mint operator - (const mint &a,const mint &b) {
			mint ans=a;
			ans-=b;
			return ans;
		}
		friend mint operator * (const mint &a,const mint &b) {
			mint ans=a;
			ans*=b;
			return ans;
		}
		friend mint operator / (const mint &a,const mint &b) {
			mint ans=a;
			ans/=b;
			return ans;
		}
		friend bool operator ! (const mint &v) {
			return !v.val;
		}
		friend mint operator - (const mint &v) {
			return mod-v;
		}
		friend mint& operator ++ (mint &v) {
			v+=1;
			return v;
		}
		friend mint operator ++ (mint &v,signed _) {
			mint t=v;
			v+=1;
			return t;
		}
		friend mint& operator -- (mint &v) {
			v-=1; 
			return v;
		}
		friend mint operator -- (mint &v,signed _) {
			mint t=v;
			v-=1;
			return t;
		}
		friend bool operator < (const mint &a,const mint &b) {
			return a.val<b.val;
		}
		friend bool operator == (const mint &a,const mint &b) {
			return a.val==b.val;
		}
		friend bool operator != (const mint &a,const mint &b) {
			return a.val!=b.val;
		}
		friend istream& operator >> (istream &is,mint &x) {
			ll val;
			is>>val;
			x=mint(val); 
			return is;
		}
		friend ostream& operator << (ostream &os,const mint &x) {
			os<<x.val;
			return os;
		}
		mint qpow(ll y) const {
			mint x=*this,ans=1;
			if(y<0) {
				y=-y;
				x=inv();
			}
			while(y) {
				if(y&1) {
					ans*=x;
				} 
				x*=x;
				y>>=1;
			}
			return ans;
		}
		mint inv() const {
			// mod must be a prime
			return qpow(mod-2);
		}
		mint sqrt() {
			mint a=*this; 
			auto check=[&](mint x) {
				return x.qpow((mod-1)/2)==1;
			};
			static mt19937 rnd(73385);
			mint b=rnd()%mod;
			while(check(b*b-a)) {
				b=rnd()%mod;
			}
			static mint val=b*b-a;
			struct Complex {
				mint real,imag;
				Complex(mint treal=0,mint timag=0):real(treal),imag(timag) {}
				Complex operator * (const Complex &rhs) {
					return {real*rhs.real+imag*rhs.imag*val,real*rhs.imag+imag*rhs.real};
				}
				Complex& operator *= (const Complex &rhs) {
					return *this=*this*rhs;
				}
			};
			auto qpow=[&](Complex x,int y) {
				Complex ans={1};
				while(y) {
					if(y&1) {
						ans*=x;
					}
					x*=x;
					y>>=1;
				}
				return ans;
			};
			mint ans=qpow({b,1},(mod+1)/2).real;
			return min(ans,mod-ans);
		}
	};
	mint qpow(mint x,ll y) {
		return x.qpow(y);
	}
	mint inv(mint x) {
		return x.inv();
	}
	struct EA {
		int d,x;
	};
	struct EB {
		int x,y,z;
	};
	struct DSU {
		int fa[maxn];
		int sz[maxn];
		void init(int tn) {
			iota(fa+1,fa+tn+1,1);
			fill(sz+1,sz+tn+1,1);
		}
		int f(int x) {
			return x==fa[x]?x:fa[x]=f(fa[x]);
		}
		bool same(int x,int y) {
			return f(x)==f(y);
		}
		bool merge(int x,int y) {
			x=f(x),y=f(y);
			if(x==y) {
				return false;
			}
			fa[x]=y,sz[y]+=sz[x];
			return true;
		}
		int operator () (const int &x) {
			return f(x);
		}
	} d;
	int n,A,B;
	EA a[maxn];
	EB e[maxn];
	vector<int> ds[maxn];
	vector<array<int,3>> es;
	map<int,int> id;
	mint ans;
	void clear() {
		
	}
	void ckmin(int &x,int y) {
		x=min(x,y);
	}
	int count(int n,vector<int> d) {
		int ans=0;
		while(true) {
			int mi=inf;
			for(int x:d) {
				if(!x) {
					continue;
				}
				ckmin(mi,x);
			}
			if(mi==inf||mi>n) {
				ans+=n;
				break;
			}
			int r;
			if(mi*2>n) {
				r=1;
				ans+=mi*2-n;
			} else {
				r=(n-mi)/mi;
				for(int x:d) {
					if(!x||x==mi) {
						continue;
					}
					ckmin(r,(x-mi)/mi+1);
				}
			}
			n-=mi*r;
			for(int &x:d) {
				if(!x||x==mi) {
					continue;
				}
				x-=mi*r;
			}
		}
		return ans;
	}
	vector<int> useful(int n,vector<int> d) {
		int ans=0;
		vector<int> t=d,u;
		while(true) {
			int mi=inf;
			for(int x:d) {
				if(!x) {
					continue;
				}
				ckmin(mi,x);
			}
			for(int i=0;i<isz(d);i++) {
				if(d[i]==mi) {
					u.push_back(t[i]);
					break;
				}
			}
			if(mi==inf||mi>n) {
				ans+=n;
				break;
			}
			int r;
			if(mi*2>n) {
				r=1;
				ans+=mi*2-n;
			} else {
				r=(n-mi)/mi;
				for(int x:d) {
					if(!x||x==mi) {
						continue;
					}
					ckmin(r,(x-mi)/mi+1);
				}
			}
			n-=mi*r;
			for(int &x:d) {
				if(!x||x==mi) {
					continue;
				}
				x-=mi*r;
			}
		}
		return u;
	}
	vector<int> ask(int n,vector<int> d,vector<int> q) {
		vector<int> ans(isz(q));
		while(true) {
			int mi=inf;
			for(int x:d) {
				if(!x) {
					continue;
				}
				ckmin(mi,x);
			}
			if(mi==inf||mi>n) {
				for(int i=0;i<isz(q);i++) {
					if(!q[i]) {
						continue;
					}
					ans[i]=q[i];
				}
				break;
			}
			int r;
			if(mi*2>n) {
				r=1;
				for(int i=0;i<isz(q);i++) {
					if(!q[i]) {
						continue;
					}
					if(n-mi+1<=q[i]&&q[i]<=mi) {
						ans[i]=q[i];
						q[i]=0;
					}
				}
			} else {
				r=(n-mi)/mi;
				for(int x:d) {
					if(!x||x==mi) {
						continue;
					}
					ckmin(r,(x-mi)/mi+1);
				}
			}
			for(int &x:d) {
				if(!x||x==mi) {
					continue;
				}
				x-=mi*r;
			}
			for(int &x:q) {
				if(!x) {
					continue;
				}
				if(x>n-mi*r) {
					x-=(x-(n-mi*r)+mi-1)/mi*mi;
				}
			}
			n-=mi*r;
		}
		return ans;
	}
	int ask(int n,vector<int> d,int q) {
		return ask(n,d,(vector<int>){q})[0];
	}
	mint calc() {
		int cur=n;
		mint ans;
		for(int i=1;i<=A;i++) {
			ds[i]=ds[i-1];
			ds[i].push_back(a[i].d);
			int c=count(n,ds[i]);
			ans+=mint(cur-c)*a[i].x,cur=c;
			ds[i]=useful(n,ds[i]);
		}
		return ans;
	}
	void solve(int l,int r,vector<int> vs) {
		if(isz(vs)==1) {
			return ;
		}
		if(l==r) {
			for(int i=1;i<isz(vs);i++) {
				ans-=a[l].x;
				es.push_back({a[l].x,id[vs[i-1]],id[vs[i]]});
			}
			return ;
		}
		int mid=(l+r)>>1;
		vector<int> to=ask(n,ds[mid],vs);
		vector<array<int,2>> c;
		for(int i=0;i<isz(vs);i++) {
			c.push_back({to[i],vs[i]});
		}
		sort(c.begin(),c.end());
		vector<int> cur;
		for(int i=0;i<isz(c);i++) {
			int j=i;
			while(j<isz(c)&&c[i][0]==c[j][0]) {
				j++;
			}
			j--;
			cur.push_back(c[i][1]);
			vector<int> d;
			for(int k=i;k<=j;k++) {
				d.push_back(c[k][1]);
			}
			solve(l,mid,d);
			i=j;
		}
		solve(mid+1,r,cur);
	}
	void main(int tid) {
		cin>>n>>A>>B;
		for(int i=1;i<=A;i++) {
			cin>>a[i].d>>a[i].x;
		}
		for(int i=1;i<=B;i++) {
			cin>>e[i].x>>e[i].y>>e[i].z;
		}
		sort(a+1,a+A+1,[&](EA a,EA b) {
			return a.x<b.x;
		});
		ans=calc();
		cerr<<ans<<"\n";
		vector<int> u;
		for(int i=1;i<=B;i++) {
			u.push_back(e[i].x);
			u.push_back(e[i].y);
		}
		sort(u.begin(),u.end());
		u.erase(unique(u.begin(),u.end()),u.end());
		for(int i=0;i<isz(u);i++) {
			id[u[i]]=i+1;
		}
		solve(1,A,u);
		for(int i=1;i<=B;i++) {
			es.push_back({e[i].z,id[e[i].x],id[e[i].y]});
		}
		sort(es.begin(),es.end());
		d.init(isz(u));
		for(auto p:es) {
			if(d.same(p[1],p[2])) {
				continue;
			}
			ans+=p[0];
			d.merge(p[1],p[2]);
		}
		cout<<ans<<"\n";
	}
	void init() {
		
	}
}

signed main() {
#ifndef ONLINE_JUDGE
	freopen("mst.in","r",stdin);
	freopen("mst.out","w",stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
//	cin>>T;
	Solve::init();
	for(int t=1;t<=T;t++) {
		Solve::main(t);
		Solve::clear();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 69ms
memory: 23656kb

input:

161199 9 46510
147335 540442844
159493 801351455
149342 821625305
128476 843250712
95524 275754315
139315 106523502
93575 680460786
155498 328812257
146020 410466645
79992 141967 50596784
152210 68644 268349216
72549 96959 42994091
93869 27394 945120577
2909 81886 270684270
12735 35026 871917997
974...

output:

501709067

result:

wrong answer 1st numbers differ - expected: '359714743', found: '501709067'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 0ms
memory: 13656kb

input:

569435269457904707 2 0
490445920091092693 772271583
144842828305643603 609043885

output:

884694794

result:

ok 1 number(s): "884694794"

Test #12:

score: 0
Accepted
time: 2ms
memory: 13128kb

input:

946929772456816659 2 0
589193907831915013 196301185
485768367910597533 207014034

output:

790540706

result:

ok 1 number(s): "790540706"

Test #13:

score: 0
Accepted
time: 0ms
memory: 12688kb

input:

693038683299151358 2 0
654733556025919068 724998910
450253521190874799 187460097

output:

122292064

result:

ok 1 number(s): "122292064"

Test #14:

score: 0
Accepted
time: 0ms
memory: 14056kb

input:

572269482188906358 2 0
545978502848607475 331750201
488577730099900109 477584735

output:

429885702

result:

ok 1 number(s): "429885702"

Test #15:

score: 0
Accepted
time: 0ms
memory: 13328kb

input:

984888155303961325 2 0
421568681423492040 823358650
324408005979881943 905919848

output:

551223124

result:

ok 1 number(s): "551223124"

Test #16:

score: 0
Accepted
time: 2ms
memory: 13164kb

input:

968068649251960108 2 0
932666179822285222 303897491
422068063538287737 405622211

output:

516717723

result:

ok 1 number(s): "516717723"

Test #17:

score: 0
Accepted
time: 2ms
memory: 13976kb

input:

973235486287221374 2 0
604729607242747292 566399250
440704799734330948 93237801

output:

772791524

result:

ok 1 number(s): "772791524"

Test #18:

score: 0
Accepted
time: 0ms
memory: 14244kb

input:

980842002786834388 2 0
921076927921054095 989436809
917078581302025088 354268450

output:

387335763

result:

ok 1 number(s): "387335763"

Test #19:

score: 0
Accepted
time: 0ms
memory: 14164kb

input:

584600268153835325 2 0
436736455094118542 788823700
379215887395241676 440751386

output:

178749302

result:

ok 1 number(s): "178749302"

Test #20:

score: 0
Accepted
time: 2ms
memory: 13800kb

input:

984888155303961325 2 0
421568681423492040 823358650
324408005979881943 905919848

output:

551223124

result:

ok 1 number(s): "551223124"

Subtask #4:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #21:

score: 0
Wrong Answer
time: 79ms
memory: 25668kb

input:

569435269457904707 2 48002
490445920091092693 772271583
144842828305643603 609043885
71626464779726163 20936760728342582 933619218
254533877531926689 561120543297327423 444805145
102181371350776436 64807827761321835 63236550
442490347461393187 274703226312639148 379888813
153103619447430279 56932615...

output:

300227474

result:

wrong answer 1st numbers differ - expected: '264605976', found: '300227474'

Subtask #5:

score: 12
Accepted

Test #31:

score: 12
Accepted
time: 11ms
memory: 12988kb

input:

755526150476311190 942 0
492334667739348527 1
755523898623296976 1
532486636690994793 1
755526150476030559 1
755526150476249097 1
502164090270592200 1
657422656495814703 1
487200614853438190 1
311037325561173142 1
755526150475651155 1
125287404340238660 1
755524914808674090 1
755526150476177007 1
75...

output:

546044429

result:

ok 1 number(s): "546044429"

Test #32:

score: 0
Accepted
time: 8ms
memory: 14368kb

input:

507397654005748030 973 0
507391491616563534 1
486814015790119176 1
333131389050214032 1
363564475994643564 1
465930313898633808 1
139522156177690314 1
507395579080257474 1
86630001225723132 1
507395634795467574 1
507396923359845774 1
472957579895774142 1
211220548093936200 1
507397483302327114 1
507...

output:

873803086

result:

ok 1 number(s): "873803086"

Test #33:

score: 0
Accepted
time: 7ms
memory: 13532kb

input:

603106685583649335 921 0
550056634223640253 1
603106685583649293 1
603106685583647605 1
603106685583643690 1
603106685583647260 1
603106685583645101 1
603106685583206332 1
603106685583646490 1
579053271797467737 1
603106685567627560 1
392817087439609936 1
603106685583643465 1
603106685583648090 1
60...

output:

249400664

result:

ok 1 number(s): "249400664"

Test #34:

score: 0
Accepted
time: 6ms
memory: 14896kb

input:

548596182165075765 943 0
548596176080168583 1
548596182156180063 1
312480420249896937 1
548596163341594933 1
526283600729694623 1
548596158109050143 1
403131997716059924 1
434962771902913720 1
503166563025971068 1
334309818515550442 1
548596177929282553 1
548596181450546783 1
548596147814225823 1
54...

output:

315888763

result:

ok 1 number(s): "315888763"

Test #35:

score: 0
Accepted
time: 11ms
memory: 12908kb

input:

757339678164545873 914 0
639318686980737134 1
746121423482808728 1
757339678163450618 1
742690258664301578 1
615075436001700347 1
735156649863536078 1
748312116661086428 1
720777012721160772 1
733811525870561678 1
746526366212816378 1
743741354498887825 1
753440640705502328 1
735178291510182878 1
72...

output:

748030011

result:

ok 1 number(s): "748030011"

Test #36:

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

input:

678523609535069397 961 0
678523501457247993 1
678341707003179753 1
678213366219732921 1
596032992350559535 1
595323423910072641 1
178264171486256288 1
678331675351935897 1
353022445409011341 1
653752496830522075 1
662470342111950027 1
587709190707850701 1
678270056924891769 1
677027683908676175 1
67...

output:

562697340

result:

ok 1 number(s): "562697340"

Test #37:

score: 0
Accepted
time: 11ms
memory: 13964kb

input:

657959922343486841 902 0
650132742778059115 1
105135315791795180 1
438709014360864607 1
545602442587344080 1
657551739592023011 1
656791446287459707 1
657959922133303499 1
647469446648658309 1
657959922343384019 1
657959922221719769 1
336017444559583475 1
657959922253125629 1
655097797158940969 1
19...

output:

300994893

result:

ok 1 number(s): "300994893"

Test #38:

score: 0
Accepted
time: 8ms
memory: 13204kb

input:

545476271566415902 948 0
502943849064064720 1
545153141190505744 1
493528954491284005 1
487490221799012640 1
391805643829976272 1
545466964425150144 1
545474613254014704 1
545475659935859328 1
48415031136648176 1
545475230527923072 1
545472466214333424 1
545475176851931040 1
405305381846539616 1
393...

output:

621606394

result:

ok 1 number(s): "621606394"

Test #39:

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

input:

768089367882777564 903 0
768042195730743057 1
624180099065408353 1
677932298998893337 1
761912479820021969 1
373002333986242953 1
681859753068860049 1
768089367882777309 1
580672767835556559 1
768089367882750069 1
51197080622037114 1
737402458661389169 1
768089367882765501 1
707354099585711345 1
768...

output:

319523314

result:

ok 1 number(s): "319523314"

Test #40:

score: 0
Accepted
time: 10ms
memory: 13704kb

input:

803879216581914933 998 0
498552666676978841 1
803189592600095992 1
803577182309491044 1
803875534594601716 1
803827683448699636 1
803767099629307124 1
803775818980883188 1
803799950365214452 1
803816279020876020 1
803806021800931060 1
803585821604611604 1
695090981117645328 1
803690137369875484 1
68...

output:

867132754

result:

ok 1 number(s): "867132754"

Subtask #6:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Test #41:

score: 0
Wrong Answer
time: 7ms
memory: 14360kb

input:

658450692215768892 966 184
215944253331969524 463889684
658450636472429991 583551110
658450692215733673 179443509
658450692215624997 605779678
508574445107762299 859274405
658450681194937638 515630669
63736085272552748 994573345
354907806666837319 932072760
658450692214054043 663256872
6584506911545...

output:

12855509

result:

wrong answer 1st numbers differ - expected: '12943668', found: '12855509'

Subtask #7:

score: 12
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Test #51:

score: 12
Accepted
time: 311ms
memory: 28360kb

input:

571630416836886394 47168 0
96863681397862733 975125142
356044822253140262 598706048
515453346882217082 780566337
310612673285348975 628963074
470413750105710996 521531320
485023891192396182 511014543
294586905153825661 925671185
571630416738335094 158726562
185789055211250703 954614799
3548394816997...

output:

563260749

result:

ok 1 number(s): "563260749"

Test #52:

score: 0
Accepted
time: 307ms
memory: 30600kb

input:

841161310096886484 47782 0
695723253916094448 724478598
540665669817327612 824722094
841159307153505572 358568703
420009767990047350 208597811
841157041808575787 461740092
841153463198963867 569722258
841155889630106597 515332698
835476875635312659 636252803
841161310096575364 268569091
665233067738...

output:

178000363

result:

ok 1 number(s): "178000363"

Test #53:

score: 0
Accepted
time: 281ms
memory: 29740kb

input:

539025190773540771 46142 0
539025114552193483 750084891
539025146939174001 208399611
539025142948200821 59628495
539025167040882541 187485048
297804195276627820 596910027
539025036251289721 292620891
539025176171348121 25151122
419197658222546676 541151443
539025182999530881 170481735
94373350744432...

output:

792619156

result:

ok 1 number(s): "792619156"

Test #54:

score: 0
Accepted
time: 478ms
memory: 38424kb

input:

705921968914365511 47716 0
705921968910682250 37456241
216562629047838980 788958895
705921968888183480 220262214
504364558319371214 712517838
705921968912285852 63040139
559896530157610827 865295481
692795819065070003 265936336
705921968902391426 525007326
705921968898107858 563844710
45377210899051...

output:

441700676

result:

ok 1 number(s): "441700676"

Test #55:

score: 0
Accepted
time: 583ms
memory: 38872kb

input:

564133086769866350 48875 0
563437196556182544 261486038
560294783129522064 324772044
556631029930923984 145670740
559700141975322384 85009595
314575623929155476 914739751
557994542117070864 119723133
563970481727376144 4644345
556297791301355844 658135589
473151054735727950 815276832
549167714478150...

output:

310639483

result:

ok 1 number(s): "310639483"

Test #56:

score: 0
Accepted
time: 451ms
memory: 38292kb

input:

936756643107884507 47057 0
936756549937799391 463453118
936756642116110143 96749536
936756552075454317 459354765
936756643099480707 8057801
936756597512789337 306600323
936756596879434857 309660796
465274780883248915 884923508
936756624706549095 179625651
936756643107883335 82112034
8680557778246200...

output:

628129359

result:

ok 1 number(s): "628129359"

Test #57:

score: 0
Accepted
time: 478ms
memory: 39336kb

input:

702873086596726417 46921 0
702873084504467311 435498634
299151456816761100 696668178
702873086593780755 188996895
702873085139720895 378933418
287632236113773418 945140906
702873086596626031 8514228
381034645003012276 917283692
702873085223824163 371177051
480867097500933640 624812518
70287308659425...

output:

296470561

result:

ok 1 number(s): "296470561"

Test #58:

score: 0
Accepted
time: 408ms
memory: 31732kb

input:

696868150883245690 48306 0
476810224399322700 854659018
464195603276193600 304310171
446344869551578397 871173576
73772786710123200 427101535
499665574666792800 284452466
346762905048896444 928674821
283641472225843200 145545531
684797240141935200 12699482
263903781116001600 148139221
42026490439052...

output:

178187268

result:

ok 1 number(s): "178187268"

Test #59:

score: 0
Accepted
time: 367ms
memory: 31908kb

input:

995646392343469795 49194 0
995646392329767108 312459955
995646392334135924 245193472
995646392331093996 299744392
995646392321756100 363274045
968605994456210365 485812394
499093046036246318 925126426
995646392341599912 108726352
995646392333878812 250022020
728936689913383683 819169473
714935731010...

output:

664181186

result:

ok 1 number(s): "664181186"

Test #60:

score: 0
Accepted
time: 504ms
memory: 34548kb

input:

802473733444905042 48027 0
415952639582201792 589867404
802473733444442582 39725642
446316590121917984 571300735
22582790395893058 993586735
365938749924876688 605026635
802473733429621382 259044778
14458547092095008 673264904
430697237683964416 901111452
437186563439513194 897704884
802473733433003...

output:

291107795

result:

ok 1 number(s): "291107795"

Subtask #8:

score: 10
Accepted

Dependency #5:

100%
Accepted

Test #61:

score: 10
Accepted
time: 493ms
memory: 70732kb

input:

716429171502522215 47121 48854
684206275836370608 1
447368400898092275 1
500447584334752997 1
380938825102517800 1
703571667242752149 1
432997187680148804 1
169070786477357537 1
702163195024687605 1
706006848814479885 1
714728181809868081 1
702992487375782988 1
695502249468972696 1
29949334130159091...

output:

358321674

result:

ok 1 number(s): "358321674"

Test #62:

score: 0
Accepted
time: 552ms
memory: 74300kb

input:

760962402402047624 47788 46028
760962402400520977 1
146627560121093112 1
552500521368356496 1
609213278868935512 1
336266088659361952 1
556168263038283744 1
372691194708123248 1
542056449397110112 1
677262387740868256 1
760962402401092996 1
658355484638429264 1
760962402400992112 1
64514813498907734...

output:

397036874

result:

ok 1 number(s): "397036874"

Test #63:

score: 0
Accepted
time: 502ms
memory: 84184kb

input:

823454131189228931 47545 47996
633913455457088435 1
823454131188293887 1
823453960526785252 1
295577193570436898 1
448054862139934560 1
823454131188121371 1
662676467650910604 1
823454131188972663 1
702788755769685000 1
823453314863152631 1
823453107324243081 1
593195757060130275 1
82345390310591764...

output:

556901026

result:

ok 1 number(s): "556901026"

Test #64:

score: 0
Accepted
time: 508ms
memory: 76864kb

input:

790661905382541343 46638 46580
790661830315353694 1
628815916342495006 1
414195221334706964 1
761278128956231679 1
506248255650008574 1
504165239321589346 1
708623989919201733 1
537606289579523112 1
790661883086104374 1
790661830631248034 1
577869563291089149 1
790661889734095294 1
22748820983416533...

output:

923583785

result:

ok 1 number(s): "923583785"

Test #65:

score: 0
Accepted
time: 472ms
memory: 81428kb

input:

543995107469111870 46815 49986
543995107427386090 1
543995107385280202 1
543995107360534954 1
543995107322490794 1
543995107359865494 1
543995107430990394 1
118258633661474253 1
543995107437907018 1
543995107400709066 1
543995107388815822 1
543995107403911386 1
514372106427243364 1
54399510735645175...

output:

549708819

result:

ok 1 number(s): "549708819"

Test #66:

score: 0
Accepted
time: 528ms
memory: 78740kb

input:

973680848449912174 45809 48893
558451142980027913 1
973149521190732051 1
973151795384428051 1
730813052917184451 1
782733029576651051 1
973030580860431251 1
653086705192012191 1
885279135122797234 1
972841595364293651 1
940582507995263351 1
973068702032260451 1
762862562432814731 1
85928041435845971...

output:

760343391

result:

ok 1 number(s): "760343391"

Test #67:

score: 0
Accepted
time: 426ms
memory: 71628kb

input:

769083325181598713 45572 45512
768897660622302008 1
769083325180938609 1
768647443362725330 1
768852015940427126 1
43555486635844404 1
768689595631618217 1
769075697253837284 1
768598532992141964 1
768929558164370306 1
769077417931272476 1
768791432304759608 1
461513625257788477 1
518464733738942569...

output:

724840598

result:

ok 1 number(s): "724840598"

Test #68:

score: 0
Accepted
time: 398ms
memory: 78952kb

input:

989697766657099563 45914 49705
219852197404383689 1
491494304787067673 1
872190190190847836 1
887483404175496314 1
988437667010051631 1
988332948976172748 1
473918774016572392 1
73539620003504958 1
988923292997857377 1
142884498556990175 1
988698815467334790 1
936770813461610494 1
783682329635155073...

output:

478142716

result:

ok 1 number(s): "478142716"

Test #69:

score: 0
Accepted
time: 511ms
memory: 75628kb

input:

508086302629220899 45255 46961
508086302479732309 1
508086302451729729 1
476932514196496909 1
508086302347313329 1
479954970836181675 1
459285673375846471 1
487091876268376921 1
322586470409639114 1
472604100878658625 1
420442380335293898 1
278461218906312954 1
480604960680766945 1
28492141885045535...

output:

647915375

result:

ok 1 number(s): "647915375"

Test #70:

score: 0
Accepted
time: 469ms
memory: 81564kb

input:

608163868156115674 49705 47751
503333959958709384 1
421780903089450717 1
555039048741370741 1
532830641628222627 1
511986453645349407 1
542988393154824354 1
600140273623136626 1
412811087999765945 1
554352422959823718 1
594499283127331680 1
503907834436640092 1
608163868148396758 1
48888827368907290...

output:

64753822

result:

ok 1 number(s): "64753822"

Subtask #9:

score: 0
Skipped

Dependency #1:

0%