QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#870614#8620. Jigsaw Puzzleucup-team087#WA 4ms4224kbC++2325.6kb2025-01-25 17:03:322025-01-25 17:03:40

Judging History

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

  • [2025-01-25 17:03:40]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:4224kb
  • [2025-01-25 17:03:32]
  • 提交

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].a,name[i_##name].b);
#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 VMI(name,size) vc<mint> name(size);rep(i_##name,size){INT(tmp_##name);name[i_##name]=tmp_##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,size_t n>
array<t,n>&operator+=(array<t,n>&a,const array<t,n>&b){
	rep(i,n)a[i]+=b[i];
	return a;
}
template<class t,size_t n>
array<t,n>&operator-=(array<t,n>&a,const array<t,n>&b){
	rep(i,n)a[i]-=b[i];
	return a;
}
template<class t,size_t n,class v>
array<t,n>&operator*=(array<t,n>&a,v b){
	rep(i,n)a[i]*=b;
	return a;
}
template<class t,size_t n>
array<t,n> operator+(array<t,n> a,const array<t,n>&b){return a+=b;}
template<class t,size_t n>
array<t,n> operator-(array<t,n> a,const array<t,n>&b){return a-=b;}
template<class t,size_t n,class v>
array<t,n> operator*(array<t,n> a,v b){return 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>;

namespace std{
__float128 abs(__float128 x){
	return x<0?-x:x;
}
__float128 sin(__float128 x){
	return sinl(x);
}
__float128 cos(__float128 x){
	return cosl(x);
}
__float128 acos(__float128 x){
	return acosl(x);
}
__float128 atan2(__float128 y,__float128 x){
	return atan2l(y,x);
}
__float128 sqrt(__float128 x){
	return sqrtl(x);
}
__float128 fmod(__float128 x,__float128 y){
	return fmodl(x,y);
}
ostream&operator<<(ostream&os,__float128 v){
	return os<<(long double)v;
}
istream&operator>>(istream&is,__float128&v){
	long double z;
	is>>z;
	v=z;
	return is;
}
}

//copied from yosupo's library
//PARTLY VERIFIED

//USACO 2022 January ptlatinum C

#define GEOF

#ifdef GEOF
//using ld=long double;
using ld=__float128;
//using ld=double;
const ld PI=acos(ld(-1));
#else
using ld=ll;
#endif
const ld eps=1e-9;
int sgn(ld a){return a<-eps?-1:(a>eps?1:0);}
int sgn(ld a,ld b){return sgn(a-b);}
/*
using pt=complex<ld>;
#define x real()
#define y imag()
*/
struct pt {
    ld x,y;
    //pt(ld _x = ld(0), ld _y = ld(0)) : x(_x), y(_y) {}
    pt():x(0),y(0){}
    pt(ld xx,ld yy):x(xx),y(yy){}
    pt operator+(const pt& r) const { return {x + r.x, y + r.y}; }
    pt operator-(const pt& r) const { return {x - r.x, y - r.y}; }
    pt operator*(const pt& r) const {
        return {x * r.x - y * r.y, x * r.y + y * r.x};
    }
    pt inv()const{
		ld d=norm();
		return {x/d,-y/d};
	}
    pt operator/(const pt&r)const{
		return operator*(r.inv());
	}

    pt operator*(const ld& r) const { return {x * r, y * r}; }
    pt operator/(const ld& r) const { return {x / r, y / r}; }

    pt& operator+=(const pt& r) { return *this = *this + r; }
    pt& operator-=(const pt& r) { return *this = *this - r; }
    pt& operator*=(const pt& r) { return *this = *this * r; }
    pt& operator/=(const pt& r) { return *this = *this / r; }
    pt& operator*=(const ld& r) { return *this = *this * r; }
    pt& operator/=(const ld& r) { return *this = *this / r; }

    pt operator-() const { return {-x, -y}; }

	static int cmp(const pt&a,const pt&b){
		int v=sgn(a.x,b.x);
		return v?v:sgn(a.y,b.y);
	}
    bool operator<(const pt& r) const {
        return cmp(*this,r)<0;
    }
    bool operator<=(const pt& r) const {
        return cmp(*this,r)<=0;
    }
    bool operator>(const pt& r) const {
        return cmp(*this,r)>0;
    }
    bool operator==(const pt& r) const { return sgn((*this - r).rabs()) == 0; }
    bool operator!=(const pt& r) const { return !(*this == r); }
	
	pt conj()const{ return pt(x,-y);}
    ld norm() const { return x * x + y * y; }
    ld rabs() const { return max(std::abs(x), std::abs(y)); }  // robust abs
    ld srabs() const{ return std::abs(x)>std::abs(y)?x:y; } // signed robust abs
    pair<ld, ld> to_pair() const { return {x, y}; }
    #ifdef GEOF
    ld abs() const { return sqrt(norm()); }
    ld arg() const { return atan2(y, x); }
    static pt polar(ld le, ld th) { return {le * cos(th), le * sin(th)}; }
	#endif
};
istream& operator>>(istream& is, pt& p){
	return is>>p.x>>p.y;
}
ostream& operator<<(ostream& os, const pt& p) {
    return os << "pt(" << p.x << ", " << p.y << ")";
}
ld norm(const pt&a){
	return a.norm();
}
ld rabs(const pt&a){
	return a.rabs();
}
ld srabs(const pt&a){
	return a.srabs();
}
#ifdef GEOF
ld abs(const pt&a){
	return sqrt(norm(a));
}
//XXII Opencup Gpt of Ural K
pt normalized(const pt&a){
	return a/abs(a);
}
ld arg(const pt&a){return a.arg();}
//normalize to [-PI,PI)
//Contest 2: ptKU Contest 1, ptTZ Summer 2022 Day 4
ld normarg(ld a){
	ld res=fmod(a+PI,2*PI);
	if(res<0)res+=PI;
	else res-=PI;
	return res;
}
//normalize to [0,2*PI)
//Multiuni2023-10-E
ld normarg_nonnegative(ld a){
	ld res=fmod(a,2*PI);
	if(res<0)res+=2*PI;
	return res;
}
//AOJ1183
//arg between ab
//assume given lengths are valid
ld arg(ld a,ld b,ld c){
	return acos(min(max((a*a+b*b-c*c)/(2*a*b),ld(-1)),ld(1)));
}
//UCUP 2-20-D
ld heron(ld a,ld b,ld c){
	ld s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}
#endif
ld norm(const pt&a,const pt&b){
	return (a-b).norm();
}
ld dot(const pt&a,const pt&b){return a.x*b.x+a.y*b.y;}
ld crs(const pt& a,const pt& b){return a.x*b.y-a.y*b.x;}
ld crs(const pt& a,const pt& b,const pt& c){return crs(b-a,c-a);}
int ccw(const pt& a,const pt& b){return sgn(crs(a,b));}
int ccw(const pt& a,const pt& b,const pt& c){return ccw(b-a,c-a);}
//(-pi,0](0,pi]
int argtype(const pt&a){
	if(sgn(a.y)==0)return a.x<0?1:0;
	return a.y<0?0:1;
}
int argcmp(const pt&a,const pt&b){
	int at=argtype(a),bt=argtype(b);
	if(at!=bt)return at<bt?-1:1;
	return -ccw(a,b);
};
bool argless(const pt&a,const pt&b){return argcmp(a,b)<0;}
//c の位置を聞く関数です,b じゃないです
//(-2)[a,-1](0)[b,1](2)
int bet(pt a,pt b,pt c){
	pt d=b-a;
	ld e=dot(d,c-a);
	if(sgn(e)<=0)return sgn(e)-1;
	return sgn(e-norm(d))+1;
}
//AOJ0153
//三角形 abc に d が含まれるか?0-no,1-edge,2-in
int cont(pt a,pt b,pt c,pt d){
	if(ccw(a,b,c)==-1) swap(b,c);
	return min({ccw(a,b,d),ccw(b,c,d),ccw(c,a,d)})+1;
}
//(a,b) を結ぶ直線を考え,x 座標との交点の y 座標を求める
//(分子,分母)を返す
pair<ld,ld> xcut(const pt&a,const pt&b,ld x){
	return mp(a.y*(b.x-x)-b.y*(a.x-x),b.x-a.x);
}
//XXII Opencup Gpt of Ural K
pt rot90(pt a){
	return pt(-a.y,a.x);
}
#ifdef GEOF
//Multiuni 2024-6-C
pt rot(pt a,ld b){
	ld c=cos(b),s=sin(b);
	return pt(a.x*c-a.y*s,a.x*s+a.y*c);
}
ld xcutval(const pt&a,const pt&b,ld x){
	auto [p,q]=xcut(a,b,x);
	return p/q;
}
//AOJ1183
//Xmas2010 E
//-+ の 順で返す
//a の符号により,small/large が決まる
int qeq(ld a,ld b,ld c,ld&d,ld&e){
	if(sgn(a)==0){
		if(sgn(b)==0)return 0;
		d=-c/b;
		return 1;
	}
	ld f=b*b-4*a*c;
	if(sgn(f)<0)return 0;
	ld g=sqrt(max(f,ld(0)));
	d=(-b-g)/(2*a);
	e=(-b+g)/(2*a);
	return sgn(f)+1;
}
#else
pt normdir(pt a){
	if(a==pt(0,0))return a;
	int g=gcd(a.x,a.y);
	return pt(a.x/g,a.y/g);
}
#endif

ld area2(const vc<pt>&ps){
	ld res=0;
	rep(i,si(ps))res+=crs(ps[i],ps[(i+1)%si(ps)]);
	return res;
}

template<class... Args>void inputpt(Args&... a){(input(a.x,a.y),...);}
#define PT(...) ld __VA_ARGS__;inputpt(__VA_ARGS__)
#define VPT(name,size) vc<pt> name(size);rep(i_##name,size)inputpt(name[i_##name]);

using affine=pair<pt,pt>;
pt applied(const pt&v,const affine&a){
	return v*a.a+a.b;
}
void applya(pt&v,const affine&a){
	v=applied(v,a);
}
affine get_affine(pair<pt,pt> from,pair<pt,pt> to){
	pt a=from.b-from.a;
	pt b=to.b-to.a;
	pt r=b*a.conj()/a.norm();
	pt off=to.a-from.a*r;
	affine res(r,off);
	assert(applied(from.a,res)==to.a);
	assert(applied(from.b,res)==to.b);
	return res;
}
ld clamp(ld v){
	return max<ld>(0,min<ld>(v,1));
}

void slv(){
	INT(n);
	vvc<pt> ps(n);
	unionfind uf(n);
	vc<bool> corner(n);
	rep(i,n){
		INT(m);
		VPT(ls,m);
		ps[i]=ls;
	}
	{
		bool found=false;
		rep(i,n){
			rep(j,si(ps[i])){
				pt &a=ps[i][j],&b=ps[i][(j+1)%si(ps[i])],&c=ps[i][(j+2)%si(ps[i])];
				if(ccw(a,b,c)>0&&sgn(dot(b-a,c-b))==0){
					dmp2(a,b,c);
					ld d=abs(c-b);
					affine z=get_affine(mp(b,c),mp(pt(),pt(d,0)));
					for(auto&v:ps[i])
						applya(v,z);
					dmp2(a,b,c);
					found=true;
					corner[i]=true;
					goto done;
				}
			}
		}
		done:;
		assert(found);
	}
	dmp(ps);
	//map<ld,vc<pi>> qs;
	vc<tuple<ld,int,int>> qs;
	rep(i,n)rep(j,si(ps[i])){
		pt a=ps[i][j],b=ps[i][(j+1)%si(ps[i])];
		//qs[abs(b-a)].eb(i,j);
		qs.eb(abs(b-a),i,j);
	}
	soin(qs);
	//for(auto [key,val]:qs){
	//	assert(si(val)<=2);
	//	if(si(val)==2){
	rep(step,si(qs)-1){
		auto [d0,i,j]=qs[step];
		auto [d1,u,v]=qs[step+1];
		if(sgn(d0,1)!=0&&sgn(d0,d1)==0){
			if(!uf.same(i,u)){
				if(corner[uf.find(u)]){
					swap(i,u);
					swap(j,v);
				}
				{
					pt a=ps[i][j],b=ps[i][(j+1)%si(ps[i])];
					pt d=ps[u][v],c=ps[u][(v+1)%si(ps[u])];
					affine z=get_affine(mp(c,d),mp(a,b));
					rep(k,n)if(uf.same(k,u)){
						for(auto&p:ps[k])applya(p,z);
					}
				}
				uf.unite(i,u);
			}
		}
	}
	assert(uf.c==1);
	rep(i,n){
		for(auto v:ps[i])print(clamp(v.x),clamp(v.y));
	}
}

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: 0ms
memory: 4096kb

input:

4
4
0.440405375916 0.778474079786
0.000000000000 0.090337001520
0.469097990019 0.000000000000
0.702887505082 0.689470121906
4
0.222810526978 0.000000000000
0.270828246634 0.522212063829
0.000000000000 0.547114887265
0.021480010612 0.069880870008
4
0.000000000000 0.312825941471
0.358219176380 0.00000...

output:

0.27716163632404381147 0.00000000000000000000
0.47326243136115248635 0.79311664451453430338
0.00000000000282426995 0.72802924828228378319
0.00000000000000000000 0.00000000000000000000
0.52441504651755252019 0.99999999999777491031
0.00000000000389608797 1.00000000000000000000
0.00000000000282426995 0...

result:

ok OK

Test #2:

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

input:

2
4
1.187724454426 0.260257896229
0.903481480651 1.219010174901
0.000000000000 0.951153431795
0.309873903757 0.000000000000
4
0.516015116935 0.888042716318
0.000000000000 0.031046166652
0.048574738349 0.000000000000
0.587115596943 0.842599396881

output:

0.00000000000000000000 0.99999999999960384196
0.00000000000000000000 0.00000000000000000000
0.94235132551860771810 0.00000000000000000000
0.91561769415992951319 0.99999999999969325649
0.91561769415992951319 0.99999999999969325649
0.94235132551860771810 0.00000000000000000000
0.99999999999996960651 0...

result:

ok OK

Test #3:

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

input:

2
4
0.010984487654 0.637154242202
0.000000000000 0.364429379044
0.986132728982 0.000000000000
1.010174362438 0.596910060881
4
1.051085498217 0.708750184397
0.000000000000 0.686709156365
0.238826458657 0.000000000000
1.183335588457 0.328485165151

output:

1.00000000000000000000 0.00000000000000000000
1.00000000000000000000 0.27294598358204632895
0.00000000000007935223 0.59739402484473493857
0.00000000000000000000 0.00000000000000000000
0.00000000000007935223 0.59739402484473493857
1.00000000000000000000 0.27294598358204632895
0.99999999999981422272 1...

result:

ok OK

Test #4:

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

input:

2
4
0.826904615568 0.393527743434
0.397181437913 1.296488423966
0.078224855062 1.144695506210
0.000000000000 0.000000000000
4
1.022875732881 0.126407334306
0.000000000000 0.646188215994
0.027327732878 0.000000000000
1.026434680216 0.042252902634

output:

0.00000000000051995792 1.00000000000000000000
0.00000000000000000000 0.00000000000000000000
0.35323418807480485348 0.00000000000000000000
0.91577034681238195360 0.99999999999980525739
0.91577034681238195360 0.99999999999980525739
0.35323418807480485348 0.00000000000000000000
0.99999999999924580414 0...

result:

ok OK

Test #5:

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

input:

2
4
0.341358383182 1.391325004482
0.000000000000 0.397880525310
0.531982366752 0.000000000000
1.130916074772 0.800798609763
4
1.051975365355 0.325235570274
0.003475133323 0.261167306728
0.000000000000 0.247567137365
0.968870740861 0.000000000000

output:

1.00000000000000000000 0.98596286502522484591
0.00000000000000000000 0.66431479808598346896
0.00000000000000000000 0.00000000000000000000
1.00000000000000000000 0.00000000000000000000
0.00000000000000000000 0.66431479808598346896
1.00000000000000000000 0.98596286502522484591
1.00000000000000000000 1...

result:

ok OK

Test #6:

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

input:

2
4
0.082220615826 0.000000000000
0.226158368535 0.989676141653
0.157074587283 1.000663841224
0.000000000000 0.013077098690
4
0.796463091415 0.000000000000
1.301438005407 0.863236513506
0.516366280506 1.336613199533
0.000000000000 0.480245367141

output:

0.99999999999955068553 0.08325407003236947681
0.00000000000000000000 0.06995211486393202873
0.00000000000000000000 0.00000000000000000000
0.99999999999952099498 0.00000000000000000000
0.00000000000000000000 0.06995211486393202873
0.99999999999955068553 0.08325407003236947681
0.99999999999981215314 1...

result:

ok OK

Test #7:

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

input:

2
4
0.919168715346 1.052156329422
0.000000000000 0.740689700679
0.930075742206 0.000000000000
1.240100800584 0.105054119170
4
1.147942957461 0.000000000000
1.169807209495 0.019794683310
0.498656378683 0.761115506098
0.000000000000 0.309659628218

output:

0.99999999999971725574 0.00000000000000000000
0.99999999999900827393 0.97050635654350341289
0.00000000000000000000 0.32734065555147113361
0.00000000000000000000 0.00000000000000000000
0.99999999999900827393 0.97050635654350341289
0.99999999999849897495 1.00000000000000000000
0.00000000000000000000 0...

result:

ok OK

Test #8:

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

input:

3
4
0.000000000000 0.136914050437
1.205473860654 0.000000000000
1.271801552152 0.076389603324
0.516716328492 0.732016253949
4
0.193356841190 1.008675084911
0.000000000000 0.998661755544
0.051717482677 0.000000000000
0.069051074671 0.000897651020
4
0.189612940043 1.009339071474
0.000000000000 0.01178...

output:

0.99999999999974019686 0.78812587621209996412
0.00000000000000000000 0.10116686293175218020
0.00000000000000000000 0.00000000000000000000
0.99999999999971401831 0.00000000000000000000
0.99999999999945710132 0.80638405334376762310
0.99999999999969166266 1.00000000000000000000
0.00000000000000000000 1...

result:

ok OK

Test #9:

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

input:

4
5
0.933026549197 0.034096050827
1.030580221284 0.341877704707
0.077317792660 0.644021283449
0.000000000000 0.400083791499
0.816713028753 0.000000000000
5
0.000000000000 0.567232254210
0.177744443744 0.000000000000
0.278219549927 0.015709015317
0.955605106642 0.861917658609
0.954247706440 0.8662495...

output:

0.00000000000040816886 0.32287190246716427770
0.00000000000000000000 0.00000000000000000000
1.00000000000000000000 0.00000000000000000000
1.00000000000000000000 0.25589752058328166747
0.10057540616276615168 0.39051777000798969092
0.00000000000019146229 0.99999999999791446524
0.00000000000072877600 0...

result:

ok OK

Test #10:

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

input:

4
4
0.578470606282 0.000000000000
1.060885700639 0.240610189702
0.817167310798 0.691089665380
0.000000000000 0.248985836080
4
0.000000000000 0.520597380570
0.022799149709 0.000000000000
0.882566155159 0.037652814638
0.461438543132 0.525442723877
4
0.057126159280 0.427841981239
0.000000000000 0.38584...

output:

0.53879133060654024469 0.49425190379509195649
0.00000000000000000000 0.51218201018174725186
0.00000000000000000000 0.00000000000000000000
0.92909537170225892040 0.00000000000000000000
0.99999999999994150577 0.47890362322879001164
0.99999999999988285971 1.00000000000000000000
0.13940890190967280139 1...

result:

ok OK

Test #11:

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

input:

3
3
0.823899373670 0.782629779690
0.288601744213 0.945945553033
0.000000000000 0.000000000000
5
0.919151534064 0.575061183684
0.169973459288 1.263242535288
0.000000000000 1.135836341471
0.145355826013 0.008808731413
0.151958544733 0.000000000000
4
1.000848179486 0.040130744019
0.991701546880 0.26786...

output:

0.00000000000000000000 0.55965667504721662486
0.00000000000000000000 0.00000000000000000000
0.98899138321104400535 0.00000000000000000000
1.00000000000000000000 0.95879113880928126389
0.00000000000000000000 0.77207916699510471879
0.00000000000000000000 0.55965667504721662486
0.98899138321104400535 0...

result:

ok OK

Test #12:

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

input:

3
4
0.784316497399 0.634251077946
0.006801703755 1.263115726074
0.000000000000 1.254706245103
0.271325510967 0.000000000000
4
0.176866080715 0.000000000000
1.325780121566 0.313426050448
1.266765536888 0.366283123599
0.000000000000 0.158412084360
4
0.637108390812 0.412967145896
0.087765752860 1.24856...

output:

0.00000000002501716714 1.00000000000000000000
0.00000000000000000000 0.00000000000000000000
0.01081584690037688187 0.00000000000000000000
0.81574149218790780971 0.99999999998021254425
0.24825215199878159475 0.00000000000000000000
0.89496643388437742563 0.99999999997915396487
0.81574149218790780971 0...

result:

ok OK

Test #13:

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

input:

6
4
0.921652078321 0.149600568920
0.078937119587 0.337059477836
0.000000000000 0.296726127108
0.743849912614 0.000000000000
4
1.023501554022 0.000000000000
0.951768850516 0.475614028074
0.000000000000 0.332067057777
0.284068099668 0.057351469275
4
0.049230909949 0.111307311191
0.213550746194 0.00000...

output:

0.19846996274262363472 0.99999999999724513270
0.72261121045938620454 0.31400780132743607130
0.80897963916311266730 0.29404928052147618340
0.43083592485930391578 0.99999999999591271437
0.00000000000048241360 0.48099301913131272058
0.00000000000000000000 0.00000000000000000000
0.96253294878357060517 0...

result:

ok OK

Test #14:

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

input:

5
4
0.000000000000 0.055459913902
0.998460914583 0.000000000000
1.018410323962 0.359155002823
0.013840567536 0.304635665324
4
0.500064513905 0.019086089913
0.674971706538 0.000000000000
0.813263023860 0.224894936058
0.000000000000 0.724982740923
4
0.731666528739 0.764701825648
0.735437510038 0.80982...

output:

0.00000000000024778079 0.99999999999996903746
0.00000000000000000000 0.00000000000000000000
0.35970862512227875563 0.00000000000000000000
0.24955984534087326688 0.99999999999989513662
0.66062877441248735850 0.15898980795206362897
0.73598821861287000624 0.00000000000000000000
1.00000000000000000000 0...

result:

ok OK

Test #15:

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

input:

5
3
0.000000000000 0.061747330599
0.247806449221 0.000000000000
0.229822253050 0.275345649819
5
0.538394745273 0.029328826979
0.968971368133 0.672420034382
0.916291764826 0.738725056183
0.000000000000 0.284470622299
0.226013039857 0.000000000000
4
0.014373491307 0.145007400418
1.026752147154 0.00000...

output:

1.00000000000000000000 0.57219607709351807072
1.00000000000000000000 0.82757964961056901921
0.73717200749494774231 0.74355522136704407132
0.73717200749494774231 0.74355522136704407132
0.00000000000007780151 0.50788604527865586645
0.00000000000043729075 0.42320135645824699113
0.99999999999966817505 0...

result:

ok OK

Test #16:

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

input:

7
5
0.810317691232 0.643017535788
0.309793761559 0.764262848182
0.000000000000 0.561376089933
0.651400345497 0.000000000000
0.931962307009 0.325553870105
4
0.171076044751 0.000000000000
0.265564197304 0.103411254234
0.071756689228 0.418964516278
0.000000000000 0.156314315443
4
0.386419063825 0.00000...

output:

0.59083771974035287166 0.29939449400139211309
0.35592923722224891752 0.75769857950997946680
0.00000000000000000000 0.85992181299352714590
0.00000000000000000000 0.00000000000000000000
0.42976777053171888828 0.00000000000000000000
0.00000000000000000000 1.00000000000000000000
0.00000000000000000000 0...

result:

ok OK

Test #17:

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

input:

7
4
0.000000000000 0.177488867232
0.176950314412 0.039266481958
0.556242974263 0.000000000000
0.075309305264 0.536013509980
4
0.203281319601 0.323314306022
0.000000000000 0.110510724304
0.349283252863 0.000000000000
0.408321765666 0.043218341300
5
0.860850463389 0.099669917919
0.433724726467 0.81261...

output:

0.29548717500910160521 0.28972790430349887902
0.25608956545717702634 0.51078144967787350545
0.00000000000000000000 0.79331093996841365668
0.00000000000174444296 0.07316673437186325873
0.34712437825091173294 0.00000000000000000000
0.29548717500910160521 0.28972790430349887902
0.00000000000009557915 0...

result:

ok OK

Test #18:

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

input:

6
4
0.880095449711 0.315891170135
0.784668799664 0.890843756640
0.000000000000 0.600905379684
0.728266831893 0.000000000000
4
0.083309474403 0.000000000000
0.291032832219 0.544543596864
0.066903447530 0.393219949838
0.000000000000 0.014725970157
4
0.007778511174 0.196667909856
0.000000000000 0.13427...

output:

0.19436792908902707981 0.57238792365011820261
0.08460096171277760011 0.00000000000212226325
0.92112315962026081282 0.00000000000485464582
0.44627296279428193431 0.81607422722640708402
0.08460096171066240788 0.00000000000000000000
0.19436792908902707981 0.57238792365011820261
0.00000000000102148005 0...

result:

ok OK

Test #19:

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

input:

9
4
0.062298941747 0.379982766518
0.000000000000 0.335827002916
0.238024873877 0.000000000000
0.368555159260 0.154177511533
4
0.271980593498 0.402027829795
0.000000000000 0.242759569523
0.006597351582 0.000000000000
0.412952594723 0.011043306806
4
0.713919783914 0.000000000000
0.775523766209 0.02973...

output:

0.00000000000017779356 0.07636026193035096855
0.00000000000000000000 0.00000000000000000000
0.41162557800956056417 0.00000000000000000000
0.36131889638911941965 0.19564789354607255930
0.60533007072500759680 0.27620696578188216983
0.75715080061310140115 0.00000000000111167054
1.00000000000000000000 0...

result:

ok OK

Test #20:

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

input:

12
4
0.011736358846 0.082356480218
0.408765987214 0.000000000000
0.506829492828 0.122146405389
0.000000000000 0.183574392246
3
0.518781549596 0.245694689851
0.000000000000 0.398529593227
0.074761480444 0.000000000000
4
0.075538054618 0.530132543078
0.000000000000 0.488866489116
0.155089097424 0.0109...

output:

0.63884202608571342096 0.65698148644906349461
0.99999999999473762808 0.84131822590775028292
0.99999999999433495914 0.99795856388690516909
0.56632343045371683239 0.72856263705175867648
0.99999999999340385119 0.30049218743982809867
0.99999999999473762808 0.84131822590775028292
0.63884202608571342096 0...

result:

ok OK

Test #21:

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

input:

14
4
0.238874723659 0.350932855333
0.056257209931 0.347991971885
0.000000000000 0.014112992049
0.083758710992 0.000000000000
3
0.000000000000 0.000000000000
0.074629721440 0.057264984008
0.050867075265 0.098486920063
5
0.000000000000 0.100859535910
0.152266736787 0.000000000000
0.585330206242 0.2675...

output:

0.17959046741987966761 0.37182794128161644282
0.00000000000086181390 0.33858536123930210401
0.00000000000000000000 0.00000000000000000000
0.08493937962815903945 0.00000000000000000000
0.49058872653341704186 0.90674452935389124151
0.47824810618499225917 0.99999999999871081341
0.43066752857824149074 0...

result:

ok OK

Test #22:

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

input:

25
4
0.000000000000 0.627504305794
0.147063422648 0.000000000000
0.282537740951 0.083274926848
0.087264778840 0.609639797093
3
0.040754587534 0.053855777929
0.019823186956 0.059913069526
0.000000000000 0.000000000000
4
0.000000000000 0.138379187270
0.054487787984 0.000000000000
0.282847594751 0.1139...

output:

0.37960340702820478430 1.00000000000000000000
0.64952902352623186549 0.41473983081698448974
0.76554943920099175083 0.52349307221098949827
0.46867799543003778488 1.00000000000000000000
0.86938260131717073935 0.35683096264167205990
0.85786019801594388034 0.37532551681126623253
0.80307363487967710645 0...

result:

ok OK

Test #23:

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

input:

31
4
0.335089288956 0.202130218860
0.111257412594 0.213056135994
0.000000000000 0.115005293141
0.101353839372 0.000000000000
5
0.368599476325 0.185829203903
0.028334455772 0.164205533565
0.000000000000 0.125424247883
0.009151606319 0.000000000000
0.420642774919 0.030024538656
4
0.014611117134 0.4683...

output:

0.15618926151272727165 0.30899918906477379728
0.00000000000000000000 0.14829760497491269663
0.00000000000000000000 0.00000000000000000000
0.15329324253173236011 0.00000000000000000000
0.15917884996932491204 0.62798204613439113204
0.16237419300470569408 0.96891848759263165939
0.12575767911344482036 0...

result:

ok OK

Test #24:

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

input:

38
6
0.055783185423 0.185264589599
0.000000000000 0.109085977012
0.008304609077 0.000000000000
0.192122870699 0.013993905045
0.330134360764 0.183894016971
0.331013036656 0.209310854427
6
0.313528615558 0.117272301270
0.460548489005 0.402591166057
0.450995573032 0.409647373622
0.000000000000 0.427107...

output:

0.06140490599367124721 0.18112598071794462097
0.00000000000033934813 0.10940163121537257609
0.00000000000000000000 0.00000000000000000000
0.18435016323329500792 0.00000000000000000000
0.33486046240739575670 0.15893353725677789933
0.33766597923379286985 0.18421034031659361682
0.09667029005704962059 0...

result:

ok OK

Test #25:

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

input:

42
3
0.023946458177 0.001644458456
0.052848741781 0.000000000000
0.000000000000 0.033937501244
4
0.000000000000 0.437888290711
0.220437603206 0.000000000000
0.252072649283 0.037291610744
0.214541156503 0.387891843578
5
0.056385180666 0.000000000000
0.307613101005 0.119085407065
0.324470389249 0.5126...

output:

0.95417585130383441867 0.67312126714793726418
0.92899840796325504555 0.65883341958695901258
0.99180545465340719491 0.65896900855094812244
0.67591030113092627967 1.00000000000000000000
0.18566659433375224079 0.99999999999675018579
0.20475099220161617394 0.95497527201035359919
0.53478498703589657940 0...

result:

ok OK

Test #26:

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

input:

47
4
0.000000000000 0.000000000000
0.240721682184 0.063972715782
0.212144051267 0.142587916515
0.194188982632 0.164356993645
3
0.000000000000 0.007329294278
0.004097455454 0.000000000000
0.012808348423 0.004742705864
4
0.000000000000 0.191434375054
0.194726601227 0.006150268983
0.209266332239 0.0000...

output:

0.00000000007312478980 0.99891787080868015073
0.00000000003458423692 0.74984070074682988372
0.08331784094254868421 0.75726822809148659917
0.10896821816761003399 0.76902983330056380037
0.83621478686563134624 0.99999999995206876918
0.82781790078811995679 0.99999999995347719454
0.82770693001169273214 0...

result:

ok OK

Test #27:

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

input:

66
5
0.000000000000 0.005053823688
0.010340563564 0.000000000000
0.068710101615 0.119429160119
0.065718142206 0.133817342462
0.045777209397 0.180721261022
5
0.319222361577 0.160705577488
0.145577264946 0.213639327175
0.045295283323 0.175775668292
0.000000000000 0.039061839645
0.232351393621 0.000000...

output:

0.00000000000022316237 0.01150949124377417055
0.00000000000000000000 0.00000000000000000000
0.13292978319028763455 0.00000000000000000000
0.14454290108789986394 0.00900594830857245771
0.17792708676125508466 0.04751717426287192783
0.00000000000192808969 0.01150949124761294295
0.17792708676125508466 0...

result:

ok OK

Test #28:

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

input:

65
3
0.000000000000 0.037227150695
0.041112144465 0.000000000000
0.053670737603 0.076203761999
4
0.225553825935 0.000000000000
0.223161633995 0.030611367046
0.001148070858 0.117279311869
0.000000000000 0.054401518608
3
0.131607859592 0.000000000000
0.015270081138 0.023579309412
0.000000000000 0.0133...

output:

0.82495260803730523057 1.00000000000000000000
0.76949028595904083523 1.00000000000000000000
0.81133019003452819018 0.93508348417771543258
0.91238352791663658998 0.31372309680624539121
0.91577250227426766535 0.34424019410569149706
0.71394297457910746267 0.47099269558659145567
0.70102747697206776561 0...

result:

ok OK

Test #29:

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

input:

87
3
0.000000000000 0.015182039322
0.008005468111 0.000000000000
0.008505409967 0.010237923361
3
0.006579715319 0.000000000000
0.016526460362 0.024920112337
0.000000000000 0.034862041390
4
0.000000000000 0.113613541825
0.016977010685 0.055116049444
0.095225367059 0.000000000000
0.088645927138 0.0572...

output:

0.57070854436860731006 0.42850611683976829656
0.56579092901565822054 0.44494992713322992702
0.56332010735464952685 0.43500206017836673335
0.48500193982947403991 0.40756038125469212357
0.50029677986502906156 0.42960618820716173246
0.48642865107296259986 0.44300920462993417188
0.40984517047107083302 0...

result:

ok OK

Test #30:

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

input:

81
3
0.000000000000 0.018267088323
0.021828432930 0.000000000000
0.065397626776 0.045720726608
6
0.015975080205 0.143941945631
0.000000000000 0.039492133537
0.018991882284 0.000000000000
0.265356466097 0.239413579318
0.222071970974 0.269301144149
0.186580330217 0.282053589632
6
0.013895601825 0.0000...

output:

1.00000000000000000000 0.11369231273938529861
1.00000000000000000000 0.14215574542543356354
0.93697548207073440486 0.14622632524266245633
0.24704098486333404136 0.50237879186148316893
0.15314858717062630873 0.55084717424939052909
0.10966083588338354110 0.54544942543392871783
0.25794804582383795916 0...

result:

ok OK

Test #31:

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

input:

95
5
0.047827693957 0.000000000000
0.098857399884 0.086786768459
0.102220020859 0.096330476080
0.001430528120 0.223787762853
0.000000000000 0.223443956666
3
0.041762757505 0.000000000000
0.019205931557 0.054198718204
0.000000000000 0.047533425298
4
0.013367507814 0.039249301738
0.185174533248 0.0000...

output:

0.22843395805836254632 0.59003450928508722692
0.15597470432222677899 0.65993179546022508891
0.14748101127108044099 0.66543150030053315152
0.00000000000000000000 0.59721688968886795201
0.00000000000000000000 0.59574562717104510400
0.74471693627032732707 0.20480643928366205192
0.68864699833386870459 0...

result:

ok OK

Test #32:

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

input:

116
5
0.021396819174 0.015342509410
0.001564438290 0.039397972939
0.000000000000 0.014915990992
0.013335003291 0.000226832016
0.023349444489 0.000000000000
4
0.012103646607 0.000000000000
0.016163789301 0.004840038879
0.003320086741 0.012493169256
0.000000000000 0.005575920918
4
0.000000000000 0.054...

output:

0.07053366235434487948 0.98470564040553958959
0.09090568612446264456 0.96110544331644509798
0.09191533647826307652 0.98561657368915886338
0.07825112123103746938 0.99999999904841705968
0.06823411144436064362 0.99999999903019851257
0.68643712658187157159 0.35980238405893316621
0.69200091604348769119 0...

result:

ok OK

Test #33:

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

input:

133
6
0.072574557839 0.312677865325
0.001137204536 0.330688379241
0.000000000000 0.013845009228
0.004399538886 0.000000000000
0.108499348680 0.123193399648
0.163704701535 0.244778990085
4
0.003230768068 0.050209672075
0.122105847351 0.000000000000
0.133421862210 0.070986500693
0.000000000000 0.06213...

output:

0.57411508654456458591 0.00000000002845714949
0.64778783631294441963 0.00000000001160149988
0.57143296894237664108 0.30750763989030757657
0.56378228199640071516 0.31985702093498583241
0.49295774414305127718 0.17495267678432211862
0.46915104037143244106 0.04356041049281676239
0.46633139064230415526 0...

result:

ok OK

Test #34:

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

input:

138
3
0.118685904723 0.066395606854
0.000000000000 0.031651747666
0.055681967637 0.000000000000
4
0.075000665916 0.000000000000
0.082124079088 0.034173858786
0.019340637052 0.077974103991
0.000000000000 0.064478480978
5
0.030628968215 0.043757686336
0.000000000000 0.024195722398
0.004477590785 0.000...

output:

0.79956425539987246689 0.96606136976243190567
0.71100327481205740575 0.87974548234002113595
0.77502545508910523399 0.87788132688216532335
0.73025956637709657434 0.52560688327047714664
0.75578488781987809185 0.54941977063864566610
0.72974635267726276316 0.62140738597377150916
0.70616296528228673929 0...

result:

ok OK

Test #35:

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

input:

148
3
0.026621319141 0.000000000000
0.007296844689 0.016827125239
0.000000000000 0.012235984397
5
0.021570834617 0.000000000000
0.154819739283 0.077564199064
0.050155665830 0.113755864820
0.000000000000 0.119522929551
0.001664388533 0.009536516799
3
0.005288235752 0.016716105247
0.000000000000 0.001...

output:

0.29769458088568604692 0.86486479789708884048
0.30743980243241077725 0.88856328122322107135
0.30075203932823325799 0.89400353315822312880
0.48282260599262218767 0.24721453546648368267
0.34525487772922544400 0.17759704021434481237
0.44761671425428850495 0.13533051290336251793
0.49734792186147322880 0...

result:

ok OK

Test #36:

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

input:

154
3
0.056906082314 0.036639142594
0.017316385181 0.066883717906
0.000000000000 0.000000000000
5
0.000062233246 0.085710539368
0.000000000000 0.085546504140
0.016747101114 0.000000000000
0.087129946292 0.060459853042
0.082449394349 0.077583985414
3
0.003341899019 0.029877838968
0.000000000000 0.007...

output:

0.55112786676360896491 0.40836755755508792430
0.57419818437387284624 0.45252453776577708134
0.50534375016030458485 0.45821275434674393963
0.49436312545943492651 0.13272582721652920358
0.49452033899824437757 0.13280370170632225563
0.54045026909188042933 0.20689223854606383858
0.44773381228571182904 0...

result:

ok OK

Test #37:

score: 0
Accepted
time: 3ms
memory: 4224kb

input:

157
3
0.022975295316 0.133753786252
0.000000000000 0.000000000000
0.078583822597 0.009635574028
3
0.037772151360 0.047904437968
0.000000000000 0.024531195919
0.050382878792 0.000000000000
3
0.000000000000 0.000000000000
0.020626099645 0.002132947552
0.005061027297 0.032396497109
3
0.011486204366 0.0...

output:

0.16231578980511161981 0.00000000000000000000
0.29802849934074835878 0.00000000001422903279
0.27522826897273616496 0.07581827587999272596
0.45309720869183441042 0.24048324851028706704
0.45433031734606674009 0.19608140957786569295
0.50085285749757149984 0.22732028438060180578
0.99999999925378866590 0...

result:

ok OK

Test #38:

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

input:

165
4
0.090134183082 0.025631923190
0.043091940369 0.042946264434
0.000000000000 0.000000000000
0.087801581797 0.022553046918
3
0.047090776615 0.014149434646
0.000000000000 0.013150413325
0.057969691667 0.000000000000
6
0.000000000000 0.198704670057
0.018044187015 0.071766500734
0.178666873308 0.000...

output:

0.80396279157614186948 0.16836651514634767470
0.78680012153389690182 0.21546430456804380851
0.72618132561312655318 0.22062749481713395199
0.80010566583832240083 0.16815893650821339004
0.83527561344894839371 0.63979693285621471431
0.79736203149432818279 0.61184877398763591014
0.85231966276920687671 0...

result:

ok OK

Test #39:

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

input:

141
4
0.070754311340 0.076269199248
0.062424474687 0.079390660730
0.000000000000 0.006608944100
0.027761363879 0.000000000000
3
0.032333140816 0.000000000000
0.018854367463 0.075770826201
0.000000000000 0.004917529209
4
0.043452229407 0.020635378104
0.071652138659 0.000000000000
0.010439540528 0.213...

output:

0.30656350392848387811 0.52088366165821924845
0.31505186683361944698 0.51822332414508643684
0.37339447377220793807 0.59431625112424105829
0.34531268018302919956 0.59939407898707904731
0.20130502369222497221 0.59239637554522654327
0.27573316228836758417 0.61197564055452271413
0.20358419054545282169 0...

result:

ok OK

Test #40:

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

input:

150
4
0.104430286936 0.036068594926
0.000000000000 0.072773969166
0.025770678197 0.013811311664
0.091197517141 0.000000000000
3
0.022670063559 0.000000000000
0.104750912415 0.033498179724
0.000000000000 0.018301996997
4
0.000000000000 0.033588192686
0.055509876760 0.000000000000
0.093612013862 0.164...

output:

0.79531020314942520925 1.00000000000000000000
0.79681961463671643024 0.88931716037759557276
0.84329829715769167231 0.93381946261800359083
0.83372959585780364878 1.00000000000000000000
0.93232970673268071430 0.31804660510064739840
0.84937625828839279096 0.34932150199532863269
0.93649894817385566348 0...

result:

ok OK

Test #41:

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

input:

151
4
0.082120886773 0.006976355697
0.071345566846 0.031392713209
0.000000000000 0.019517191355
0.053143917683 0.000000000000
3
0.000000000000 0.000000000000
0.091126171335 0.009853756763
0.057587797068 0.021670311143
3
0.007139134362 0.125189875294
0.000000000000 0.053938889174
0.089421404760 0.000...

output:

0.00000000002228541376 0.60116449803261618503
0.00000000002101797291 0.57447618535620218459
0.07006667813931754546 0.55653521146659546689
0.02932686346145051110 0.59584760447869647491
0.84960262106885290517 0.92221174489202953795
0.92134808649597798165 0.97925264086723598912
0.88668721154897615536 0...

result:

ok OK

Test #42:

score: 0
Accepted
time: 4ms
memory: 4224kb

input:

160
4
0.040696066791 0.047219823786
0.009305331291 0.057176448200
0.000000000000 0.056984712422
0.032268750605 0.000000000000
4
0.000000000000 0.038789020633
0.016915008366 0.016976583470
0.032763462120 0.000000000000
0.051547223008 0.019191763974
4
0.000000000000 0.000000000000
0.130172492374 0.038...

output:

0.44341810789914434563 0.43197896933622237646
0.43925824004636120085 0.46464712116092010040
0.43517301723832370612 0.47300995008371587739
0.39702984943389496426 0.41977811316002574407
0.12019401426809516672 0.46650489633123001988
0.14726968240437362185 0.47187221576355846690
0.16954337116028623140 0...

result:

ok OK

Test #43:

score: 0
Accepted
time: 3ms
memory: 4224kb

input:

158
3
0.001915550667 0.000000000000
0.034028370155 0.018544352097
0.000000000000 0.005907043128
5
0.136245359655 0.128970898398
0.014463156719 0.152180580927
0.000000000000 0.017124902848
0.038946667270 0.000000000000
0.100028820871 0.046477522374
3
0.000000000000 0.000000000000
0.002176023513 0.001...

output:

0.42386854692677726451 0.73338268174738704567
0.45921099314746073730 0.74460933166663598832
0.42326426984085290786 0.73956308158594062587
0.15722565004301959022 0.51903730682979225800
0.12945365753892763280 0.63986077615628946945
0.00000000000000000000 0.59873937515980399609
0.00000000000314533416 0...

result:

ok OK

Test #44:

score: -100
Wrong Answer
time: 0ms
memory: 4224kb

input:

136
3
0.000000000000 0.023909081840
0.004747357667 0.000000000000
0.037644065273 0.052155951394
3
0.019338142325 0.000000000000
0.003097556485 0.018698869165
0.000000000000 0.010189096166
3
0.089777029945 0.000000000000
0.129191001371 0.059173456144
0.000000000000 0.047646040548
3
0.003324443491 0.0...

output:

0.00000000000000000000 0.00000000000000000000
0.00000000000000000000 0.00000000000000000000
0.00000000000000000000 0.00000000000000000000
0.00000000000000000000 0.32792136130184872870
0.00000000000000000000 0.35092157472357141592
0.00000000000000000000 0.34390411351022115278
0.00000000000000000000 0...

result:

wrong answer Figure 1 is not the same. Dist for point 1 is 0.0089730