Submission #2132665


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <complex>
#include <cstdio>
#include <utility>
#include <vector>
#include <cassert>
using namespace std;
typedef complex<long double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;
typedef vector<P> Poly;
#define X real()
#define Y imag()
#define EPS (1e-10)
#define INF (1e15)

//2D version
namespace std{
  bool operator < (const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
  bool operator == (const P& a, const P& b){
    return abs(a-b) < EPS;
  }
}

P n_vector(P a){
  //aベクトルに垂直な単位ベクトル
  long double l = abs(a);
  return (long double)1000.0*a*P(0.0,1.0)/l;
}

int main(){
  int N;
  cin >> N;
  vector<P> V(N);
  long double x, y;
  for(int i = 0; i < N; ++i){
    cin >> x >> y;
    V[i] = P(x,y);
  }
  vector< vector<long double> > A(N);
  long double pi = acos(-1.0);
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j){
      if(i == j) continue;
      long double theta = arg(n_vector((long double)100.0*(V[j]-V[i])));
      //if(theta < 0) theta += 2*pi;
      A[i].push_back(theta);
    }
  }
  double s = 0.0;
  for(int i = 0; i < N; ++i){
    long double m = -INF, M = INF;
    for(int j = 0; j < A[i].size(); ++j){
      long double m_ = A[i][j], M_ = A[i][j] + pi;
      if(M_ > pi && M_ - 2*pi > m){
        M_ -= 2*pi;
        m_ -= 2*pi;
      }
      m = max(m,m_);
      M = min(M,M_);
    }
    printf("%.20Lf\n",max((long double)0.0,(M-m)/pi/2.0));
    s += max((long double)0.0,(M-m)/pi/2.0);
  }

  assert(abs(s - 1.0) < EPS);
  return 0;
}

Submission Info

Submission Time
Task B - Holes
User TAB
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1655 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt
All 0 / 600 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
Case Name Status Exec Time Memory
01.txt
02.txt 3 ms 512 KB
03.txt
04.txt 3 ms 512 KB
05.txt 3 ms 512 KB
06.txt
07.txt
08.txt
09.txt
10.txt
11.txt
12.txt
13.txt 3 ms 512 KB
14.txt 3 ms 512 KB
15.txt
16.txt
17.txt
18.txt
19.txt 3 ms 512 KB
20.txt 3 ms 512 KB
21.txt
22.txt 1 ms 256 KB
23.txt 1 ms 256 KB
24.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB