結果
問題 | No.869 ふたつの距離 |
ユーザー | tempura_pp |
提出日時 | 2019-08-15 20:15:45 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,338 bytes |
コンパイル時間 | 1,264 ms |
コンパイル使用メモリ | 106,560 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 15:34:04 |
合計ジャッジ時間 | 19,070 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | WA | - |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | WA | - |
testcase_93 | WA | - |
testcase_94 | WA | - |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; struct Xor128{ unsigned x,y,z,w; Xor128(unsigned w_=88675123):x(123456789),y(362436069),z(521288629),w(w_){}; inline unsigned xor128(){ unsigned t; t = x^(x<<11); x = y; y = z; z = w; return w = (w^(w>>19))^(t^(t>>8)); } int nextInt(int x,int y){ if(x>y)swap(x,y); return xor128()%(y-x)+x; } double nextDouble(double a,double b){ return (double)(xor128()&0xffff)/0xffff*(b-a)+a; } }; int main(){ int n,a,b; cin>>n>>a>>b; auto rnd = Xor128(); REP(i,1,n){ int x = i, y = n-i; int B = x*(x-1)/2+y*(y-1)/2; if(B>b)continue; double l1 = 0, l2 = 0, r1=1, r2=1; vector<double> rx(2), ry(2); rx[1]=ry[1]=20; rep(i,x-2)rx.push_back(rnd.nextDouble(0,20)); rep(i,y-2)ry.push_back(rnd.nextDouble(0,20)); sort(rx.begin(),rx.end()); sort(ry.begin(),ry.end()); rep(_,25){ double m1 = (l1+r1)/2, m2 = (l2+r2)/2; vector<double> xs(x), ys(y); rep(i,x)xs[i]=m1*rx[i]; rep(i,y)ys[i]=m2*ry[i]; int s =x*(x-1)/2+y*(y-1)/2; rep(i,x){ s -= xs.end()-upper_bound(xs.begin(),xs.end(),xs[i]+10); } rep(i,y){ s -= ys.end()-upper_bound(ys.begin(),ys.end(),ys[i]+10); } if(s==a)break; if(s<a)r1=m1, r2=m2; else l1=m1, l2=m2; } double m1 = (l1+r1)/2, m2 = (l2+r2)/2; vector<double> xs(x), ys(y); rep(i,x)xs[i]=m1*rx[i]; rep(i,y)ys[i]=m2*ry[i]; int s = x*(x-1)/2+y*(y-1)/2; rep(i,x){ s -= xs.end()-upper_bound(xs.begin(),xs.end(),xs[i]+10); } rep(i,y){ s -= ys.end()-upper_bound(ys.begin(),ys.end(),ys[i]+10); } if(s!=a)continue; double l = 0, r = 40; double h = 10.1; rep(_,30){ double m = (l+r)/2; int cnt = 0; rep(i,x)rep(j,y){ if(h*h+(xs[i]-ys[j]-m)*(xs[i]-ys[j]-m)<=400)++cnt; } if(B+cnt==b){ vector<double> X, Y; /*rep(i,x)X.push_back(0),Y.push_back(xs[i]); rep(i,y)X.push_back(h),Y.push_back(ys[i]+m); int cntA = 0, cntB = 0; rep(i,n)rep(j,i){ if((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j])<=100)++cntA; if((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j])<=400)++cntB; } cout<<cntA<<" "<<cntB<<endl;*/ rep(i,x)cout<<0<<" "<<xs[i]<<endl; rep(i,y)cout<<m<<" "<<ys[i]<<endl; return 0; } if(B+cnt>b)l=m; else r=m; } } return 0; }