Source stringclasses 1
value | Date int64 2.01k 2.02k | Text stringlengths 22 783k | Token_count int64 20 394k |
|---|---|---|---|
Project_CodeNet | 2,020 | #line 1 "test/geometry/distance.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#line 1 "test/geometry/../../library/geometry/geometry.cpp"
const double eps = 1e-10;
inline bool eq(double a, double b) { ... | 2,660 |
Project_CodeNet | 2,019 | #include <iostream>
#include <complex>
#include <utility>
#include <algorithm>
using namespace std;
typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;
#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
double dot(Vector a, Vector b){
r... | 731 |
Project_CodeNet | 2,020 | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector< vector<int> >
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;
const double EPS = 1e-10;
#define equals(a, b) (... | 833 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=105,INF=1<<30;
const double eps=1e-10;
const long double pi=acos((long double)-1.0L);
#define equals(a,b) (fabs((a)-(b))<eps)
class Point{
public:
double x,y;
Point(double ... | 1,840 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
using Point = complex<double>;
using Polygon = vector<Point>;
inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }
inline bool eq(const Point &a, const Point &b) { re... | 1,081 |
Project_CodeNet | 2,019 | #include<bits/stdc++.h>
using namespace std;
typedef complex<double> qua;
const double epx=1e-7;
int ccw(qua a,qua b,qua c)
{
b-=a,c-=a,a=c*conj(b);
if(a.imag()>epx) return 1;
if(a.imag()<-epx) return -1;
if(a.real()<-epx) return 2;
if(abs(b)+epx<abs(c)) return -2;
return 0;
}
int isintersect(qu... | 444 |
Project_CodeNet | 2,020 | /* Header {{{ */
#include <bits/stdc++.h>
using namespace std;
typedef long long readtype;
typedef long long var;
typedef long double let;
readtype read() {
readtype a = 0, c = getchar(), s = 0;
while (!isdigit(c)) s |= c == '-', c = getchar();
while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
return s ?... | 1,367 |
Project_CodeNet | 2,020 | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define db double
#define zero(x) (fabs(x)<eps)
#define sgn(x) (zero(x)?0:((x)>0?1:-1))
const db eps=1e-10;
struct point{
db x,y;
point(){}
point(db x,db y):x(x),y(y){}
point operator + (point B){ return point(x+B.x,y+B.y); }
... | 986 |
Project_CodeNet | 2,017 | #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
template<class T>
struct Vec2
{
Vec2(){}
Vec2(T _x, T _y) : x(_x), y(_y) {}
Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
Vec2 operator-(const Vec2& rhs) const { retur... | 712 |
Project_CodeNet | 2,020 | #include<bits/stdc++.h>
using namespace std;
namespace geometry {
using Real = double;
using Point = complex<Real>;
constexpr Real EPS = 1e-9;
// 誤差を考慮した符号
inline int sgn(const Real x) {
return (x > EPS) - (x < -EPS);
}
// 誤差を考慮した l - r の符号
inline int sgn(const Real l, const Real r) {
return sgn(l - r);
}... | 2,123 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define eps 1e-9
#define nmax 200
#define f(c,a,b) for(int c=a; c<=b; c++)
#define pi acos(-1)
using namespace std;
typedef double db;
struct P{
db x, y;
P operator - (P a){ return (P){x-a.x, y-a.y}; }
db dot(P a){ return a.x*x + a.y*y; }
P operator * (db a) { return (P){a*x, a... | 908 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
constexpr ll mod = 1e9 + 7;
template <class T> inline bool chmax(T &a, const T b) {
if(a >= b) return false;
a = b;
... | 1,268 |
Project_CodeNet | 2,020 | #include<bits/stdc++.h>
#define REP(i,first,last) for(int i=first;i<=last;++i)
#define DOW(i,first,last) for(int i=first;i>=last;--i)
using namespace std;
inline int Read()
{
int x(0),f(1);
char c(getchar());
while(c<'0'||'9'<c)
{
if(c=='-')
{
f=-1;
}
c=getchar();
}
while('0'<=c&&c<='9')
{
x=(x<<1)+... | 1,542 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define 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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) R... | 1,384 |
Project_CodeNet | 2,018 | #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
struct point
{
double x;
double y;
double d;
};
double getMax( double a, double b )
{
if( a > b )
return a;
else
return b;
}
double getMin( double a, double b )
{
if( a < b )
return a;
else
... | 2,766 |
Project_CodeNet | 2,017 | #include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
const double EPS = 1e-10;
int q;
int xp0, yp0, xp1, yp1, xp2, yp2, xp3, yp3;
struct Point {
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) { }
Point operator+(Point p) {
return Point(x + p.x, y + p.y);
}
... | 748 |
Project_CodeNet | 2,020 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbg(x...) do { cout << "\033[32;1m" << #x <<" -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<class T, class... Ts> void err(const T& arg,const Ts&... args) { cout << arg << " "; err(args...); }
typedef long dou... | 1,018 |
Project_CodeNet | 2,017 | #include <iostream>
#include <cmath>
#include <complex>
#include <tuple>
using namespace std;
using vec = complex<double>;
using line = pair<vec,vec>;
const double eps = 0.0000001;
double inner_product(vec u,vec v){
return real(u*conj(v));
}
double cross_product(vec u,vec v){
return imag(conj(u)*v);
}
vec pr... | 844 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { ... | 2,192 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define pii pair<int, int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin(),(c).end())
#define PB(a) push_back(a)
#defin... | 1,768 |
Project_CodeNet | 2,020 | /**
* @copyright (c) 2020 Daisuke Hashimoto
*/
#include <cstdint>
#include <iostream>
#include <cmath>
#include <iomanip>
void CallLineSegmentDistance(std::istream &input_stream) noexcept;
class Point2D {
public:
Point2D() noexcept;
Point2D(const double x, const double y) noexcept;
~Point2D() noexcept;
Po... | 2,433 |
Project_CodeNet | 2,019 | #include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <functional>
using namespace std;
//BEGIN
#define EPS 1e-10
#define equals(a, b) (fabs(a - b) < EPS)
#define Pi 3.141592653589793238
static const int COUNTER_CLO... | 6,563 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template<class T> inline bool chmin(T& a, T... | 1,277 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef complex<double> C;
namespace std
{
bool operator < (const C& a, const C& b) {
return real(a) != real(b) ? real(a) < real(b) : im... | 2,499 |
Project_CodeNet | 2,017 | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//using ll=long long;
const double EPS = 1e-10;
inline bool equals(double a, double b) { return fabs(a - b) < EPS; }
const double PI = 3.141592653589793238;
class Point {
public:
double x, y;
Point(double x, double y) :x(x), y(y) {}
Point(... | 1,003 |
Project_CodeNet | 2,014 | ////////////////////////////////////////////////////////////////////////////////
// 平面幾何
// 型変換できるもの
// double -> Point
// Segment -> Line
// 誤差の話:絶対誤差でも相対誤差でも死ぬ例
// int main(){
// const double EPS = 1e-9;
// double a = 1.3, b = 1e8, c = a + b;
// c = c - b;
// printf("%d\n", equal(a, c)); // =>... | 3,152 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
... | 3,357 |
Project_CodeNet | 2,019 | #include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(register ll(i)=(ll)(a);(i)<=(ll)(b);++i)
const ll inf=1e9+7;
#define y1 _y_1_
#ifndef gc
#define gc getchar
#endif
#ifndef pc
#define pc putchar
#endif
inline ll read(){ll f=0,x=0;register char c=gc();while(!isdigit(c))f^=c==... | 1,639 |
Project_CodeNet | 2,019 | #define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll... | 1,035 |
Project_CodeNet | 2,020 | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std... | 848 |
Project_CodeNet | 2,020 | #include <iostream>
#include <cmath>
//#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#define EPS (1e-10)
using namespace std;
static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=... | 993 |
Project_CodeNet | 2,018 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MON 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
#define max(x, y) ((... | 1,007 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(a) (int)a.size()
#define de(c) cout << #c << " = " << c << endl
#define dd(c) ... | 1,095 |
Project_CodeNet | 2,015 | #include <iostream>
#include <cstdio>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;
const double EPS = 1e-10;
bool EQ(double a, double b){return fabs(a-b) < EPS;}
typedef complex<double> Point;
#define X real()
#define Y imag()
namespace std {
bool operator == (const ... | 1,619 |
Project_CodeNet | 2,015 | #include<complex>
#include<iostream>
#include<algorithm>
using namespace std;
typedef complex<long double> P;
// ??§????????°INF
#define INF (1e16)
// ?¨±?????????????????
#define EPS (1e-16)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2?????????????????????????????????????... | 1,053 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
constexpr int MOD = 1000000007;
... | 994 |
Project_CodeNet | 2,017 |
#include<bits/stdc++.h>
typedef long double lf;
using namespace std;
const lf EPS = 1e-9;
const lf oo = 1e15;
struct pt {
lf x, y;
pt( ) { }
pt( lf x, lf y ) : x( x ), y ( y ) { }
};
inline lf x( pt P ) { return P.x; }
inline lf y( pt P ) { return P.y; }
istream& operator >> ( istream& in, pt& p ) {
... | 1,316 |
Project_CodeNet | 2,016 | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static cons... | 1,493 |
Project_CodeNet | 2,019 | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <complex>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; ret... | 1,377 |
Project_CodeNet | 2,018 | #include<cmath>
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll read()
{
ll x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
struct Point{double x,y;};
Point operator -(Point a,Point b... | 615 |
Project_CodeNet | 2,017 | #include <complex>
#include <cstdio>
#include <iostream>
#include <utility>
using namespace std;
#define X real()
#define Y imag()
#define EPS 1e-10
typedef complex<double> P;
typedef pair<P, P> L;
double dot(P a, P b){
return a.X*b.X + a.Y*b.Y;
}
double cross(P a, P b){
return a.X*b.Y - a.Y*b.X;
}
int ccw(P a, ... | 498 |
Project_CodeNet | 2,020 |
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include<vector>
#include<cstring>
#include<set>
#include <cstdio>
#include<queue>
#include<map>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define endl '\n'
#define forup(i,a,n) for( int i =a; i < n; i++)
#define llforup(i,a,n) for( ll i... | 2,278 |
Project_CodeNet | 2,014 | #include<cstdio>
#include<complex>
#include<utility>
#include<vector>
#include<cmath>
#include<cassert>
using namespace std;
double eps=1e-9;
typedef complex<double> Point;
typedef complex<double> Vector;
template<class T> bool eq(T a,T b){
return abs(a-b)<eps;
}
template<class T> int sgn(T r){
return eq(r,0.0)?... | 2,172 |
Project_CodeNet | 2,019 | #include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
const double EPS = 1e-10;
const int COUNTER_CLOCKWISE = 1, CLOCKWISE = -1, ONLINE_BACK = 2, ONLINE_FRONT = -2, ON_SEGMENT = 0;
bool equals(double a, double b) {
return fabs(a - b) < EPS;
}
struct Point {
double x, y;
Point(double x = 0, double... | 1,190 |
Project_CodeNet | 2,017 | #include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <vector>
#include <cmath>
#include <map>
#include <stack>
#include <algorithm>
typedef long long int ll;
using namespace std;
const int MAX=5000+10;
const double eps=1e-9;
const double PI=acos(-1.0);
int sgn(double x)
... | 1,141 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
// ???/????????????
struct Point {
double x, y;
Point(double x = 0.0, double y = 0.0):x(x), y(y){}
Point operator + (Point p) { return Point(x + p.x, y + p.y); }
Point operator - (Point p) { return ... | 1,365 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
#pragma region Geometry
const double EPS=1e-8,PI=acos(-1);
inline bool EQ(double a,double b){return fabs(b-a)<EPS;}
static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SE... | 2,808 |
Project_CodeNet | 2,020 | #include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } re... | 1,854 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
bool same(double a, double b) { return a == b; }
struct P {
double x, y;
P() : x(0), y(0) {}
P(double x, double y) : x(x), y(y) {}
P operator + (P b) { return P(x + b.x, y + b.y); }
P operator - (P b) { return P(x - b.x, y - b... | 950 |
Project_CodeNet | 2,019 | #include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#d... | 1,131 |
Project_CodeNet | 2,019 | #include<bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) ( fabs(a-b) < EPS )
#define PI 3.141592653589793238
// COUNTER CLOCKWISE
static const int CCW_COUNTER_CLOCKWISE = 1;
static const int CCW_CLOCKWISE = -1;
static const int CCW_ONLINE_BACK = 2;
static const int CCW_ONLINE_FRONT = -2;
... | 3,371 |
Project_CodeNet | 2,019 | #include<bits/stdc++.h>
#define eps (1e-10)
using namespace std;
class Point
{
public:
double x,y;
Point(double _x=0,double _y=0):x(_x),y(_y){}
Point operator + (Point p){ return Point(x+p.x,y+p.y);}
Point operator - (Point p){ return Point(x-p.x,y-p.y);}
Point operator * (double a){return Point(a*x,a*y);}
Point... | 1,767 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
using R = long double;
constexpr R pi = acos((R)-1), eps = 1e-10;
int sgn(R a) { return (a > eps) - (a < -eps); }
int sgn(R a, R b) { return sgn(a - b); }
us... | 887 |
Project_CodeNet | 2,018 | #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
struct Point{
double x;
double y;
Point (double x, double y) : x(x), y(y){}
Point operator-(Point p){
return Point(x - p.x, y - p.y);
}
};
typedef Point Vector;
double dot(Vector v1, Vector v2){
return v1.x * v2.x... | 1,040 |
Project_CodeNet | 2,018 | #include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <cmath>
const double EPSILON = 1e-10;
inline bool equals(double a, double b) {
return std::fabs(a - b) < EPSILON;
}
struct Point {
double x;
double y;
bool operator < (const Point& p) const {
return x != p.x ?... | 1,251 |
Project_CodeNet | 2,017 |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define ESP (1e-10)
using namespace std;
typedef struct Point {
double x;
double y;
Point() { }
Point(double x, double y) :x(x), y(y) { }
Point operator+(Point& p) {
return Point(x + p.x, y + p.y);
}
Point operator-(Point& p) {... | 878 |
Project_CodeNet | 2,018 | #include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <iomanip>
#include <set>
const int MOD... | 1,314 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define per(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define MP make_pair
typedef double db;
const db EPS = 1e-8;
inline int sign(db a) {
return a < -EPS ? -1 : a > EPS;
}
inline int cmp(db a, db b){
return sign(a-b);
}
struct P ... | 1,165 |
Project_CodeNet | 2,013 | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
typedef double D;
const D EPS = 1e-8;
const D INF = 1e10;
const D PI = M_PI;
struct P {
D x, y;
P(D xs, D ys) : x(xs), y(ys) { }
P() { }
};
P operator +(P a, P b) { return P(a.x + b.x, a.y ... | 1,228 |
Project_CodeNet | 2,018 | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <deque>
#include <cmath>
using namespace std;
typedef long long LL;
typedef unsigned long... | 1,408 |
Project_CodeNet | 2,017 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
#define EPS 1e-10
#define equals(a, b) (fabs(a - b) < EPS)
class Vector {
public:
double x, y;
Vector() {}
Vector(double x, double y) : x(x), y(y) {}
Vector operator+(Vector v) { return Vector(x + v.x, y + v.y); ... | 1,060 |
Project_CodeNet | 2,019 | // InterestingLSY
// 2659723130
// 《幽灵公主》是真的好看!
#include <bits/stdc++.h>
using namespace std;
#define il inline
#define elif else if
// Type
#define ld double
#define ll long long
#define ull unsigned ll
// Vector
#define vc vector
#define Pb push_back
#define Pf push_front
#define Eb emplace_back
#define All(x) x.be... | 3,127 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
double EPS = 0.00000001;
int sign(double x){
if (x > EPS){
return 1;
} else if (x < -EPS){
return -1;
} else {
return 0;
}
}
bool equals(double x, double y){
return abs(x - y) < EPS;
}
struct point{
double x;
double y;
point(){
x = 0;
y = 0;
}
point(doub... | 2,041 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(... | 2,045 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) u... | 1,366 |
Project_CodeNet | 2,013 | #include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <casser... | 3,101 |
Project_CodeNet | 2,019 | #include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdio>
#include<algorithm>
using namespace std;
#define EPS 1e-10
static const int COUNTER_CLOCKWISE = 1; //逆时针
static const int CLOCKWISE = -1; //顺时针
static const int ONLINE_BACK = 2; //p2 在直线后面
static const int ONLINE_FRONT = -2; //... | 1,671 |
Project_CodeNet | 2,019 | // ConsoleApplication.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdio.h"
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
using NUM = long double;
template<typename T>
struct Point {
T x, y;
Point<T> operator+(const ... | 1,342 |
Project_CodeNet | 2,017 |
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double eps=1e-7;
bool eq(double a,double b){return (b-a<eps&&a-b<eps);}
double cross(P a,P b){return imag(b*conj(a));}
double dot(P a,P b){return real(b*conj(a));}
P project(P a,P b,P c){b-=a;c-=a;return a+b*real(c/b);}
P reflect(P a,P b,P c){b-=... | 517 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
using namespace std;
struct point{
double x,y;
point(){;}
point(double x,double y):x(x),y(y){;}
point operator -(point p){
return point(x-p.x,y-p.y);
}
};
// ??????p3??¨p1p2????????§
double direction(point p1, point p2, point p3) {
return (p2.x - p1.x)*(p3.y - p2.y) - (p3.x - p2.x)*(p2... | 643 |
Project_CodeNet | 2,019 | #include <stdio.h>
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using name... | 1,024 |
Project_CodeNet | 2,020 | #include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctyp... | 7,956 |
Project_CodeNet | 2,018 | # include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { re... | 2,441 |
Project_CodeNet | 2,020 | #include<bits/stdc++.h>
using namespace std;
struct point{
double x,y;
point(){}
point(double _x,double _y){
x=_x;y=_y;
}
point operator +(const point &b) const{
return point(x+b.x,y+b.y);
}
point operator -(const point &b) const{
return point(x-b.x,y-b.y);
}
double operator ^(const point &b) const{
re... | 655 |
Project_CodeNet | 2,019 | #include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#includ... | 3,385 |
Project_CodeNet | 2,019 | #include <iostream>
#include <sstream>
#include <regex>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
using ll = ... | 1,692 |
Project_CodeNet | 2,019 | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#define eps 1e-14
#define double long double
using namespace std;
struct point{
double x,y;
void read(){scanf("%Lf%Lf",&x,&y);}
void write(){printf("%.10Lf %.10Lf\n",x,y);}
point(double X=0.0,double Y=0.0):x(X),y(Y){}
point ope... | 1,033 |
Project_CodeNet | 2,018 | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
bool dless(double d1, double d2) { return d1 < d2 + eps; }
bool dcmp(double d, double d2 = 0) { return abs(d - d2) < eps; }
double sgn(double d) {
if (dcmp(d))
return 0;
if (d > 0)
return 1;
return -1;
}
struct vec {
double x, y;
... | 1,290 |
Project_CodeNet | 2,019 | #include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const i... | 1,292 |
Project_CodeNet | 2,014 | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
const ld EPS = 1e-9;
const ld INF = 1e10;
const ld PI = M_PI;
struct Point{
ld x, y;
Point(ld x, ld y):x(x), y(y){}
Point(){}
};
Point operator+(const Point &a, const Point &b){
return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const ... | 943 |
Project_CodeNet | 2,020 | // This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that... | 3,534 |
Project_CodeNet | 2,019 | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#define EPS (1e-10)
#define equals(a,b) (fabs(a)-fabs(b)<EPS)
using namespace std;
class Point{
public:
double x,y;
Point(double x=0,double y=0):x(x),y(y){}
Point operator + (Point &p) { return Point(x+p.x,y+p.y... | 1,109 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " <<... | 1,090 |
Project_CodeNet | 2,015 | #define NDEBUG 1
#include <cmath>
#include <complex>
#include <algorithm>
#include <cassert>
using namespace std;
typedef long double Real;
typedef complex<Real> Point;
#define PCR Point const &
#define X real()
#define Y imag()
const Real EPS = 1e-10;
const Real INF = 1e100;
const Real PI = acos(-1);
struct Segment... | 987 |
Project_CodeNet | 2,018 | //Distance
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
static const double ESP = 1e-10;
bool equals(double a, double b) { return fabs(a - b) < ESP; }
class Point {
public:
double x, y;
explicit Point(double x = 0, double y = 0): x(x), y(y) {}
Point operator + (const P... | 1,131 |
Project_CodeNet | 2,020 | #define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map... | 2,552 |
Project_CodeNet | 2,017 | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(... | 1,214 |
Project_CodeNet | 2,015 | #include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
class Point {
public:
double x, y;
Point(double x = 0.0, double y = 0.0): x(x), y(y) {};
Point operator + (Point &p) {return Point(x + p.x, y + p... | 970 |
Project_CodeNet | 2,017 | #ifndef _WIN32
#include<iostream>
#endif
#include <complex>
#include <vector>
#include <utility>
#include <tuple>
#include <algorithm>
#include <iomanip>
using namespace std;
#define FOR(i,bg,ed) for(int i = (bg);<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se ... | 1,015 |
Project_CodeNet | 2,019 | // Vector2d
var Vector2D = class Vector2D {
constructor(x,y){
this.x = x;
this.y = y;
}
}
Vector2D.prototype.Init = function(x,y){
this.x = x;
this.y = y;
}
/*
* v: Vector2D
*/
function rotateVector90(v){
var r = new Vector2D();
r.x = -v.y;
r.y = v.x;
return r;
}
/*
* get degree to radian return radia... | 2,920 |
Project_CodeNet | 2,018 | import scala.io.StdIn
object Main {
case class Point(x: Double = 0, y: Double = 0) {
def +(p: Point): Point = Point(this.x + p.x, this.y + p.y)
def -(p: Point): Point = Point(this.x - p.x, this.y - p.y)
def *(a: Double): Point = Point(this.x * a, this.y * a)
def /(a: Double): Point = {
ass... | 1,385 |
Project_CodeNet | 2,019 | object Main extends App {
import scala.io.StdIn._
for (_ ← 0 until readInt()) {
val Array(x0, y0, x1, y1, x2, y2, x3, y3) = readLine.trim.split(' ').map(_.toInt)
val a = Line(Coordinate(x0, y0), Coordinate(x1, y1))
val b = Line(Coordinate(x2, y2), Coordinate(x3, y3))
println(f"${a.distance(b)}%.10f"... | 460 |
Project_CodeNet | 2,017 | module Point = struct
type t = { x : float; y : float }
let make x y = { x; y }
let equal_p a b = abs_float (a.x -. b.x) < 1e-10 && abs_float (a.y -. b.y) < 1e-10
let sum a b = { x = a.x +. b.x; y = a.y +. b.y }
let diff a b = { x = a.x -. b.x; y = a.y -. b.y }
let multi p k = { x = p.x *. k; y = p.y ... | 1,143 |
Project_CodeNet | 2,020 | macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s... | 2,973 |
Project_CodeNet | 2,020 | use std::f64::consts::PI;
const EPS: f64 = 1e-8;
fn main() {
let mut sc = Scanner::new();
let q = sc.next::<usize>();
for _ in 0..q {
let p0 = sc.next::<Pt>();
let p1 = sc.next::<Pt>();
let p2 = sc.next::<Pt>();
let p3 = sc.next::<Pt>();
let ans = distance_segment... | 2,957 |
Project_CodeNet | 2,020 | package main
import (
"bufio"
"fmt"
"math"
"math/cmplx"
"os"
"strconv"
)
func getScanner(fp *os.File) *bufio.Scanner {
scanner := bufio.NewScanner(fp)
scanner.Split(bufio.ScanWords)
scanner.Buffer(make([]byte, 1000005), 1000005)
return scanner
}
func getNextString(scanner *bufio.Scanner) string {
scanner.S... | 1,309 |
Project_CodeNet | 2,020 | package main
import (
"strings"
"fmt"
"bufio"
"strconv"
"os"
"math"
)
//
func subVector(p1, p2 []float64) []float64 {
return []float64{
p1[0] - p2[0],
p1[1] - p2[1],
}
}
//
func dotVector(p1, p2 []float64) float64 {
return p1[0]*p2[0] + p1[1]*p2[1]
}
//
func crossVector(p1, p2 []float64) float64 {
ret... | 1,579 |
Project_CodeNet | 2,016 | #include<stdio.h>
#include<math.h>
int ifcl(int p0[2],int p1[2],int p2[2],int p3[2]){
long long x=p0[0],x0=p1[0]-x,x1=p2[0]-x,x2=p3[0]-x,x3=x2-x1,x4=x1-x0,x5=x2-x0;
long long y=p0[1],y0=p1[1]-y,y1=p2[1]-y,y2=p3[1]-y,y3=y2-y1,y4=y1-y0,y5=y2-y0;
long long c1=(x0*y1-y0*x1)*(x0*y2-y0*x2),c2=(x3*y4-y3*x4)*(x3*y1-y3*x1... | 614 |
Project_CodeNet | 2,016 | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define max(a,b) a<b?b:a
#define min(a,b) a<b?a:b
#define POW2(a) a*a
#define ROOP(i,n) for(i = 0;i < n;i++)
#define _USE_MATH_DEFINES
typedef struct POINT{
double x;
double y;
}POINT;
typedef struct LINE{
POINT s;//start point
POINT e;//end point
}LINE;
typed... | 2,236 |
Project_CodeNet | 2,016 | #include <stdio.h>
#include <math.h>
#define EPS 0.0000000002
#define MAX 1010001000
typedef struct point{
double x, y;
}point;
typedef struct line{
point st, en;
}line;
double norm(point a);
double norm2(point a);
double distans(point a, point b);
point sum_vector(point a, point b);
point diff_vector(point ... | 1,612 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.