QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#774977#9786. Magical Bagsucup-team087#AC ✓149ms24360kbC++2317.3kb2024-11-23 14:23:092024-11-23 14:23:12

Judging History

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

  • [2024-11-23 14:23:12]
  • 评测
  • 测评结果:AC
  • 用时:149ms
  • 内存:24360kb
  • [2024-11-23 14:23:09]
  • 提交

answer

#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#endif

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

bool dbg=false;

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;
using vvi=vc<vc<int>>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

ll rand_int(ll l, ll r) { //[l, r]
	//#ifdef LOCAL
	static mt19937_64 gen;
	/*#else
	static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
	#endif*/
	return uniform_int_distribution<ll>(l, r)(gen);
}

ll rand_int(ll k){ //[0,k)
	return rand_int(0,k-1);
}
string rand_string(int n,char lw,char up){
	string s(n,'?');
	rep(i,n)s[i]=rand_int(lw,up);
	return s;
}

int current_run_id,run_batch_size=1000;
int calc_random_limit(){
	return current_run_id/run_batch_size+1;
}
template<class t>
void generate_single(t&a){
	a=rand_int(1,calc_random_limit());
}
void generate_single(string&a){
	int n;generate_single(n);
	a=rand_string(n,'a','b');
}
template<class t,class u>
void generate_single(pair<t,u>&a){
	generate_single(a.a);
	generate_single(a.b);
}
//https://trap.jp/post/1224/
template<class... Args>
void input(Args&... a){
	if(dbg){
		(generate_single(a),...);
	}else{
		#ifdef USE_FAST_IO
		sc.read(a...);
		#else
		(cin >> ... >> a);
		#endif
	}
}
#define INT(...) int __VA_ARGS__;input(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;input(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;input(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;input(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;input(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;input(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;input(__VA_ARGS__)
#define overload3(a,b,c,d,...) d
#define VI2(name,size) vi name(size);rep(i_##name,size)input(name[i_##name]);
#define VI3(name,size,offset) vi name(size);rep(i_##name,size)input(name[i_##name]),name[i_##name]+=offset;
#define VI(...) overload3(__VA_ARGS__,VI3,VI2)(__VA_ARGS__)
#define VPI(name,size) vc<pi> name(size);rep(i_##name,size)input(name[i_##name]);
#define VVI(name,sizeN,sizeM) vvi name(sizeN,vi(sizeM));\
rep(i_##name,sizeN)rep(j_##name,sizeM)input(name[i_##name][j_##name]);
#define VS(name,size) vc<string> name(size);rep(i_##name,size)input(name[i_##name]);

#define overload5(a,b,c,d,e,f,...) f
#define VVC4(type,name,sizeN,sizeM) vvc<type> name(sizeN,vc<type>(sizeM));
#define VVC5(type,name,sizeN,sizeM,ini) vvc<type> name(sizeN,vc<type>(sizeM,ini));
#define VVC(...) overload5(__VA_ARGS__,VVC5,VVC4)(__VA_ARGS__)

template<class T>
T vvvc(T v){
	return v;
}

template<class T,class...Args>
auto vvvc(int n,T v,Args...args){
	return vector(n,vvvc(v,args...));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

void printsuc(int suc){
	#ifdef USE_FAST_IO
		if(suc==1)pr.write('\n');
		if(suc==2)pr.write(' ');
	#else
		if(suc==1){
			if(dbg)cout<<endl;
			else{
				#ifdef LOCAL
				cout<<endl;
				#else
				cout<<"\n";
				#endif
			}
		}
		if(suc==2)
			cout<<" ";
	#endif
}

template<class t>
void print_single(t x,int suc=1){
	#ifdef USE_FAST_IO
	pr.write(x);
	#else
	cout<<x;
	#endif
	printsuc(suc);
}

template<class t,class u>
void print_single(const pair<t,u>&p,int suc=1){
	print_single(p.a,2);
	print_single(p.b,suc);
}

template<class T>
void print_single(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print_single(v[i],i==int(v.size())-1?3:2);
	printsuc(suc);
}

template<class T,size_t N>
void print_single(const array<T,N>&v,int suc=1){
	rep(i,N)
		print_single(v[i],i==int(N)-1?3:2);
	printsuc(suc);
}

template<class T>
void print(const T&t){
	print_single(t);
}

template<class T,class ...Args>
void print(const T&t,const Args&...args){
	print_single(t,2);
	print(args...);
}

template<class T>
void printvv(const vvc<T>&vs){
	for(const auto&row:vs)print(row);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

void YES(bool ex=true){
	cout<<"YES\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void NO(bool ex=true){
	cout<<"NO\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void Yes(bool ex=true){
	cout<<"Yes\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void No(bool ex=true){
	cout<<"No\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
//#define CAPITAL
/*
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}*/
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int topbit(ull t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int botbit(ull a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
int popcount(ull t){
	return __builtin_popcountll(t);
}
int bitparity(ll t){
	return __builtin_parityll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
ll mask(int i){
	return (ll(1)<<i)-1;
}
ull umask(int i){
	return (ull(1)<<i)-1;
}
ll minp2(ll n){
	if(n<=1)return 1;
	else return ll(1)<<(topbit(n-1)+1);
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class S> void mkuni(S&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

template<class t> bool isuni(vc<t> v){
	int s=si(v);
	mkuni(v);
	return si(v)==s;
}

template<class t>
void myshuffle(vc<t>&a){
	rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}

template<class S,class u>
int lwb(const S&v,const u&a){
	return lower_bound(all(v),a)-v.bg;
}
template<class t,class u>
bool bis(const vc<t>&v,const u&a){
	return binary_search(all(v),a);
}

//VERIFY: yosupo
//KUPC2017J
//AOJDSL1A
//without rank
struct unionfind{
	vi p,s;
	int c;
	unionfind(int n):p(n,-1),s(n,1),c(n){}
	void clear(){
		fill(all(p),-1);
		fill(all(s),1);
		c=si(p);
	}
	int find(int a){
		return p[a]==-1?a:(p[a]=find(p[a]));
	}
	//set b to a child of a
	bool unite(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b)return false;
		p[b]=a;
		s[a]+=s[b];
		c--;
		return true;
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	int sz(int a){
		return s[find(a)];
	}
};

vvc<int> readGraph(int n,int m){
	vvc<int> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		//sc.read(a,b);
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	return g;
}

vvc<int> rand_tree(int n){
	vvc<int> t(n);
	unionfind uf(n);
	while(uf.c>1){
		int a=rand_int(n);
		int b=rand_int(n);
		if(uf.unite(a,b)){
			t[a].pb(b);
			t[b].pb(a);
		}
	}
	return t;
}

vvc<int> readTree(int n){
	if(dbg){
		return rand_tree(n);
	}else{
		return readGraph(n,n-1);
	}
}

vi readRooted(int n){
	assert(!dbg);
	vi par(n,-1);
	rng(i,1,n){
		input(par[i]);
		par[i]--;
		assert(inc(0,par[i],i-1));
	}
	return par;
}

void printTree(const vvc<int> t){
	int n=si(t);
	int degsum=0;
	rep(i,n)degsum+=si(t[i]);
	if(degsum==n-1){
		//directed
		rep(i,si(t))for(auto j:t[i]){
			print(i+1,j+1);
		}
	}else if(degsum==2*(n-1)){
		//undirected
		rep(i,si(t))for(auto j:t[i])if(i<j){
			print(i+1,j+1);
		}
	}else{
		assert(false);
	}
}

template<class t>
vc<t> presum(const vc<t>&a){
	vc<t> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
vc<ll> presum(const vi&a){
	vc<ll> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
//BIT で数列を管理するときに使う (CF850C)
template<class t>
vc<t> predif(vc<t> a){
	gnr(i,1,si(a))a[i]-=a[i-1];
	return a;
}
template<class t>
vvc<ll> imos(const vvc<t>&a){
	int n=si(a),m=si(a[0]);
	vvc<ll> b(n+1,vc<ll>(m+1));
	rep(i,n)rep(j,m)
		b[i+1][j+1]=b[i+1][j]+b[i][j+1]-b[i][j]+a[i][j];
	return b;
}

//verify してないや
void transvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void transvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[j][i]=a[i][j];
	}
	a.swap(b);
	transvvc(n,m,args...);
}
//CF854E
void rotvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void rotvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[m-1-j][i]=a[i][j];
	}
	a.swap(b);
	rotvvc(n,m,args...);
}

//ソートして i 番目が idx[i]
//CF850C
template<class t>
vi sortidx(const vc<t>&a){
	int n=si(a);
	vi idx(n);iota(all(idx),0);
	sort(all(idx),[&](int i,int j){return a[i]<a[j];});
	return idx;
}
//vs[i]=a[idx[i]]
//例えば sortidx で得た idx を使えば単にソート列になって返ってくる
//CF850C
template<class t>
vc<t> a_idx(const vc<t>&a,const vi&idx){
	int n=si(a);
	assert(si(idx)==n);
	vc<t> vs(n);
	rep(i,n)vs[i]=a[idx[i]];
	return vs;
}
//CF850C
vi invperm(const vi&p){
	int n=si(p);
	vi q(n);
	rep(i,n)q[p[i]]=i;
	return q;
}

template<class t,class s=t>
s SUM(const vc<t>&a){
	return accumulate(all(a),s(0));
}
template<class t,size_t K,class s=t>
s SUM(const array<t,K>&a){
	return accumulate(all(a),s(0));
}

template<class t>
t MAX(const vc<t>&a){
	return *max_element(all(a));
}

template<class t>
pair<t,int> MAXi(const vc<t>&a){
	auto itr=max_element(all(a));
	return mp(*itr,itr-a.bg);
}

template<class A>
auto MIN(const A&a){
	return *min_element(all(a));
}

template<class t>
pair<t,int> MINi(const vc<t>&a){
	auto itr=min_element(all(a));
	return mp(*itr,itr-a.bg);
}

vi vid(int n){
	vi res(n);iota(all(res),0);
	return res;
}

template<class S>
void soin(S&s){
	sort(all(s));
}

template<class S,class F>
void soin(S&s,F&&f){
	sort(all(s),forward<F>(f));
}

template<class S>
S soout(S s){
	soin(s);
	return s;
}

template<class S>
void rein(S&s){
	reverse(all(s));
}

template<class S>
S reout(S s){
	rein(s);
	return s;
}

template<class t,class u>
pair<t,u>&operator+=(pair<t,u>&a,pair<t,u> b){
	a.a+=b.a;a.b+=b.b;return a;}
template<class t,class u>
pair<t,u>&operator-=(pair<t,u>&a,pair<t,u> b){
	a.a-=b.a;a.b-=b.b;return a;}
template<class t,class u>
pair<t,u> operator+(pair<t,u> a,pair<t,u> b){return mp(a.a+b.a,a.b+b.b);}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a,pair<t,u> b){return mp(a.a-b.a,a.b-b.b);}
template<class t,class u,class v>
pair<t,u>&operator*=(pair<t,u>&a,v b){
	a.a*=b;a.b*=b;return a;}
template<class t,class u,class v>
pair<t,u> operator*(pair<t,u> a,v b){return a*=b;}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a){return mp(-a.a,-a.b);}
namespace std{
template<class t,class u>
istream&operator>>(istream&is,pair<t,u>&a){
	return is>>a.a>>a.b;
}
}

template<class t>
t gpp(vc<t>&vs){
	assert(si(vs));
	t res=move(vs.back());
	vs.pop_back();
	return res;
}

template<class t,class u>
void pb(vc<t>&a,const vc<u>&b){
	a.insert(a.ed,all(b));
}

template<class t,class...Args>
vc<t> cat(vc<t> a,Args&&...b){
	(pb(a,forward<Args>(b)),...);
	return a;
}

template<class t,class u>
vc<t>& operator+=(vc<t>&a,u x){
	for(auto&v:a)v+=x;
	return a;
}

template<class t,class u>
vc<t> operator+(vc<t> a,u x){
	return a+=x;
}

template<class t>
vc<t>& operator+=(vc<t>&a,const vc<t>&b){
	a.resize(max(si(a),si(b)));
	rep(i,si(b))a[i]+=b[i];
	return a;
}

template<class t>
vc<t> operator+(const vc<t>&a,const vc<t>&b){
	vc<t> c(max(si(a),si(b)));
	rep(i,si(a))c[i]+=a[i];
	rep(i,si(b))c[i]+=b[i];
	return c;
}

template<class t,class u>
vc<t>& operator-=(vc<t>&a,u x){
	for(auto&v:a)v-=x;
	return a;
}
template<class t,class u>
vc<t> operator-(vc<t> a,u x){
	return a-=x;
}
template<class t>
vc<t>& operator-=(vc<t>&a,const vc<t>&b){
	a.resize(max(si(a),si(b)));
	rep(i,si(b))a[i]-=b[i];
	return a;
}
/*
template<class t>
vc<t> operator-(const vc<t>&a,const vc<t>&b){
	vc<t> c(max(si(a),si(b)));
	rep(i,si(a))c[i]+=a[i];
	rep(i,si(b))c[i]-=b[i];
	return c;
}
*/
template<class t,class u>
vc<t>& operator*=(vc<t>&a,u x){
	for(auto&v:a)v*=x;
	return a;
}
template<class t,class u>
vc<t> operator*(vc<t> a,u x){
	return a*=x;
}

template<class t,class u>
vc<t>& operator/=(vc<t>&a,u x){
	for(auto&v:a)v/=x;
	return a;
}
template<class t,class u>
vc<t> operator/(vc<t> a,u x){
	return a/=x;
}

template<class t>
vc<t>& operator<<=(vc<t>&a,int k){
	assert(k>=0);
	a.insert(a.bg,k,t(0));
	return a;
}
template<class t>
vc<t> operator<<(vc<t> a,int k){
	return a<<=k;
}

template<class t>
vc<t>& operator>>=(vc<t>&a,int k){
	if(si(a)<=k)a.clear();
	else a.erase(a.bg,a.bg+k);
	return a;
}
template<class t>
vc<t> operator>>(vc<t> a,int k){
	return a>>=k;
}

template<class t,class u>
void remval(vc<t>&a,const u&v){
	a.erase(remove(all(a),v),a.ed);
}
//消した要素の個数を返してくれる
//UCUP 2-8-F
template<class t,class F>
int remif(vc<t>&a,F f){
	auto itr=remove_if(all(a),f);
	int res=a.ed-itr;
	a.erase(itr,a.ed);
	return res;
}
template<class t>
void rempos(vc<t>&a,int i){
	assert(inc(0,i,si(a)-1));
	a.erase(a.bg+i);
}

template<class VS,class u>
void fila(VS&vs,const u&a){
	fill(all(vs),a);
}

template<class t,class u>
int findid(const vc<t>&vs,const u&a){
	auto itr=find(all(vs),a);
	if(itr==vs.ed)return -1;
	else return itr-vs.bg;
}

template<class t>
void rtt(vc<t>&vs,int i){
	rotate(vs.bg,vs.bg+i,vs.ed);
}

//Multiuni2023-8 C
//f(lw)=false,...,f(n-1)=false,f(n)=true,...,f(up)=true,
//のときに n を返す
template<class F>
int find_min_true(int lw,int up,F f){
	while(up-lw>1){
		const int mid=(lw+up)/2;
		if(f(mid))up=mid;
		else lw=mid;
	}
	return up;
}
//f(lw)=true,f(up)=false
template<class F>
int find_max_true(int lw,int up,F f){
	while(up-lw>1){
		const int mid=(lw+up)/2;
		if(f(mid))lw=mid;
		else up=mid;
	}
	return lw;
}

template<class t> using pqmin=priority_queue<t,vc<t>,greater<t>>;
template<class t> using pqmax=priority_queue<t>;
using T=tuple<int,int,int>;

void slv(){
	INT(n);
	vi L,R;
	vvc<int> a(n);
	rep(i,n){
		INT(k);
		VI(ls,k);
		soin(ls);
		a[i]=ls;
		L.pb(a[i].front());
		R.pb(a[i].back());
	}
	
	soin(L);
	soin(R);
	
	int ans=2*n;
	
	vc<pi> cand;
	
	rep(i,n){
		int r=R[lwb(R,a[i].front())];
		int l=L[lwb(L,a[i].back()+1)-1];
		if(lwb(a[i],l)<lwb(a[i],r+1)){
			cand.eb(a[i].front(),a[i].back());
		}
	}
	
	soin(cand);
	int pre=inf;
	for(auto [l,r]:reout(cand)){
		if(r<pre){
			ans--;
			pre=l;
		}
	}
	
	print(ans);
}

signed main(signed argc,char*argv[]){
	if(argc>1&&strcmp(argv[1],"D")==0)dbg=true;
	
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	if(dbg){
		while(1){
			if(current_run_id%run_batch_size==0){
				cerr<<"Current Run "<<current_run_id<<endl;
			}
			slv();
			current_run_id++;
		}
	}else{
		//int t;cin>>t;rep(_,t)
		slv();
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

4
3 4 7 10
2 1 9
4 11 2 8 14
3 6 12 13

output:

7

result:

ok 1 number(s): "7"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

4
1 1
1 2
1 3
1 4

output:

4

result:

ok 1 number(s): "4"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

4
3 4 7 10
2 1 9
4 11 2 8 14
3 6 12 13

output:

7

result:

ok 1 number(s): "7"

Test #4:

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

input:

4
1 1
1 2
1 3
1 4

output:

4

result:

ok 1 number(s): "4"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

100
4 372861091 407948190 424244630 359746969
6 568180757 527358812 494745349 665803213 674832670 586694351
4 696340797 775899164 919971335 716827187
4 123145962 344250363 122030550 251739234
4 342654413 368648894 150539766 255189030
1 194505887
3 755984448 736803561 745474041
4 709314938 498953418 ...

output:

177

result:

ok 1 number(s): "177"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

100
5 128474911 128789041 128389100 128571722 128449204
4 190783009 179144907 191954599 169739385
7 922968028 923017780 923012667 922993373 923012653 923010830 922983606
1 399117777
8 693609160 693615962 692956804 692902832 694104582 693605539 693750551 692909362
4 133590022 156691169 120354087 1477...

output:

175

result:

ok 1 number(s): "175"

Test #7:

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

input:

100
3 667874577 779650612 311873157
4 315088665 510831928 558038267 371108692
9 755153639 761562353 770756971 766146687 755341778 756786965 752029435 762376276 769269467
6 104846116 127832365 303763622 308914288 193368850 212600340
4 278400790 520739777 691975492 363532266
3 882063076 834874749 8790...

output:

188

result:

ok 1 number(s): "188"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

100
3 906356952 850278493 852337285
4 171262913 167082071 210705401 185031512
7 802495630 790288362 821278829 774987331 774050880 798490416 758938148
5 15709100 243583562 406822217 439043410 105298894
3 615900896 610909553 657678763
4 829696557 810959924 841612668 819869747
6 853997379 864469575 881...

output:

180

result:

ok 1 number(s): "180"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

100
4 364081200 540650381 353768306 122255830
7 936882622 937778158 941372288 943745873 947703805 938067346 944019473
7 598655091 679073706 723959930 579018281 860392698 852744534 665808681
1 557290205
3 838323287 764154463 864559801
4 952241609 888202173 792726290 886689636
6 653946054 841409940 83...

output:

175

result:

ok 1 number(s): "175"

Test #10:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

100
1 440195292
6 859787120 847131414 854112709 869067609 839981608 845676179
5 206450888 209708811 207370111 201853766 207539046
1 555976272
1 938758019
1 413646308
9 252799098 254947888 265345550 249752370 261338550 251583211 248642444 266900460 261558897
5 83936282 116530372 99708225 112074514 96...

output:

151

result:

ok 1 number(s): "151"

Test #11:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

100
1 146185204
6 852896086 841680008 855876871 835965157 843755423 851708745
1 629541324
6 85793267 91650449 93510560 99883657 85654258 98526112
3 495860961 497537876 493169484
5 454856746 450383319 452706190 450318327 452142745
6 183708510 180433221 182527046 181726412 181810362 181409052
4 692428...

output:

145

result:

ok 1 number(s): "145"

Test #12:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

100
5 689258498 593041024 495586014 514329370 820761943
7 205596594 194826463 204043065 193869609 214940002 212820377 193426959
7 765457074 564861616 742278670 649051551 719680647 625298040 628377100
7 964607721 975206807 980916305 899670280 950317349 907764973 966416652
14 583444762 587440679 37759...

output:

173

result:

ok 1 number(s): "173"

Test #13:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

100
4 333222379 411834962 321666960 375921743
6 469180085 599687470 434726418 542075515 468647205 585607083
3 329659185 334204906 442317787
7 407887487 331741182 273383133 416410227 418383971 588307977 271852141
4 865515303 869035169 860812055 861392741
5 641667472 860601686 753823004 793512791 9956...

output:

178

result:

ok 1 number(s): "178"

Test #14:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

100
7 690642381 613166525 688304596 634201428 562397003 633948538 679003753
4 47850900 39815477 89901918 122900559
1 531415583
6 138747627 198265925 498060210 473915860 275869244 10468108
6 855057160 887426020 927043300 863676485 864198874 851240046
5 692386595 513354859 610032533 595928682 63699127...

output:

175

result:

ok 1 number(s): "175"

Test #15:

score: 0
Accepted
time: 123ms
memory: 18684kb

input:

200000
1 158728811
3 820213140 695694229 890491786
2 223397517 576636349
3 886287626 840274568 787379583
2 531893033 375811452
4 208941903 362012920 456886582 677484638
2 658936887 741915526
1 163021123
3 102990858 99833598 128050246
2 880927685 395844417
2 582184019 506099921
2 503081931 890511277
...

output:

371392

result:

ok 1 number(s): "371392"

Test #16:

score: 0
Accepted
time: 132ms
memory: 18824kb

input:

200000
4 527049088 576020440 539124238 528502432
4 103304993 110505705 218405655 9254609
2 531392825 552345130
2 153934319 348864359
3 326816216 71550071 319235642
2 672438614 577449099
1 987667909
4 350329232 455028270 302082072 522653010
4 897538960 713329535 762632225 710820739
3 514060771 339989...

output:

371318

result:

ok 1 number(s): "371318"

Test #17:

score: 0
Accepted
time: 126ms
memory: 18684kb

input:

200000
3 874943438 546004813 507400569
2 483105021 364422434
2 275411026 254788551
2 708265881 687362339
3 218906620 351275670 268755597
1 467105066
3 819559064 790247463 817165748
1 970131791
4 219377698 221772069 277674473 292495413
1 200146464
2 850141746 908404899
1 309046733
2 311910499 5859450...

output:

371614

result:

ok 1 number(s): "371614"

Test #18:

score: 0
Accepted
time: 124ms
memory: 18828kb

input:

200000
3 93682084 96073317 179761316
2 499962770 162915432
1 999584091
5 939952415 898712858 869060970 942886905 920106350
2 437796243 672698419
2 970505146 993912024
3 871782821 872319087 818304708
2 888310686 959163381
2 38105511 691834614
2 905703817 935917761
2 599540273 825738795
1 344807309
3 ...

output:

371671

result:

ok 1 number(s): "371671"

Test #19:

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

input:

200000
2 334259130 302821824
3 664423361 720176530 824377961
1 796836198
2 826207789 793267461
3 556670216 454153489 584319445
4 172511854 210668874 139478238 11132315
2 386520917 216809653
2 897449437 759949511
2 773459959 864938043
1 337248305
2 36892453 64751348
4 875441112 883307374 857201990 90...

output:

371431

result:

ok 1 number(s): "371431"

Test #20:

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

input:

200000
3 15180757 211957380 196307347
3 885237955 877473998 891408818
3 527959489 966372326 623116540
2 116250496 196819637
4 749133092 606791247 867630877 756654095
1 433166056
4 922504811 845536998 716730303 836804118
2 780726579 782822569
1 543764901
4 833829333 571953795 776159760 819478189
3 40...

output:

371213

result:

ok 1 number(s): "371213"

Test #21:

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

input:

200000
2 805842744 581609804
2 734227758 733064953
2 989774966 942880204
2 628257088 63946269
2 583848176 911813757
4 691317022 781500071 996319911 435048080
3 794873372 718581447 531638733
3 980221944 947251248 970539493
2 3861235 452095431
3 227824664 425339258 400130407
1 744456362
2 75860498 428...

output:

371418

result:

ok 1 number(s): "371418"

Test #22:

score: 0
Accepted
time: 123ms
memory: 18812kb

input:

200000
4 765248606 58641312 461505864 48058936
3 530497192 74608066 187318400
2 760807063 462798246
3 829369025 850399705 861318513
1 610260849
4 840112564 619362793 672743435 984829729
2 254124774 801464441
3 762528829 691988008 647617371
4 158351130 690785043 135019901 441491859
1 88740299
4 97607...

output:

371430

result:

ok 1 number(s): "371430"

Test #23:

score: 0
Accepted
time: 123ms
memory: 18684kb

input:

200000
3 260017688 247206101 245341550
3 528907971 401175380 519150579
2 751738818 699510603
2 761128342 838467598
1 671361404
4 951730690 940117575 944967225 934430806
3 273582273 423597064 390919521
3 800578214 757476170 793151055
4 154531575 169715009 226492241 234234388
3 791708466 641989170 684...

output:

371722

result:

ok 1 number(s): "371722"

Test #24:

score: 0
Accepted
time: 132ms
memory: 18768kb

input:

200000
2 77875703 98417625
1 580863835
3 328175215 539412729 441689644
4 519986810 532514024 524724699 522062026
4 495150066 502888818 208873688 519737098
1 467977355
2 481764791 265552887
3 514214795 546606435 874871364
4 157881601 327298118 568566685 173899494
1 408646380
1 248681217
2 803252090 9...

output:

371459

result:

ok 1 number(s): "371459"

Test #25:

score: 0
Accepted
time: 123ms
memory: 19132kb

input:

200000
3 617019209 617017532 617017307
3 970339026 970356059 970348843
3 558398372 558216433 558343400
2 346653959 346876820
1 281458709
1 967860014
4 475956654 475955112 475982395 475983808
3 499143819 499137223 499221662
4 723910593 723909360 723829452 724024083
3 519143186 519253790 519321105
1 5...

output:

365869

result:

ok 1 number(s): "365869"

Test #26:

score: 0
Accepted
time: 128ms
memory: 19612kb

input:

200000
3 576685712 576687248 576688432
3 767079880 767012338 767023712
2 809256364 809272790
3 394124992 394073184 394092525
2 759516270 759428114
1 895219353
3 438371420 438426848 438410444
2 310767315 310839932
1 202464867
2 603282846 603356839
1 782566135
2 650736061 650648190
3 647048066 6470414...

output:

357282

result:

ok 1 number(s): "357282"

Test #27:

score: 0
Accepted
time: 131ms
memory: 19416kb

input:

200000
2 982301221 982233632
2 911767146 911829091
2 486037419 485943061
3 505146942 505224831 505204823
1 632133123
1 489557731
2 703344129 703366051
2 650398414 650390190
3 394534473 394580673 394585491
3 126075457 125986865 126013358
3 794657480 794590085 794642851
3 787812105 787818979 787840359...

output:

361549

result:

ok 1 number(s): "361549"

Test #28:

score: 0
Accepted
time: 139ms
memory: 18768kb

input:

200000
3 913660216 914036470 913841789
3 317845899 317670209 318337619
3 94610832 94539407 94537481
3 369813385 369465271 369523389
1 68655150
2 361720346 361397713
2 841915577 842209587
3 656553414 656388735 656706235
3 612612056 612998341 613140059
1 621038044
2 349678682 348811194
2 221887705 221...

output:

370229

result:

ok 1 number(s): "370229"

Test #29:

score: 0
Accepted
time: 123ms
memory: 18624kb

input:

200000
1 5642826
3 461063276 460468925 460613639
2 640527131 640588995
2 671932901 672143977
1 903027019
3 540766029 540483743 540269503
2 207757030 208217727
4 861139257 861051707 861078118 861077332
2 481255334 480974330
4 362981126 362943325 363022442 362988716
3 32203238 31650608 31764601
3 2866...

output:

369419

result:

ok 1 number(s): "369419"

Test #30:

score: 0
Accepted
time: 140ms
memory: 18648kb

input:

200000
2 505843259 505239454
3 723724918 723066584 723626111
1 86353949
2 214624116 214296544
3 167340181 167349779 167349587
2 350159908 350055188
3 379611811 379777377 379736400
2 876593838 876020897
2 963121551 963616157
2 936958144 937428994
2 689150609 688504031
2 9155490 8854750
2 609202639 60...

output:

370156

result:

ok 1 number(s): "370156"

Test #31:

score: 0
Accepted
time: 131ms
memory: 18648kb

input:

200000
2 421023837 420532799
3 531618132 531445793 531709271
1 916087065
2 699008541 698624333
2 555767036 555551138
3 620708586 620458919 620677285
2 881807045 881737135
3 486057243 485868230 485677837
2 507150411 507385192
3 89817461 89710261 89983728
3 290522225 290842137 290675086
2 705362131 70...

output:

368946

result:

ok 1 number(s): "368946"

Test #32:

score: 0
Accepted
time: 134ms
memory: 18640kb

input:

200000
2 905633261 905206014
3 575923853 575782402 576003616
1 575598461
1 834510366
3 144611707 144515175 144650402
1 384852119
4 205355179 205334200 205501346 205449577
2 270991591 271127063
2 495751300 495484348
4 678430204 678417774 678431544 678361285
2 445073250 444680651
3 480881024 481306492...

output:

368270

result:

ok 1 number(s): "368270"

Test #33:

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

input:

200000
1 626521854
2 985585113 985627840
3 528981816 529078225 529059028
4 931259243 931256646 931257141 931272876
2 5007153 4940473
1 839142863
2 867034659 866845260
2 953839484 953953044
2 739864025 739996079
2 883921952 884014431
1 261276759
3 527037541 527045605 527036030
2 366891875 366795240
2...

output:

365216

result:

ok 1 number(s): "365216"

Test #34:

score: 0
Accepted
time: 121ms
memory: 18696kb

input:

200000
3 130403137 130366909 130194098
3 444112904 444337243 444072211
2 768086779 767960882
2 406264114 406110368
3 437808387 437884200 438028260
5 978027579 977966850 977965648 978112580 978097916
2 153010807 153103181
3 220787828 221103689 221093744
2 235703371 235785772
4 771852620 771566039 771...

output:

367761

result:

ok 1 number(s): "367761"

Test #35:

score: 0
Accepted
time: 138ms
memory: 23660kb

input:

200000
5 558945239 558945928 558943942 558945170 558945737
2 389787163 389792339
2 74806397 74808912
2 55617410 55611498
1 324837485
3 754994327 754992763 754989423
2 363304227 363296230
3 808094401 808092569 808094084
3 410017026 410019024 410018730
4 898729558 898732123 898729121 898737342
2 38193...

output:

276845

result:

ok 1 number(s): "276845"

Test #36:

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

input:

200000
2 518360824 518358206
2 191668672 191669366
2 935996045 935994928
1 850383035
1 788218187
3 663684476 663685267 663684584
1 162622934
3 787962954 787963115 787963294
3 25278834 25278408 25277667
2 63992522 63992288
1 663818394
4 593268425 593267729 593267039 593268062
2 318922332 318923592
3 ...

output:

236492

result:

ok 1 number(s): "236492"

Test #37:

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

input:

200000
4 267231572 267233362 267231090 267232229
3 369507739 369514281 369508814
4 201172110 201172200 201172181 201172131
2 491220938 491216192
2 730896077 730890252
2 612884415 612879742
1 536950252
4 575368661 575370232 575370393 575369157
4 257033226 257030222 257033180 257031916
3 585294372 585...

output:

273351

result:

ok 1 number(s): "273351"

Test #38:

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

input:

200000
3 566095999 566092870 566094678
3 984068387 984070345 984069502
3 138323865 138323833 138322973
2 542288406 542290327
2 507765539 507764712
2 713224135 713223325
3 928733270 928735231 928735267
2 957120558 957118498
3 969011138 969013422 969008960
3 402754725 402758793 402759300
3 399627655 3...

output:

254345

result:

ok 1 number(s): "254345"

Test #39:

score: 0
Accepted
time: 142ms
memory: 22912kb

input:

200000
2 392294863 392290519
3 925295549 925295237 925293414
3 31291412 31290096 31290048
3 503130208 503130989 503130920
1 854299590
2 186631704 186636077
2 483487036 483491802
2 309616236 309619439
3 240744850 240745700 240747833
3 888531868 888533414 888529049
1 103607824
3 41224178 41226677 4122...

output:

256177

result:

ok 1 number(s): "256177"

Test #40:

score: 0
Accepted
time: 138ms
memory: 23340kb

input:

200000
2 103843152 103845730
3 879227516 879228541 879229642
3 494916225 494918201 494919305
3 146769932 146766491 146766576
2 173619997 173615931
4 185620583 185620918 185623038 185620715
3 193142038 193138810 193141945
2 563557506 563560017
2 1908290 1905465
2 280707691 280704304
4 223205511 22320...

output:

250398

result:

ok 1 number(s): "250398"

Test #41:

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

input:

200000
2 696528247 696522824
1 178935789
4 36387478 36386591 36382883 36387422
2 86570813 86568209
4 989298652 989294069 989294917 989295041
1 65114809
2 755158941 755158878
1 186946953
3 176201064 176203737 176201942
2 944603662 944607202
2 575524708 575519520
4 766842235 766842590 766842354 766842...

output:

271959

result:

ok 1 number(s): "271959"

Test #42:

score: 0
Accepted
time: 139ms
memory: 24316kb

input:

200000
3 749205719 749202912 749203829
2 5377061 5377245
3 503264299 503266067 503266433
3 632554834 632556461 632556153
4 965476893 965477329 965477317 965477446
3 208932812 208932527 208934029
3 795257538 795253978 795254287
2 138721042 138723986
2 658527364 658526206
3 996446437 996442493 9964436...

output:

262249

result:

ok 1 number(s): "262249"

Test #43:

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

input:

200000
3 964057743 964057976 964057406
2 805606333 805606172
4 142444963 142444747 142444846 142445104
2 82101268 82101634
3 62177317 62177601 62177813
5 410442213 410442190 410442012 410442356 410442120
2 753639083 753639435
2 700591198 700591224
4 565412060 565412399 565412262 565411998
1 96467795...

output:

210596

result:

ok 1 number(s): "210596"

Test #44:

score: 0
Accepted
time: 146ms
memory: 23372kb

input:

200000
2 968575583 968578668
4 160579109 160578771 160580539 160579230
1 755666097
2 894917692 894917969
4 578187568 578186486 578184905 578188301
2 401064917 401063343
2 667538593 667540787
2 570054428 570051584
4 756751493 756755077 756755343 756752274
1 985868889
2 959546854 959547389
3 852668978...

output:

247557

result:

ok 1 number(s): "247557"

Test #45:

score: 0
Accepted
time: 121ms
memory: 20252kb

input:

200000
2 60882 60874
2 358279 358263
2 64170 64172
2 123201 123195
2 371206 371213
2 61094 61091
2 391694 391686
3 196668 196666 196667
2 80737 80738
2 199176 199184
2 294108 294086
2 212112 212122
2 75899 75908
2 225488 225470
2 127616 127614
3 317897 317905 317898
2 379444 379430
2 300111 300112
3...

output:

329555

result:

ok 1 number(s): "329555"

Test #46:

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

input:

200000
2 209467 209468
2 164157 164149
2 184342 184349
2 164156 164158
2 110706 110710
2 39463 39460
2 113928 113927
2 205838 205841
2 306143 306129
4 275406 275403 275408 275404
2 412541 412538
2 317739 317741
3 291160 291156 291150
2 82119 82083
2 278898 278892
2 212102 212097
2 313587 313599
2 59...

output:

329719

result:

ok 1 number(s): "329719"

Test #47:

score: 0
Accepted
time: 113ms
memory: 20384kb

input:

200000
3 137698 137700 137702
3 278579 278584 278586
2 49291 49294
2 343508 343506
2 158542 158544
2 98799 98795
2 223047 223048
2 153272 153280
2 308769 308766
4 429434 429433 429429 429432
2 221383 221377
2 249481 249482
3 120759 120760 120757
2 47343 47341
2 429817 429818
2 232253 232265
2 111212...

output:

328843

result:

ok 1 number(s): "328843"

Test #48:

score: 0
Accepted
time: 118ms
memory: 20152kb

input:

200000
2 47775 47777
2 411748 411747
2 267044 267045
2 195305 195306
2 311467 311462
3 278212 278214 278215
2 400302 400304
2 213026 213020
3 79161 79165 79174
2 316138 316147
2 343527 343540
2 93576 93577
2 135788 135794
2 374451 374469
2 329940 329947
2 81335 81333
2 291446 291444
2 103486 103492
...

output:

329511

result:

ok 1 number(s): "329511"

Test #49:

score: 0
Accepted
time: 110ms
memory: 20260kb

input:

200000
2 125118 125109
2 360649 360650
2 276295 276294
2 160863 160885
3 104093 104095 104096
2 341881 341883
2 211049 211039
2 326973 326965
2 71497 71499
3 418856 418852 418854
2 202609 202604
2 24380 24376
2 46054 46043
2 324577 324573
2 304157 304163
2 373801 373800
2 70889 70888
2 219323 219336...

output:

329628

result:

ok 1 number(s): "329628"

Test #50:

score: 0
Accepted
time: 119ms
memory: 20180kb

input:

200000
2 391330 391316
2 51499 51495
2 94596 94598
2 44958 44956
2 377568 377565
4 226057 226080 226056 226047
2 194333 194336
2 60439 60448
3 429538 429536 429537
3 333095 333096 333094
2 413331 413335
2 47038 47036
2 306045 306051
3 427858 427854 427861
4 347978 347977 347976 347975
2 33092 33094
...

output:

329751

result:

ok 1 number(s): "329751"

Test #51:

score: 0
Accepted
time: 126ms
memory: 20324kb

input:

200000
2 60520 60518
2 136931 136919
2 203304 203303
3 283564 283573 283577
3 92060 92056 92058
3 410733 410736 410728
2 397291 397287
2 40980 40969
2 96117 96121
3 193303 193297 193306
2 191390 191386
2 188085 188078
2 43791 43799
2 394779 394753
3 276707 276709 276703
2 134677 134672
2 238373 2383...

output:

329363

result:

ok 1 number(s): "329363"

Test #52:

score: 0
Accepted
time: 122ms
memory: 20212kb

input:

200000
2 186130 186138
3 394334 394332 394326
2 67803 67800
2 339923 339920
2 25482 25483
2 425823 425818
2 400302 400303
2 431044 431025
2 378983 378976
3 217733 217743 217714
2 355042 355027
4 108284 108293 108281 108269
2 129544 129541
2 57799 57800
2 385629 385628
2 22049 22052
3 309175 309176 3...

output:

329231

result:

ok 1 number(s): "329231"

Test #53:

score: 0
Accepted
time: 114ms
memory: 20264kb

input:

200000
2 260916 260952
2 103316 103313
2 370073 370104
2 185152 185166
2 356449 356446
2 333940 333945
2 394251 394253
2 124769 124778
2 44947 44948
2 272206 272207
2 242641 242649
2 308854 308861
2 324622 324621
2 116349 116345
3 372498 372490 372492
2 298308 298307
2 314143 314144
2 260125 260130
...

output:

328963

result:

ok 1 number(s): "328963"

Test #54:

score: 0
Accepted
time: 123ms
memory: 20160kb

input:

200000
2 76557 76561
2 125939 125943
2 264252 264248
2 306335 306347
2 341099 341098
2 393964 393947
2 376078 376070
2 56016 56020
2 141103 141101
3 229993 229994 229992
2 269000 268999
2 58463 58455
2 13958 13964
2 221296 221303
2 100418 100390
2 181695 181696
2 336353 336355
2 330630 330627
2 3042...

output:

329632

result:

ok 1 number(s): "329632"

Test #55:

score: 0
Accepted
time: 116ms
memory: 18080kb

input:

200000
2 234887 234844
2 42359 42362
2 409066 409023
2 36319 36527
2 302358 302377
2 357421 357425
2 251030 250929
2 87871 87824
2 380558 380454
2 261125 261104
2 76831 76818
2 341787 341795
2 89627 89644
2 48047 48077
2 242731 242730
2 161542 161566
2 363865 363885
2 75419 75443
2 140803 140692
2 9...

output:

375679

result:

ok 1 number(s): "375679"

Test #56:

score: 0
Accepted
time: 117ms
memory: 18204kb

input:

200000
2 277517 277524
2 149538 149545
2 59127 59122
2 247347 247329
2 26808 26811
2 226672 226744
2 293996 293907
2 368487 368482
2 197717 197744
2 696 628
2 417312 417289
2 2097 2042
2 170863 170859
2 407358 407423
2 381707 381703
2 50472 50475
2 398101 398099
3 34136 34143 34124
2 41916 41934
3 1...

output:

376859

result:

ok 1 number(s): "376859"

Test #57:

score: 0
Accepted
time: 120ms
memory: 18088kb

input:

200000
3 143263 143321 143378
2 304706 304695
2 32426 32424
2 69792 69849
3 200904 200980 200951
2 148576 148873
2 68195 68202
2 98532 98518
2 203709 203715
2 282914 282908
2 253475 253417
2 273571 273494
3 180620 180632 180605
2 182755 182753
2 62942 62714
2 249915 249892
2 270233 270202
2 243071 2...

output:

376603

result:

ok 1 number(s): "376603"

Test #58:

score: 0
Accepted
time: 115ms
memory: 18260kb

input:

200000
2 102372 102443
2 109676 109703
2 56259 56087
2 191201 191058
2 181141 181134
2 347788 347765
2 43462 43450
2 158056 158055
2 211383 211398
2 322177 322223
2 170348 170242
2 212540 212492
2 51001 51156
2 241429 241423
2 320280 320283
2 296963 296958
2 397019 396780
2 112220 112085
2 99142 991...

output:

376017

result:

ok 1 number(s): "376017"

Test #59:

score: 0
Accepted
time: 118ms
memory: 18028kb

input:

200000
2 292983 292974
2 333736 333713
2 385862 385895
2 52958 52953
2 274316 274293
2 400653 400663
2 387363 387278
2 277488 277105
2 142230 142242
2 286632 286622
3 399439 399250 399278
2 393523 393471
2 81289 81352
2 30728 30785
2 349156 349147
2 417574 417413
2 189669 189512
2 255286 255303
2 13...

output:

376629

result:

ok 1 number(s): "376629"

Test #60:

score: 0
Accepted
time: 119ms
memory: 18104kb

input:

200000
2 180762 180763
2 147080 147205
2 156238 156231
2 345705 345579
3 10655 10741 10593
2 90763 90617
2 29043 28891
2 311172 311633
3 198459 198426 198468
2 359385 359356
2 16641 16640
2 197431 197427
2 260247 260226
2 329047 329129
2 117171 117181
2 152907 152920
2 173688 173658
3 18346 18362 18...

output:

376264

result:

ok 1 number(s): "376264"

Test #61:

score: 0
Accepted
time: 119ms
memory: 18200kb

input:

200000
3 404776 404695 404658
2 221062 221025
2 4751 4757
3 305839 305982 305776
2 238081 238101
2 186285 186287
2 180997 180933
2 30366 30416
2 88997 88998
2 9130 9132
2 350714 350783
2 13991 13955
2 54124 54100
2 377416 377378
2 278983 278941
2 342532 342500
2 418543 418549
3 351184 351181 351172
...

output:

377018

result:

ok 1 number(s): "377018"

Test #62:

score: 0
Accepted
time: 128ms
memory: 18176kb

input:

200000
2 73828 73754
2 183506 183504
2 204539 204543
2 374005 374013
2 32584 32525
2 83365 83375
2 40294 40282
2 271127 271112
2 248154 248173
2 416572 416573
2 52415 52383
2 236081 236096
2 297434 297398
2 371603 371600
3 275944 275943 275962
2 197492 197416
2 272011 272007
2 111402 111322
2 211072...

output:

375033

result:

ok 1 number(s): "375033"

Test #63:

score: 0
Accepted
time: 103ms
memory: 18124kb

input:

200000
3 210302 210200 210157
2 196286 196267
2 393486 393354
2 137253 137261
2 26900 26855
2 275392 275409
2 412138 412105
2 158964 158958
2 153281 153304
2 279259 279254
2 165872 165877
2 130299 130305
2 207852 207855
2 226290 226286
2 36944 36908
3 25354 25331 25332
2 20662 20706
2 250344 250400
...

output:

375542

result:

ok 1 number(s): "375542"

Test #64:

score: 0
Accepted
time: 121ms
memory: 18124kb

input:

200000
2 51646 51582
2 16929 16959
2 30476 30482
2 414212 414180
2 64058 64081
2 61442 61446
2 127944 127860
2 163753 163840
2 297274 297285
2 191820 191830
2 143792 143819
2 418652 418612
2 308680 308659
2 212249 212252
2 254382 254316
2 393096 393129
2 261339 261456
2 386611 386748
2 170037 170113...

output:

376423

result:

ok 1 number(s): "376423"

Test #65:

score: 0
Accepted
time: 118ms
memory: 17288kb

input:

200000
2 57318 53865
2 260825 258959
2 361209 361660
2 193297 193239
2 300126 300245
3 199518 198873 201141
2 155578 155942
2 172833 173118
4 275695 276481 276459 276210
2 232600 232536
3 369083 369066 368680
2 368595 369546
2 37241 37129
2 404952 405269
2 212815 213109
2 242701 243984
2 89299 89629...

output:

397499

result:

ok 1 number(s): "397499"

Test #66:

score: 0
Accepted
time: 115ms
memory: 17324kb

input:

200000
2 194347 194311
2 148763 148607
2 374711 374129
2 203279 202900
2 309866 309982
2 100860 100567
2 18521 18573
3 48502 49052 50320
2 270985 270941
2 72948 73022
2 258420 259839
2 409664 409888
2 301188 301095
2 131875 131843
2 259938 259985
2 395756 395566
2 60705 60851
2 297891 297826
2 87651...

output:

396769

result:

ok 1 number(s): "396769"

Test #67:

score: 0
Accepted
time: 115ms
memory: 17412kb

input:

200000
2 225334 224648
2 22342 22091
2 218214 218354
2 408490 408757
3 341504 341646 341439
3 108128 109278 108054
2 356460 356816
2 126091 127137
2 297021 297642
2 54787 55945
2 167767 167862
2 342765 343221
2 76498 76466
2 357539 357544
2 213947 214495
3 229192 229135 229217
3 36041 36077 36086
2 ...

output:

396428

result:

ok 1 number(s): "396428"

Test #68:

score: 0
Accepted
time: 118ms
memory: 17312kb

input:

200000
2 139013 138915
2 223293 223336
2 121149 120915
2 141744 142609
2 237243 237399
2 250580 250286
2 361693 361728
2 254951 255133
2 171190 171194
2 56761 56779
2 212813 213007
2 350764 350809
2 150611 147675
2 148176 148872
2 287177 287284
2 137965 137983
2 97703 98287
2 336520 336628
2 379788 ...

output:

396315

result:

ok 1 number(s): "396315"

Test #69:

score: 0
Accepted
time: 113ms
memory: 17468kb

input:

200000
2 336707 336934
2 38295 38976
2 420320 419556
2 371111 370525
2 80510 80289
2 200501 200518
2 27578 27003
2 270097 269839
2 378835 378465
2 368870 369696
2 378602 378411
2 368352 368599
2 339652 339405
2 120995 120952
2 377086 376463
2 407659 406755
2 27011 27110
2 72704 72765
2 3836 4097
2 2...

output:

397048

result:

ok 1 number(s): "397048"

Test #70:

score: 0
Accepted
time: 131ms
memory: 17312kb

input:

200000
2 190233 190299
2 257862 257855
2 407255 404663
2 285662 285636
2 332870 333588
2 8884 8833
2 339364 339610
2 258328 258284
2 351451 351940
2 73557 73807
2 101973 100367
2 129593 129682
2 46319 44732
2 216541 215257
2 49596 51821
2 359135 359036
2 403837 405095
2 131536 135292
2 232980 232800...

output:

396717

result:

ok 1 number(s): "396717"

Test #71:

score: 0
Accepted
time: 113ms
memory: 17192kb

input:

200000
2 138791 138209
2 338873 338841
2 253216 253252
3 327666 326862 326723
2 102682 101877
2 230018 230129
2 111253 111923
3 342523 343435 343082
2 133668 133961
2 50013 50459
2 243969 243694
2 11674 11320
2 33928 34152
2 52279 52104
2 169450 169245
2 300064 299990
2 23146 25221
2 5558 5698
2 106...

output:

396501

result:

ok 1 number(s): "396501"

Test #72:

score: 0
Accepted
time: 113ms
memory: 17568kb

input:

200000
2 151940 152490
2 111313 111772
2 129025 128488
2 384262 384249
2 271580 271568
2 306547 307337
2 237919 237940
3 412662 411603 413264
3 388399 388095 388273
2 62914 64139
2 266210 266224
2 27859 27099
2 245043 244965
2 123199 122789
2 381589 381594
2 418953 418970
2 121963 122104
2 46104 458...

output:

396024

result:

ok 1 number(s): "396024"

Test #73:

score: 0
Accepted
time: 113ms
memory: 17336kb

input:

200000
2 396937 397309
3 113107 112789 112461
2 363210 363492
2 341938 341809
2 333796 333866
2 272825 273002
2 208268 208314
2 261366 260829
2 273569 273564
2 151060 151276
2 243619 243267
2 184292 184838
2 2572 2357
2 18616 18800
2 263948 263939
2 136663 137229
2 43447 43686
2 240469 240118
3 7637...

output:

396338

result:

ok 1 number(s): "396338"

Test #74:

score: 0
Accepted
time: 118ms
memory: 17240kb

input:

200000
2 139256 139234
2 132623 132257
2 273527 273456
2 340641 340711
2 401607 401661
2 352668 352452
2 364770 364791
2 387852 387439
3 246814 246987 246957
2 32995 32991
2 241572 241671
2 380533 380035
3 286950 288850 288013
2 376580 376636
2 274959 274866
2 24391 24345
2 91670 91596
2 201381 2006...

output:

396247

result:

ok 1 number(s): "396247"

Test #75:

score: 0
Accepted
time: 130ms
memory: 21092kb

input:

200000
3 240378 240369 240375
2 5727 5723
2 298865 298866
2 256554 256553
2 115467 115469
2 437827 437802
2 286400 286396
2 103776 103774
2 426978 426971
2 106194 106187
3 34275 34277 34273
2 144131 144126
2 401757 401752
2 407615 407613
2 47845 47834
2 5491 5495
3 323395 323403 323402
2 82493 82491...

output:

306211

result:

ok 1 number(s): "306211"

Test #76:

score: 0
Accepted
time: 114ms
memory: 20600kb

input:

200000
2 230905 230904
2 228192 228195
2 72035 72029
3 362423 362424 362425
2 228476 228481
3 325312 325311 325314
3 315431 315432 315428
3 97165 97167 97168
2 410110 410106
2 360792 360800
2 234993 235000
2 418578 418584
2 11933 11958
2 107305 107307
2 271683 271680
2 428299 428310
2 226360 226359
...

output:

306516

result:

ok 1 number(s): "306516"

Test #77:

score: 0
Accepted
time: 118ms
memory: 20700kb

input:

200000
2 201269 201266
2 232592 232598
2 357213 357217
3 169963 169956 169942
2 222662 222664
2 62537 62528
2 117788 117786
2 126537 126540
2 422974 422975
2 227636 227640
2 178578 178577
2 350181 350186
2 397290 397299
2 59650 59653
2 82497 82493
3 123918 123926 123923
2 76687 76681
2 132805 132804...

output:

306461

result:

ok 1 number(s): "306461"

Test #78:

score: 0
Accepted
time: 123ms
memory: 20612kb

input:

200000
2 67103 67104
2 97250 97244
2 347416 347430
2 212026 212014
2 414338 414333
2 37226 37225
2 349017 349020
2 370787 370784
2 203159 203149
3 440668 440666 440667
2 91063 91067
2 194264 194262
3 171213 171209 171211
2 393245 393246
2 284884 284883
2 341320 341318
2 147053 147059
3 195966 195965...

output:

306653

result:

ok 1 number(s): "306653"

Test #79:

score: 0
Accepted
time: 120ms
memory: 20840kb

input:

200000
2 135615 135619
3 349272 349273 349271
2 273449 273440
3 164058 164060 164040
2 386232 386224
2 224729 224753
2 85739 85768
2 57933 57925
2 305402 305399
2 322553 322556
2 126866 126862
2 25936 25927
3 226337 226331 226334
2 49864 49867
3 24965 24961 24963
3 139026 139034 139025
2 184002 1839...

output:

306439

result:

ok 1 number(s): "306439"

Extra Test:

score: 0
Extra Test Passed