QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#584344 | #55. 欧几里得距离之和 | 275307894a | 0 | 949ms | 8396kb | C++14 | 1.5kb | 2024-09-23 12:53:41 | 2024-09-23 12:53:41 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=5e5+5,M=N*4+5,K=1e7+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const ll INF=1e18+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n;
int X[N],Y[N];
db A[N];
const db pi=acos(-1);
void Solve(){
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d%d",&X[i],&Y[i]);
db tot=0;int cnt=0;
while(clock()*1.0/CLOCKS_PER_SEC<0.95){
db ap=R(1000000)*2*pi/1000000.0;
db x=cos(ap),y=sin(ap);
for(int i=1;i<=n;i++) A[i]=X[i]*x+Y[i]*y;
sort(A+1,A+n+1);
for(int i=1;i<=n;i++) tot+=A[i]*(2*i-n-1);
cnt++;
}
printf("%.9lf\n",tot*pi/cnt/2);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 949ms
memory: 6328kb
input:
3000 -802420 -321989 227507 956314 -460698 -819834 -479809 -341770 191520 109304 712327 -189558 -578326 -41090 282566 982266 -859119 686756 209058 -23298 -884994 -349898 -11358 182915 -507706 -81622 745434 575941 -374809 139274 810223 367608 960234 -197223 439081 573568 -275182 999306 -583036 -61808...
output:
4692988016567.655273438
result:
ok found '4692988016567.65527', expected '4693148621177.00000', error '0.00003'
Test #2:
score: 10
Accepted
time: 948ms
memory: 8396kb
input:
3000 355304 988961 795796 -662640 -645198 -958837 329302 785647 -299213 -228904 -57373 -168432 878619 217989 -139688 -425127 -913922 56220 37759 -629073 845165 947960 138567 -158544 -273997 665415 -542631 -396335 671243 746363 915256 -658071 822875 107176 907246 -122566 -435158 542446 246635 -219367...
output:
4743862994338.434570312
result:
ok found '4743862994338.43457', expected '4743610987955.02344', error '0.00005'
Test #3:
score: 0
Wrong Answer
time: 948ms
memory: 6324kb
input:
3000 786103 -845895 689793 79187 595234 839298 514009 -846559 384647 330593 753754 -684307 259322 -573700 783331 -225552 374250 -511337 -918633 749936 -866081 739595 576173 -890867 369485 -443171 -64775 -82830 -629343 799652 -6309 -656049 -467133 43098 -690934 137775 -365643 -259929 809532 -552527 -...
output:
4671741562843.549804688
result:
wrong answer 1st numbers differ - expected: '4671074128383.44824', found: '4671741562843.54980', error = '0.00014'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%