結果

問題 No.1365 [Cherry 1st Tune] Whose Fault?
ユーザー 👑 NachiaNachia
提出日時 2021-02-06 17:30:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 199,868 KB
実行使用メモリ 5,152 KB
最終ジャッジ日時 2023-09-16 03:28:27
合計ジャッジ時間 19,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 22 ms
4,380 KB
testcase_14 AC 15 ms
4,380 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 13 ms
4,376 KB
testcase_18 AC 8 ms
4,376 KB
testcase_19 AC 21 ms
4,376 KB
testcase_20 AC 13 ms
4,380 KB
testcase_21 AC 19 ms
4,376 KB
testcase_22 AC 16 ms
4,384 KB
testcase_23 AC 48 ms
4,380 KB
testcase_24 AC 102 ms
4,408 KB
testcase_25 AC 195 ms
4,692 KB
testcase_26 AC 136 ms
4,616 KB
testcase_27 AC 156 ms
4,380 KB
testcase_28 AC 64 ms
4,376 KB
testcase_29 AC 57 ms
4,376 KB
testcase_30 AC 247 ms
4,656 KB
testcase_31 AC 216 ms
4,836 KB
testcase_32 AC 124 ms
4,748 KB
testcase_33 AC 187 ms
4,380 KB
testcase_34 AC 149 ms
4,384 KB
testcase_35 AC 91 ms
4,560 KB
testcase_36 AC 181 ms
4,776 KB
testcase_37 AC 39 ms
4,380 KB
testcase_38 AC 53 ms
4,776 KB
testcase_39 AC 228 ms
4,488 KB
testcase_40 AC 224 ms
4,584 KB
testcase_41 AC 175 ms
4,628 KB
testcase_42 AC 153 ms
4,384 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 69 ms
5,152 KB
testcase_45 AC 80 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define I int
#define S(a)scanf("%d",&a);
#define R for(I i=0;i<(N);i++)
#define f(i)A[i]*A[i]/P[i]
I N,A[1<<17],V[1<<17],u,v,g;double P[1<<17],E=0;I Z(I a){return V[a]+1?V[a]=Z(V[a]):a;}I U(I a,I b){a=Z(a);b=Z(b);return a^b?V[b]=a:-1;}I main(){S(N)R S(A[i])R{S(u)A[i]-=u;V[i]=-1;}R{S(u)P[i]=1./u;E+=f(i);}S(N)R{S(u)S(v)u=Z(u-1);v=Z(v-1);if(u^v){g=U(u,v);E-=f(u)+f(v);A[g]+=A[u+=v-g];P[g]+=P[u];E+=f(g);}printf("%f\n",E);}return 0;}
0