結果

問題 No.869 ふたつの距離
ユーザー 👑 kmjpkmjp
提出日時 2019-08-22 02:30:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 1,500 ms
コード長 2,112 bytes
コンパイル時間 1,792 ms
コンパイル使用メモリ 176,672 KB
実行使用メモリ 12,732 KB
最終ジャッジ日時 2024-04-19 06:05:57
合計ジャッジ時間 10,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,940 KB
testcase_40 AC 2 ms
6,944 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 120 ms
6,944 KB
testcase_43 AC 33 ms
6,944 KB
testcase_44 AC 49 ms
6,940 KB
testcase_45 AC 81 ms
6,944 KB
testcase_46 AC 4 ms
6,944 KB
testcase_47 AC 26 ms
6,940 KB
testcase_48 AC 53 ms
6,940 KB
testcase_49 AC 58 ms
6,944 KB
testcase_50 AC 34 ms
6,944 KB
testcase_51 AC 7 ms
6,944 KB
testcase_52 AC 4 ms
6,944 KB
testcase_53 AC 16 ms
6,940 KB
testcase_54 AC 112 ms
8,452 KB
testcase_55 AC 69 ms
6,940 KB
testcase_56 AC 20 ms
6,940 KB
testcase_57 AC 52 ms
6,944 KB
testcase_58 AC 11 ms
6,944 KB
testcase_59 AC 15 ms
6,940 KB
testcase_60 AC 102 ms
7,684 KB
testcase_61 AC 40 ms
6,940 KB
testcase_62 AC 114 ms
6,940 KB
testcase_63 AC 139 ms
8,456 KB
testcase_64 AC 29 ms
6,940 KB
testcase_65 AC 78 ms
7,812 KB
testcase_66 AC 67 ms
6,944 KB
testcase_67 AC 152 ms
11,776 KB
testcase_68 AC 176 ms
8,972 KB
testcase_69 AC 164 ms
7,820 KB
testcase_70 AC 166 ms
8,324 KB
testcase_71 AC 172 ms
8,840 KB
testcase_72 AC 154 ms
12,656 KB
testcase_73 AC 161 ms
8,072 KB
testcase_74 AC 164 ms
7,692 KB
testcase_75 AC 180 ms
6,940 KB
testcase_76 AC 165 ms
9,100 KB
testcase_77 AC 152 ms
11,900 KB
testcase_78 AC 150 ms
12,172 KB
testcase_79 AC 153 ms
12,120 KB
testcase_80 AC 149 ms
12,136 KB
testcase_81 AC 156 ms
12,732 KB
testcase_82 AC 167 ms
9,352 KB
testcase_83 AC 174 ms
8,204 KB
testcase_84 AC 156 ms
8,328 KB
testcase_85 AC 167 ms
8,456 KB
testcase_86 AC 173 ms
7,564 KB
testcase_87 AC 158 ms
7,944 KB
testcase_88 AC 163 ms
8,072 KB
testcase_89 AC 176 ms
7,824 KB
testcase_90 AC 159 ms
7,560 KB
testcase_91 AC 202 ms
6,940 KB
testcase_92 AC 150 ms
12,236 KB
testcase_93 AC 2 ms
6,940 KB
testcase_94 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:52:38: warning: 'V' may be used uninitialized [-Wmaybe-uninitialized]
   52 |         x=A*1.0*U*(U-1)/(U*(U-1)+V*(V-1))+0.5;
      |                                    ~~^~~
main.cpp:47:15: note: 'V' was declared here
   47 |         int U,V;
      |               ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,A,B;

long double getrandom() {
	int a=rand()%10000;
	int b=rand()%10000;
	return (a*10000+b)/10000000000.0;
}

vector<long double> hoge(int n,int p) {
	vector<long double> T;
	T.push_back(getrandom());
	while(T.size()<n) T.push_back(T.back()+getrandom());
	if(n<2) return T;
	long double L=0,R=17.3/(n-1);
	int i,x,y;
	FOR(i,100) {
		long double M=(L+R)/2.0;
		int num=0;
		FOR(y,n) FOR(x,y) if((T[y]+y*M)-(T[x]+x*M)<=10) num++;
		if(num>=p) L=M;
		else R=M;
	}
	
	FOR(i,n) T[i]+=L*i;
	return T;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	srand(time(NULL));
	cin>>N>>A>>B;
	int U,V;
	for(U=1;U<=N;U++) {
		V=N-U;
		if(U>=V && U*(U-1)/2+V*(V-1)/2>=A) break;
	}
	x=A*1.0*U*(U-1)/(U*(U-1)+V*(V-1))+0.5;
	y=A-x;
	B-=U*(U-1)/2+V*(V-1)/2;
	vector<long double> S=hoge(U,x);
	vector<long double> T=hoge(V,y);
	vector<pair<long double,long double>> R;
	vector<double> C;
	FORR(s,S) FORR(t,T) {
		C.push_back(sqrt((long double)400-(t-s)*(t-s))-0.000000001);
	}
	sort(ALL(C));
	reverse(ALL(C));
	FORR(s,S) R.push_back({s,C[B-1]});
	FORR(t,T) R.push_back({t,0});
	
	/*
	int num[2]={};
	FORR(x,R) FORR(y,R) if(x<y) {
		long double a=x.first-y.first;
		long double b=x.second-y.second;
		if(a*a+b*b<=100.0000000000) num[0]++;
		if(a*a+b*b<=400.0000000000) num[1]++;
	}
	_P("%d %d %d\n",N,num[0],num[1]);
	assert(num[0]==A);
	assert(num[1]==B+U*(U-1)/2+V*(V-1)/2);
	*/
	FORR(r,R) _P("%.12lf %.12lf\n",(double)r.first,(double)r.second);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0