Submission #7887244


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)

#define BR "\n"
#define SP " "
#define fcout cout << fixed << setprecision(18)

int main() {
  int N, L;
  cin >> N >> L;

  double pi = 3.14159265358979;
  vector<double> T(N);

  rep0(i, N) {
    double t; cin >> t;
    T[i] = 2 * pi * t / L;
  }

  double ansx = 0, ansy = 0;
  rep0(i, N) {
    rep(j, i + 1, N) {
      double t1, t2, c1, c2;
      c1 = j - i - 1;
      c2 = N - 2 - c1;
      t1 = (T[i] + T[j]) / 2 + pi;
      t2 = (T[i] + T[j]) / 2;
      ansx += c1 * cos(t1) + c2 * cos(t2);
      ansy += c1 * sin(t1) + c2 * sin(t2);
    }
  }
  ansx = ansx * 6 / N / (N - 1) / (N - 2);
  ansy = ansy * 6 / N / (N - 1) / (N - 2);
  fcout << ansx << SP << ansy << BR;

  return 0;
}

Submission Info

Submission Time
Task D - Incenters
User nakaken88
Language C++14 (GCC 5.4.1)
Score 1000
Code Size 877 Byte
Status AC
Exec Time 651 ms
Memory 512 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1000 / 1000
Status
AC × 3
AC × 27
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 639 ms 512 KiB
02.txt AC 629 ms 256 KiB
03.txt AC 627 ms 256 KiB
04.txt AC 624 ms 256 KiB
05.txt AC 622 ms 256 KiB
06.txt AC 615 ms 256 KiB
07.txt AC 626 ms 256 KiB
08.txt AC 629 ms 256 KiB
09.txt AC 630 ms 256 KiB
10.txt AC 637 ms 384 KiB
11.txt AC 643 ms 256 KiB
12.txt AC 625 ms 256 KiB
13.txt AC 622 ms 256 KiB
14.txt AC 619 ms 256 KiB
15.txt AC 562 ms 256 KiB
16.txt AC 562 ms 256 KiB
17.txt AC 562 ms 256 KiB
18.txt AC 560 ms 256 KiB
19.txt AC 443 ms 256 KiB
20.txt AC 437 ms 256 KiB
21.txt AC 651 ms 256 KiB
22.txt AC 637 ms 256 KiB
23.txt AC 1 ms 256 KiB
24.txt AC 1 ms 256 KiB
s1.txt AC 1 ms 256 KiB
s2.txt AC 1 ms 256 KiB
s3.txt AC 1 ms 256 KiB