QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293246 | #4866. Symmetry: Closure | ucup-team087# | WA | 131ms | 22688kb | C++20 | 16.7kb | 2023-12-29 02:14:57 | 2023-12-29 02:14:57 |
Judging History
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
#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>;
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));
}
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<<"}";
}
ll read(){
ll i;
cin>>i;
return i;
}
vi readvi(int n,int off=0){
vi v(n);
rep(i,n)v[i]=read()+off;
return v;
}
pi readpi(int off=0){
int a,b;cin>>a>>b;
return pi(a+off,b+off);
}
template<class t>
void print_single(t x,int suc=1){
cout<<x;
if(suc==1)
cout<<"\n";
if(suc==2)
cout<<" ";
}
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?suc:2);
}
template<class T>
void print_offset(const vector<T>&v,ll off,int suc=1){
rep(i,v.size())
print_single(v[i]+off,i==int(v.size())-1?suc:2);
}
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?suc:2);
}
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...);
}
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 t> void mkuni(vc<t>&v){
sort(all(v));
v.erase(unique(all(v)),v.ed);
}
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);
}
template<class t>
void myshuffle(vc<t>&a){
rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}
template<class t,class u>
int lwb(const vc<t>&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);
}
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> readTree(int n){
return readGraph(n,n-1);
}
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>
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+(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>
void remval(vc<t>&a,const u&v){
a.erase(remove(all(a),v),a.ed);
}
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);
}
//デバッグ実行でオーバーフローするとコアダンプしがち
using int128=__int128_t;
using uint128=unsigned __int128_t;
istream& operator>>(istream&is,int128&res){
res=0;
string s;is>>s;
int head=0;
int128 w=1;
if(s[0]=='-'){
w=-1;
head++;
}
while(head<int(s.size())){
res=res*10+s[head++]-'0';
}
res*=w;
return is;
}
ostream& operator<<(ostream&os,int128 i){
if(i==0)
return os<<0;
static char buf[100];
if(i<0){
os<<"-";
i=-i;
}
int p=0;
while(i){
buf[p++]='0'+i%10;
i/=10;
}
reverse(buf,buf+p);
buf[p]=0;
return os<<buf;
}
ostream& operator<<(ostream&os,uint128 i){
if(i==0)
return os<<0;
static char buf[100];
int p=0;
while(i){
buf[p++]='0'+i%10;
i/=10;
}
reverse(buf,buf+p);
buf[p]=0;
return os<<buf;
}
int128 abs(int128 a){
return a<0?-a:a;
}
int botbit(int128 a){
const int128 m=(int128(1)<<64)-1;
if(a&m)return __builtin_ctzll(ll(a));
else return __builtin_ctzll(ll(a>>64))+64;
}
int128 gcd(int128 a,int128 b){
if(a<0)a=-a;
if(b<0)b=-b;
if(a==0)return b;
if(b==0)return a;
int128 s=botbit(a|b);
a>>=botbit(a);
do{
b>>=botbit(b);
if(a>b)swap(a,b);
b-=a;
}while(b);
return a<<s;
}
const int128 inf128=int128(1)<<122;
int128 fdiv(int128 a,int128 b) { // floored division
return a / b - ((a ^ b) < 0 && a % b); }
//a,c O(10^36)
//b,d O(10^18)
//a/b, c/d の大小比較
int cmpfrac(int128 a,int128 b,int128 c,int128 d){
assert(b);
assert(d);
if(b<0){
a=-a;
b=-b;
}
if(d<0){
c=-c;
d=-d;
}
int128 x=fdiv(a,b),y=fdiv(c,d);
if(x<y)return -1;
if(x>y)return 1;
int128 u=(a-x*b)*d,v=(c-y*d)*b;
if(u<v)return -1;
if(u>v)return 1;
return 0;
}
bool dbg=false;
using ld=long double;
using P=pair<int128,int128>;
using L=pair<P,P>;
struct Mirrors{
vc<int128> vs;
void add(int128 v){
vs.pb(v);
}
int128 g;
void init(){
g=0;
for(auto v:vs){
g=gcd(g,v-vs[0]);
}
}
void fund(int128&v){
if(si(vs)){
v-=vs[0];
if(g==0){
if(v<0)v=-v;
}else{
v%=(g*2);
if(v<0)v+=g*2;
if(v>g)v=g*2-v;
}
v+=vs[0];
}
}
};
void slv(){
int n,q;cin>>n>>q;
vc<L> ls(n);
vc<L> qs(q);
rep(i,n){
cin>>ls[i].a.a>>ls[i].a.b>>ls[i].b.a>>ls[i].b.b;
}
rep(i,q){
cin>>qs[i].a.a>>qs[i].a.b>>qs[i].b.a>>qs[i].b.b;
}
P org=ls[0].a;
P Xaxis=ls[0].b-ls[0].a;
auto modify=[&](P&v){
v-=org;
int128 x=v.a*Xaxis.a+v.b*Xaxis.b;
int128 y=v.a*(-Xaxis.b)+v.b*Xaxis.a;
v.a=x;
v.b=y;
};
rep(i,n){
modify(ls[i].a);
modify(ls[i].b);
}
rep(i,q){
modify(qs[i].a);
modify(qs[i].b);
}
//all 18
bool irr=false;
rep(i,n){
P dir=ls[i].b-ls[i].a;
if(dir.a&&dir.b&&abs(dir.a)!=abs(dir.b)){
irr=true;
}
}
vc<ld> ans(q,-1);
if(irr){
dmp("Irrational");
vc<P> clist;//(36,18)
bool dif=false;
rep(i,n){
auto [a,b]=ls[i];
if(a.b!=b.b){
int128 num=a.a*b.b-b.a*a.b;
int128 den=b.b-a.b;
clist.eb(num,den);
}else if(a.b!=0){
dif=true;
}
}
assert(si(clist)>0);
rep(i,si(clist)-1){
auto [an,ad]=clist[i];
auto [bn,bd]=clist[i+1];
if(cmpfrac(an,ad,bn,bd)){
dif=true;
}
}
if(dif){
dmp("Dif");
rep(i,q){
ans[i]=0;
}
}else{
dmp("Center");
ld c=ld(clist[0].a)/clist[0].b;
auto dist=[&](P v){
return sqrtl(sq(v.a-c)+sq(v.b));
};
rep(i,q){
auto [a,b]=qs[i];
ld ad=dist(a);
ld bd=dist(b);
ans[i]=abs(ad-bd);
}
}
}else{
dmp("Rational");
bool has45=false;
rep(i,n){
P dir=ls[i].b-ls[i].a;
if(dir.a&&dir.b){
has45=true;
}
}
if(has45){
dmp("Has 45");
{
int128 c;
rep(i,n){
P dir=ls[i].b-ls[i].a;
if(dir.a&&dir.b){
dir.a/=dir.b;
dir.b=1;
int128 v=ls[i].a.a-ls[i].a.b*dir.a;
c=v;
}
}
rep(i,n){
auto&[a,b]=ls[i];
a.a-=c;
b.a-=c;
}
rep(i,q){
auto&[a,b]=qs[i];
a.a-=c;
b.a-=c;
}
}
//0 is the center
dmp(ls);
rep(phase,2){
Mirrors m;
m.add(0);
rep(i,n){
P dir=ls[i].b-ls[i].a;
if(dir.a&&dir.b){
dir.a/=dir.b;
dir.b=1;
int128 v=ls[i].a.a-ls[i].a.b*dir.a;
m.add(v);
}else if(dir.a==0){
m.add(ls[i].a.a);
}else if(dir.b==0){
m.add(ls[i].a.b);
}else assert(false);
}
dmp(m.vs);
m.init();
assert(m.vs[0]==0);
if(m.g==0){
dmp("45 Centered");
}else{
dmp("45 Checkered");
}
auto work=[&](P&v){
if(m.g==0){
if(v.a<0)v.a*=-1;
if(v.b<0)v.b*=-1;
if(v.a<v.b)swap(v.a,v.b);
}else{
auto&[a,b]=v;
m.fund(a);
m.fund(b);
dmp2(m.g,a,b);
if(!inc(0,a,m.g))exit(0);
if(!inc(0,b,m.g))exit(0);
assert(inc(0,a,m.g));
assert(inc(0,b,m.g));
if(a+b>=m.g){
tie(a,b)=mp(m.g-b,m.g-a);
}
if(a<b){
swap(a,b);
}
}
};
const ld wei=phase==0?1:1/sqrtl(2);
rep(i,q){
auto [a,b]=qs[i];
work(a);
work(b);
P dif=a-b;
chmax(ans[i],sqrtl(sq(dif.a)+sq(dif.b))*wei);
}
auto rot=[&](P&v){
int128 x=v.a+v.b;
int128 y=-v.a+v.b;
v.a=x;
v.b=y;
};
for(auto&[a,b]:ls){
rot(a);
rot(b);
}
for(auto&[a,b]:qs){
rot(a);
rot(b);
}
}
}else{
dmp("No 45");
Mirrors vert,hori;
rep(i,n){
P dir=ls[i].b-ls[i].a;
if(dir.a==0){
vert.add(ls[i].a.a);
}else if(dir.b==0){
hori.add(ls[i].a.b);
}else assert(false);
}
vert.init();
hori.init();
auto work=[&](P&v){
vert.fund(v.a);
hori.fund(v.b);
};
rep(i,q){
auto [a,b]=qs[i];
work(a);
work(b);
P dif=a-b;
ans[i]=sqrtl(sq(dif.a)+sq(dif.b));
}
}
}
ld D=sqrtl(sq(Xaxis.a)+sq(Xaxis.b));
rep(i,q){
print(ans[i]/D);
}
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
if(dbg){
while(1)slv();
}else{
int t;cin>>t;rep(_,t)
slv();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
input:
4 1 1 0 0 1 0 -1 -2 2 1 2 1 0 0 1 0 0 0 0 1 -1 -2 2 1 3 1 0 0 1 0 0 0 0 1 0 0 1 1 -1 -2 2 1 3 1 0 0 1 0 0 0 0 1 0 0 1 2 -1 -2 2 1
output:
3.16227766016837933197 1.41421356237309504876 0.00000000000000000000 0.00000000000000000000
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
5 1 1 -8 1 -8 10 -7 -5 -4 -6 2 2 -1 -10 -1 -8 10 9 9 10 2 10 -10 5 -4 4 -3 -3 3 1 -5 -10 -5 6 6 10 8 8 7 -2 4 -5 0 -9 -6 -3 3 3 9 8 10 7 1 5 -9 5 4 -2 -3 -9 6 6 -6 -8 2 -7 10 -3 3 -8 8 -9 1 3 10 -9 10 -7 -2 -7 -2 6 -2 9 -9 2 -6 -7 -7 -9
output:
3.16227766016837933197 7.81024967590665439472 7.07106781186547524425 7.21110255092797858625 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 13.00000000000000000000 9.89949493661166534178 2.23606797749978969641
result:
ok 10 numbers
Test #3:
score: 0
Accepted
time: 84ms
memory: 4060kb
input:
50000 1 2 0 0 1 0 -8 8 7 -8 -1 -2 8 -9 2 2 0 0 1 0 5 8 2 7 7 -8 -5 7 -3 5 -6 -1 1 2 0 0 1 0 -7 -10 -9 4 -10 -10 -9 -5 2 1 0 0 1 0 -9 4 -4 -5 -5 4 2 -1 1 1 0 0 1 0 10 -5 1 3 4 2 0 0 1 0 8 -1 -3 9 -4 8 5 4 -9 -4 2 -5 2 6 5 -4 1 -8 -5 10 2 1 0 0 1 0 1 7 10 9 -3 0 10 7 3 2 0 0 1 0 1 10 6 -1 5 6 5 2 7 5 ...
output:
15.00000000000000000000 11.40175425099137979101 11.55046517497235881566 3.72464980383491269921 6.32455532033675866393 5.09901951359278482988 4.45728603559471770216 9.21954445729288731004 0.00000000000000000000 0.00000000000000000000 13.60048661512415718935 0.00000000000000000000 0.000000000000000000...
result:
ok 100000 numbers
Test #4:
score: 0
Accepted
time: 59ms
memory: 22688kb
input:
1 100000 100000 -9 9 -6 -9 6 2 7 4 -9 5 8 1 -2 -2 -4 -5 2 -3 -9 10 -3 6 6 0 5 10 -4 -9 0 -6 -4 10 5 -10 4 -10 -6 8 10 -9 4 6 -4 7 9 1 -7 -4 4 3 -10 -8 0 10 -5 3 -7 -4 -1 4 9 -7 2 -9 1 -9 -1 0 -9 -9 -5 -3 -6 -4 -1 -4 0 -5 -4 -3 3 -2 8 1 10 -1 -1 6 1 -2 -10 -10 6 2 -6 0 2 7 -2 4 2 3 -9 0 -2 -5 3 4 -3 ...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0...
result:
ok 100000 numbers
Test #5:
score: 0
Accepted
time: 63ms
memory: 22088kb
input:
1 100000 100000 -107924226 984128779 -147600592 858581375 935061792 -2971048 -841200666 -746258291 -360848175 859823566 583989438 -20447301 -56948500 158063925 276991457 -629674216 -658151397 959677900 568671306 -511158196 403975817 755816976 -429247023 -776141225 55688835 598599852 587796942 776132...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0...
result:
ok 100000 numbers
Test #6:
score: 0
Accepted
time: 95ms
memory: 3924kb
input:
100000 1 1 1 -7 1 -6 -5 10 -10 -1 1 1 -6 2 -5 3 0 1 -10 -4 1 1 6 0 -9 -5 1 10 8 2 1 1 -2 -1 0 9 1 6 -5 10 1 1 6 -9 1 9 0 7 1 -7 1 1 -6 10 -5 -8 -7 3 9 3 1 1 -6 8 9 8 7 -7 10 -10 1 1 9 -4 6 -1 1 10 -10 -3 1 1 2 4 -2 9 10 4 10 -7 1 1 5 2 0 4 -8 -1 -5 2 1 1 -2 10 9 1 -10 1 -3 -7 1 1 4 -5 -8 -4 1 -5 4 -...
output:
12.08304597359457206816 11.18033988749894848229 10.63014581273464940776 4.47213595499957939283 14.03566884761819962956 13.23166365491970465022 4.24264068711928514673 8.60232526704262677204 10.26597505853384705108 4.24264068711928514673 10.63014581273464940776 3.87565344879704302365 9.421742448678522...
result:
ok 100000 numbers
Test #7:
score: 0
Accepted
time: 131ms
memory: 3836kb
input:
100000 1 1 -887559625 -1847314 -590134585 -238034717 -949679287 -31966108 -88314979 -854898523 1 1 -592792982 322266912 496075708 303506916 -350162382 -950881882 -34887657 -299540513 1 1 957425070 -305571191 -936829996 527248004 -951311600 -425264497 -504755835 278051738 1 1 -587284479 -578741148 99...
output:
1191287635.60865143779665231705 723632317.68255056696943938732 833106102.28788412705762311816 572346750.49418757925741374493 1465268881.08868669671937823296 1725179485.86578070395626127720 1145759355.30233510071411728859 306825921.51243754930328577757 1399830266.40248392231296747923 885187101.276847...
result:
ok 100000 numbers
Test #8:
score: 0
Accepted
time: 66ms
memory: 3840kb
input:
10000 3 5 -3 -8 -7 5 -7 -2 -9 8 8 -1 -6 7 9 3 -6 -9 3 -2 7 -10 -7 -3 -6 4 1 5 4 6 1 3 10 9 1 19 0 -9 4 -4 -1 9 -9 6 -9 -6 -10 -4 -7 4 -8 1 2 -3 5 3 -4 -4 -3 1 7 9 -10 -4 0 0 2 -5 6 9 6 10 -2 8 5 6 -9 1 4 -5 -5 -9 -2 4 7 -10 -6 5 -8 -4 0 6 0 -2 4 7 -10 0 10 2 7 7 6 -6 10 -2 7 -3 -5 2 7 3 -9 10 3 -7 1...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 8.54400374531753116752 2.23606797749978969641 3.16227766016837933197 6.70820393249936908903 5.09901951359278482988 21.40093455903269659829 5.38516480713450403127 0.99999999999999999995 ...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 83ms
memory: 3888kb
input:
10000 8 3 -217399411 584147457 551810695 -798393646 -24976801 -105573386 -835929499 893574512 -910958692 498563022 890810619 257352083 194668556 -493444479 780379386 851967162 -556438409 769799129 781761729 -539350223 867690289 613441674 -266909967 668871147 719415093 -146012384 694318654 -605179490...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 172956047.29612196680682245642 778411792.81481272861128672957 185593341.61197250260738655925 828345589.18733970506582409143 135399097.15266192948911339045 228989921.83731453206564765424 50281056.97493121389561565593 474258107.46979...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 80ms
memory: 3800kb
input:
50000 1 2 -8 8 7 -8 -1 -2 8 -9 5 8 2 7 2 2 7 -8 -5 7 -3 5 -6 -1 -7 -10 -9 4 -10 -10 -9 -5 1 2 -9 4 -4 -5 -5 4 2 -1 10 -5 1 3 2 1 8 -1 -3 9 -4 8 5 4 -9 -4 2 -5 1 1 2 6 5 -4 1 -8 -5 10 4 2 1 7 10 9 -3 0 10 7 1 10 6 -1 5 6 5 2 7 5 3 -7 7 -6 -4 7 2 1 5 6 8 -7 -7 0 -4 -8 6 -9 4 -2 3 2 -4 6 -10 0 -3 -10 6...
output:
11.38788793780443222257 3.16227766016837933175 9.30038662664646596963 4.89012576755845258542 8.60232526704262677117 12.04159457879229548020 2.32280790640466298881 18.97366596101027599180 0.00000000000000000000 0.00000000000000000000 7.27820840099115792636 0.00000000000000000000 0.0000000000000000000...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 118ms
memory: 3788kb
input:
50000 1 1 -99822182 471344044 106108756 -643083980 603898960 -915734037 577120158 -847742830 2 2 154847051 -694367850 305574283 573709628 -621754628 582257799 -738161672 -721646829 324136441 -819540335 -689996648 263358077 147677068 -968316867 -670926738 394286545 1 1 -742121721 -530862527 886939485...
output:
73074677.32307856724946759641 969612294.74284356524003669620 1270816685.54274983576033264399 670299835.92126916541019454598 896199071.21649059356423094869 434799081.53525890814489684999 903438960.93832178553566336632 1016818810.75486247305525466800 814081332.58226301684044301510 1242647223.135180838...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 92ms
memory: 3836kb
input:
33333 3 3 -1419476 -1854781 580523 145219 -1419476 -1854780 580524 -1854780 -1419476 145219 -1419475 -1854781 117465 746786 91499 -524195 33544 102858 329779 -554609 869607 -50968 256407 593149 3 3 -160543 -1518984 1839457 -1518984 -160543 481015 -160542 -1518985 -160543 -1518985 1839456 481015 9877...
output:
1008313.33467503997059111498 258426.02599506190217937274 52253.29359215258578785779 1474345.87468866305982828635 746540.32040575739540599898 30426.79672281690061197423 607196.56562549760127467380 727366.93866641787207072412 747428.11371502656180609847 0.00000000000000000000 0.00000000000000000000 0....
result:
ok 99999 numbers
Test #13:
score: 0
Accepted
time: 99ms
memory: 3840kb
input:
33333 3 3 -17367532 -6395796 2632467 13604204 -17367532 -6395795 2632468 -6395795 -17367532 13604204 -17367531 -6395796 1689875 2745960 410472 8998970 9148463 -7876682 -3452503 -5455967 7387347 -6380763 7154164 6298661 3 3 -10014859 12124263 -10014858 -7875737 -10014859 -7875736 9985141 -7875736 -10...
output:
2380533.54011765795462451933 12610584.58540403099596005632 2857845.27681029096970632963 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 13490327.04328574591181677533 2280664.11862567452999428497 1793438.68138615980069516809 2550033.31118298884734940657 6243833.260252303117340488...
result:
ok 99999 numbers
Test #14:
score: 0
Accepted
time: 104ms
memory: 3824kb
input:
33333 3 3 -56116485 -8979960 143883513 191020039 -56116485 -8979959 143883515 -8979959 -56116485 191020040 -56116484 -8979960 -3317486 -233240 -74527113 53414572 -3940839 40169681 -31192315 81293757 58651509 1423042 -6679494 93662141 3 3 -69622130 -35655393 130377869 164344605 -69622129 -35655393 -6...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0...
result:
ok 99999 numbers
Test #15:
score: 0
Accepted
time: 102ms
memory: 4000kb
input:
33333 3 3 -452553593 792331038 -452553592 -207668962 -452553593 -207668961 547446407 -207668961 -452553593 -207668962 547446405 792331037 220560684 76056927 -97159744 -260411844 -415738925 -197632802 -191804028 191543121 100759453 -445428575 -145443915 474374904 3 3 -286460116 -838995703 713539883 1...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 860171005.28393774980213493109 186946880.62115261296276003122 492442861.94078288457239978015 116190567.74855204462801339105 547958451.86688516702270135283 190828156.39309014483296778053 0.00000000000000000000 0.00000000000000000000...
result:
ok 99999 numbers
Test #16:
score: 0
Accepted
time: 77ms
memory: 4020kb
input:
30000 3 3 -1 3 3 0 10 -6 5 7 -4 3 0 -3 -10 -10 9 -3 -4 -2 6 10 4 7 -2 -6 3 4 0 9 -9 1 2 -9 9 5 -10 9 5 -6 -10 4 -9 6 4 9 6 -10 10 4 6 10 1 9 7 9 2 1 -3 2 -2 -4 -6 3 9 6 1 6 4 -2 4 4 6 -4 -7 -2 1 9 3 -3 -1 10 -5 -9 9 4 7 -7 10 9 -9 6 4 6 7 -8 -5 10 -10 -9 5 -6 8 -8 1 2 -3 0 4 4 9 -8 -3 4 3 -3 8 2 1 1...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 4.22246685998352642944 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.43072384832423794235 ...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 99ms
memory: 3840kb
input:
33333 3 3 -1000000000 -999999999 1000000000 -999999999 -1000000000 1000000000 -999999999 -1000000000 -1000000000 -1000000000 999999998 999999999 887594927 -208243368 -486753197 303481012 805661624 340562956 -333755487 395122659 -174568088 -54315713 -370485671 98586545 3 3 -1000000000 -1000000000 999...
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 1218286019.11620910337660461664 610691120.62083382945274934173 460644769.28376594756264239550 480006819.44302667237934656441 846237254.34831267344998195767 379460894.42510437537566758692 767189262.13647018698975443840 1137338751.57...
result:
ok 99999 numbers
Test #18:
score: 0
Accepted
time: 110ms
memory: 3944kb
input:
30000 5 3 353885690 197069208 -242960342 120496888 -322351866 148228225 -257317652 232405519 143442455 359654743 269708396 262103422 350083203 -68836701 345297433 -31533824 18159797 153997278 -144425738 -56445957 0 -9 7 -10 1 3 -9 -1 -7 0 -6 -2 1 3 242304788 517648210 727045787 221483311 -7 -7 -3 -1...
output:
4.90129628491655454066 6.32455532033675866437 0.80762425960303869628 7.21110255092797858582 16.49242250247064219860 15.81138830084189665984 4.86487436629500015874 6.40312423743284868773 14.00000000000000000087 8.24621125123532109930 2.23606797749978969641 5.09901951359278483031 6.7082039324993690894...
result:
ok 100000 numbers
Test #19:
score: 0
Accepted
time: 94ms
memory: 4072kb
input:
30000 6 3 -7 9 -7 5 -8 2 -2 8 3 -4 -6 5 1 2 3 2 8 10 -10 10 1 -10 9 -2 10 2 3 0 -2 -6 3 0 3 -4 -4 8 5 3 -9 8 -10 7 -6 -4 -6 10 10 -2 10 -8 -7 -1 -10 -4 -6 10 -9 10 -9 -7 8 -4 -10 -8 7 -2 3 2 10 4 1 5 -3 6 2 1 -9 -7 7 -7 7 -9 -8 7 1 6 10 -5 3 8 -2 -4 -8 10 -4 -8 6 10 -2 -7 -3 -7 -8 -3 -8 10 -2 4 4 -2...
output:
1.00000000000000000000 1.00000000000000000000 1.00000000000000000000 0.00000000000000000000 1.00000000000000000011 1.00000000000000000011 16.00000000000000000000 21.93171219946130881713 14.21267040355189549723 5.00000000000000000000 18.43908891458577462008 1.00000000000000000000 0.000000000000000000...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 128ms
memory: 3852kb
input:
30000 3 3 -20794806 189849870 363596283 455546160 130324086 -545280300 315083367 466640001 109067121 -235484919 66651300 -227740518 398 15 -628 -681 -90 -75 -156 513 -361 699 -50 795 2 4 226411510 288221850 177659350 312847770 -386863498 196689126 -389120874 192220178 -661 672 280 465 2 -664 634 75 ...
output:
1239.79514436861705284354 591.69248769948059907264 325.47964606100947401734 963.49883238123335060799 972.39138210907648923742 1257.60168574950630115961 892.23147220886576397314 1604.24592877775444899058 450.94123785699617470990 604.59904068729715442831 1436.09609706314570143348 849.22376320967373170...
result:
ok 100000 numbers
Test #21:
score: -100
Wrong Answer
time: 32ms
memory: 3900kb
input:
30000 1 4 -525246791 -883474104 -525246791 646168143 -187268297 -387510411 -383487273 49834076 -655388694 -562681528 158706091 500673162 746337338 633498857 896018088 373944621 -737556745 -982416224 170868932 346909157 2 5 973956169 -999941810 977927615 -995970364 996120887 -112441515 237851477 -870...
output:
479345477.55432276008650660515 1198928603.88178850931581109762 299620974.47626425474300049245 1414628569.86859858979005366564 734930328.69841580931097269058 85369827.04051733054802753031 250047486.00186079456761945039 1074353058.75943266204558312893 1177389050.60207019292283803225 869249542.37720563...
result:
wrong output format Unexpected end of file - double expected