結果

問題 No.869 ふたつの距離
ユーザー 👑 kmjpkmjp
提出日時 2019-08-22 02:30:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 2,112 bytes
コンパイル時間 1,804 ms
コンパイル使用メモリ 178,484 KB
実行使用メモリ 12,912 KB
最終ジャッジ日時 2023-08-01 06:31:42
合計ジャッジ時間 13,415 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 153 ms
5,212 KB
testcase_43 AC 43 ms
4,376 KB
testcase_44 AC 59 ms
5,092 KB
testcase_45 AC 100 ms
5,096 KB
testcase_46 AC 5 ms
4,376 KB
testcase_47 AC 33 ms
4,380 KB
testcase_48 AC 65 ms
4,380 KB
testcase_49 AC 71 ms
5,156 KB
testcase_50 AC 42 ms
4,380 KB
testcase_51 AC 8 ms
4,376 KB
testcase_52 AC 4 ms
4,376 KB
testcase_53 AC 20 ms
4,380 KB
testcase_54 AC 136 ms
7,400 KB
testcase_55 AC 85 ms
5,244 KB
testcase_56 AC 25 ms
4,376 KB
testcase_57 AC 66 ms
4,376 KB
testcase_58 AC 12 ms
4,380 KB
testcase_59 AC 17 ms
4,380 KB
testcase_60 AC 123 ms
8,772 KB
testcase_61 AC 49 ms
4,376 KB
testcase_62 AC 145 ms
4,376 KB
testcase_63 AC 170 ms
8,424 KB
testcase_64 AC 36 ms
4,376 KB
testcase_65 AC 92 ms
7,396 KB
testcase_66 AC 83 ms
4,376 KB
testcase_67 AC 187 ms
11,748 KB
testcase_68 AC 219 ms
7,736 KB
testcase_69 AC 201 ms
8,984 KB
testcase_70 AC 211 ms
8,588 KB
testcase_71 AC 212 ms
7,532 KB
testcase_72 AC 188 ms
12,912 KB
testcase_73 AC 198 ms
8,520 KB
testcase_74 AC 197 ms
8,692 KB
testcase_75 AC 226 ms
5,232 KB
testcase_76 AC 198 ms
7,648 KB
testcase_77 AC 183 ms
12,496 KB
testcase_78 AC 182 ms
11,464 KB
testcase_79 AC 183 ms
11,604 KB
testcase_80 AC 182 ms
11,864 KB
testcase_81 AC 182 ms
11,984 KB
testcase_82 AC 205 ms
7,992 KB
testcase_83 AC 218 ms
7,788 KB
testcase_84 AC 192 ms
7,676 KB
testcase_85 AC 205 ms
7,532 KB
testcase_86 AC 218 ms
8,580 KB
testcase_87 AC 193 ms
8,008 KB
testcase_88 WA -
testcase_89 AC 218 ms
8,568 KB
testcase_90 AC 193 ms
8,456 KB
testcase_91 AC 258 ms
4,376 KB
testcase_92 AC 182 ms
11,788 KB
testcase_93 AC 2 ms
4,380 KB
testcase_94 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void solve()’ 内:
main.cpp:52:38: 警告: ‘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: 備考: ‘V’ はここで定義されています
   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