結果

問題 No.1385 Simple Geometry 2
ユーザー maple116maple116
提出日時 2021-02-07 21:40:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 125 ms / 500 ms
コード長 2,248 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 197,508 KB
実行使用メモリ 35,180 KB
最終ジャッジ日時 2023-09-17 21:00:34
合計ジャッジ時間 14,582 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
14,024 KB
testcase_01 AC 3 ms
13,976 KB
testcase_02 AC 4 ms
13,976 KB
testcase_03 AC 4 ms
14,052 KB
testcase_04 AC 3 ms
13,992 KB
testcase_05 AC 4 ms
13,844 KB
testcase_06 AC 4 ms
14,040 KB
testcase_07 AC 4 ms
13,984 KB
testcase_08 AC 5 ms
14,092 KB
testcase_09 AC 4 ms
14,228 KB
testcase_10 AC 4 ms
13,952 KB
testcase_11 AC 4 ms
13,948 KB
testcase_12 AC 5 ms
13,952 KB
testcase_13 AC 122 ms
35,144 KB
testcase_14 AC 121 ms
35,084 KB
testcase_15 AC 121 ms
35,048 KB
testcase_16 AC 121 ms
34,840 KB
testcase_17 AC 124 ms
34,992 KB
testcase_18 AC 120 ms
34,924 KB
testcase_19 AC 121 ms
35,044 KB
testcase_20 AC 121 ms
34,924 KB
testcase_21 AC 121 ms
34,832 KB
testcase_22 AC 118 ms
35,112 KB
testcase_23 AC 120 ms
34,920 KB
testcase_24 AC 117 ms
35,048 KB
testcase_25 AC 118 ms
35,144 KB
testcase_26 AC 122 ms
35,088 KB
testcase_27 AC 123 ms
35,008 KB
testcase_28 AC 119 ms
35,080 KB
testcase_29 AC 122 ms
35,144 KB
testcase_30 AC 121 ms
34,980 KB
testcase_31 AC 122 ms
35,116 KB
testcase_32 AC 120 ms
34,960 KB
testcase_33 AC 120 ms
34,928 KB
testcase_34 AC 120 ms
34,924 KB
testcase_35 AC 121 ms
34,992 KB
testcase_36 AC 121 ms
34,972 KB
testcase_37 AC 121 ms
34,836 KB
testcase_38 AC 124 ms
35,032 KB
testcase_39 AC 124 ms
34,836 KB
testcase_40 AC 121 ms
34,840 KB
testcase_41 AC 120 ms
35,092 KB
testcase_42 AC 121 ms
34,972 KB
testcase_43 AC 122 ms
34,980 KB
testcase_44 AC 124 ms
35,080 KB
testcase_45 AC 122 ms
34,840 KB
testcase_46 AC 122 ms
34,972 KB
testcase_47 AC 122 ms
35,036 KB
testcase_48 AC 121 ms
35,084 KB
testcase_49 AC 122 ms
34,932 KB
testcase_50 AC 122 ms
34,920 KB
testcase_51 AC 125 ms
35,140 KB
testcase_52 AC 122 ms
35,048 KB
testcase_53 AC 122 ms
35,140 KB
testcase_54 AC 122 ms
35,036 KB
testcase_55 AC 121 ms
34,992 KB
testcase_56 AC 121 ms
35,088 KB
testcase_57 AC 121 ms
35,120 KB
testcase_58 AC 121 ms
35,168 KB
testcase_59 AC 111 ms
35,180 KB
testcase_60 AC 114 ms
34,984 KB
testcase_61 AC 114 ms
34,896 KB
testcase_62 AC 115 ms
34,892 KB
testcase_63 AC 123 ms
35,088 KB
testcase_64 AC 121 ms
35,084 KB
testcase_65 AC 122 ms
34,952 KB
testcase_66 AC 120 ms
34,976 KB
testcase_67 AC 119 ms
34,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//g++ hoge.cpp (-std=c++17) -I . で実行
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
#define rept(itr,v) for(auto itr=v.begin();itr!=v.end();itr++)
#define rept1(itr,v) for(auto itr=v.begin()+1;itr!=v.end();itr++)
#define rept2(itr,v) for(auto itr=v.begin();itr!=v.end()-1;itr++)
#define print(x) cout << (x) << endl;
#define fprint(x) printf("%.15lf\n",(x));
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define YesNo(test) cout << ((test) ? "Yes" : "No") << endl
#define debug cout << "debug_print" << endl
#define Bint boost::multiprecision::cpp_int
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
ll myceil(ll a, ll b) { return (a+b-1) / b; }
//const ll mod = 1e9+7;
//const ll mod = 998244353;
//typedef modint1000000007 mint;
//typedef modint998244353 mint;
//typedef modint mint
//cout << sum.val() << endl;
//mint::set_mod(mod); modが固定でないとき

ll n;
const ll max_n = 500005;
double m,l,t[max_n],a[max_n],s[max_n],c[max_n];
double ss[max_n],sc[max_n],ss2[max_n],sc2[max_n];

int main() {
    // your code goes here
    cin >> n >> l;
    double pi = atan2(0.0, -1.0);
    rep(i,1,n){
        scanf("%lf",&t[i]);
        a[i] = 2.0*pi*t[i]/l;
        s[i] = sin(a[i]);
        ss[i] = ss[i-1] + s[i];
        c[i] = cos(a[i]);
        sc[i] = sc[i-1] + c[i];
    }
    m = n;
    sc2[1] = (2.0-m) * c[1];
    double ar1 = sc2[1] * s[2];
    rep(i,3,n){
        sc2[i-1] = sc2[i-2] + 2.0 * sc[i-2] + (2.0-m) * c[i-1];
        ar1 += sc2[i-1] * s[i];
    }
    ss2[1] = (2.0-m) * s[1];
    double ar2 = ss2[1] * c[2];
    rep(i,3,n){
        ss2[i-1] = ss2[i-2] + 2.0 * ss[i-2] + (2.0-m) * s[i-1];
        ar2 += ss2[i-1] * c[i];
    }
    ll ss = n * (n-1) * (n-2) / 6;
    fprint((ar2-ar1)/((double)ss*2.0));
    return 0;
}
0