結果

問題 No.1385 Simple Geometry 2
ユーザー cardano1016cardano1016
提出日時 2021-02-07 15:32:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,802 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 106,396 KB
実行使用メモリ 19,116 KB
最終ジャッジ日時 2023-09-17 18:34:23
合計ジャッジ時間 32,854 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 6 ms
4,380 KB
testcase_09 AC 6 ms
4,384 KB
testcase_10 AC 6 ms
4,380 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 494 ms
18,860 KB
testcase_14 AC 491 ms
18,784 KB
testcase_15 AC 492 ms
19,064 KB
testcase_16 AC 492 ms
18,664 KB
testcase_17 AC 494 ms
19,036 KB
testcase_18 AC 488 ms
18,688 KB
testcase_19 AC 482 ms
18,924 KB
testcase_20 AC 492 ms
18,952 KB
testcase_21 AC 495 ms
18,720 KB
testcase_22 AC 475 ms
19,024 KB
testcase_23 AC 490 ms
18,712 KB
testcase_24 AC 476 ms
18,920 KB
testcase_25 AC 479 ms
18,712 KB
testcase_26 AC 491 ms
18,856 KB
testcase_27 AC 492 ms
18,668 KB
testcase_28 AC 474 ms
18,724 KB
testcase_29 AC 494 ms
18,920 KB
testcase_30 AC 492 ms
18,716 KB
testcase_31 AC 493 ms
18,716 KB
testcase_32 AC 489 ms
18,780 KB
testcase_33 AC 491 ms
18,852 KB
testcase_34 AC 486 ms
18,904 KB
testcase_35 AC 492 ms
18,728 KB
testcase_36 AC 490 ms
18,728 KB
testcase_37 AC 491 ms
18,680 KB
testcase_38 AC 491 ms
18,680 KB
testcase_39 AC 492 ms
18,848 KB
testcase_40 AC 491 ms
19,028 KB
testcase_41 AC 492 ms
18,688 KB
testcase_42 AC 490 ms
18,984 KB
testcase_43 AC 491 ms
18,852 KB
testcase_44 AC 495 ms
18,852 KB
testcase_45 AC 493 ms
18,856 KB
testcase_46 AC 494 ms
18,968 KB
testcase_47 AC 493 ms
18,664 KB
testcase_48 AC 494 ms
18,720 KB
testcase_49 AC 493 ms
19,012 KB
testcase_50 AC 493 ms
18,720 KB
testcase_51 AC 493 ms
18,780 KB
testcase_52 AC 495 ms
18,720 KB
testcase_53 AC 492 ms
19,088 KB
testcase_54 AC 492 ms
18,668 KB
testcase_55 AC 495 ms
18,928 KB
testcase_56 AC 494 ms
18,776 KB
testcase_57 AC 492 ms
18,660 KB
testcase_58 TLE -
testcase_59 AC 446 ms
18,928 KB
testcase_60 AC 395 ms
18,784 KB
testcase_61 AC 398 ms
18,780 KB
testcase_62 AC 402 ms
18,720 KB
testcase_63 TLE -
testcase_64 TLE -
testcase_65 AC 494 ms
18,724 KB
testcase_66 AC 499 ms
18,852 KB
testcase_67 AC 475 ms
18,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <chrono>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=a;i<b;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,a) rrepi(i,a,0)
#define rrepi(i,a,b) for(ll i=a-1;i>=b;--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<int,int> pi;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
typedef string::const_iterator State;
const ll MAX = 105;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

const double PI = 3.1415926535;

int main(){
    ll n,l;
    cin >> n >> l;
    vector<long double> coss(n),sins(n);
    rep(i,n){
        long double t;
        cin >> t;
        coss[i] = cos(2*PI*t/(long double)l);
        sins[i] = sin(2*PI*t/(long double)l);
    }
    long double sumsin = 0.0,sumcos = 0.0;
    rep(i,n){
        sumsin += sins[i];
        sumcos += coss[i];
    }
    long double ans = 0.0,nowsin = 0.0,nowcos = 0.0;
    rep(i,n-1){
        nowsin += (n-i-2)*sins[i+1];
        nowcos += (n-i-2)*coss[i+1];
    }
    rep(i,n){
        ans += nowsin*coss[i]-nowcos*sins[i];
        nowsin = nowsin+sumsin-(n-1)*sins[(i+1)%n]-sins[i];
        nowcos = nowcos+sumcos-(n-1)*coss[(i+1)%n]-coss[i];
    }
    ll k = n*(n-1)*(n-2)/6;
    printf("%.12Lf\n",ans/(long double)k/2.0);
}
0