SlideShare a Scribd company logo
1 of 26
Download to read offline
ICPC ~ ~
● !
● !
● !
● !
● !
● !
●
● x,y
!
● 2
● C++ STL complex !
◦ !
● typedef complex<double> Point;!
◦ !
● x real() y imag() !
◦ a(x,y) !
● Point a;!
● a.real() = x; a.imag() = y;!
◦ !
● x:
y:
a(x,y)
O
●
!
◦ a !
●
x
y
a(x,y)
O
complex
● !
◦ complex
!
●
!
struct Point{!
double x,y;!
Point(double a, double b){ x = a; y = b; }!
};
● a,b a-b
!
◦ double dis(Point a, Point b){ return abs(a-b); }
b(xb,yb)
a(xa,ya)
θ b(xb,yb)
a(xa,ya)
  θ b(xb,yb)
a(xa,ya)
● = |a| * |b| * sinθ

= |b| * |b xa |

= × !
● = × / 2

= / 2
10
 
 θ
● 2 a,b c !
● ccw
11
a
b
ccw
int ccw(Point a, Point b, Point c){

if(cross(b-a,c-a)>EPS)return 1;

if(cross(b-a,c-a)<-EPS)return -1;

if(dot(b-a,c-a)<-EPS)return 2;

if(abs(b-a)+EPS<abs(c-a)return -2;

return 0;

}
12
a
b
: AOJ0035 Is It Convex?
● !
●
13
● 2
!
● 2
!
◦ typedef pair<Point, Point> Line;!
●
a
b
a
b
ab ab
 
a
b
c
θ
● ab c
a,b c !
●
a
b
c
a
b
c
● a : ∠BAC > 90°!
● b : ∠ABC > 90°!
● : !
∠BAC <= 90° ABC <= 90°!
● cosθ(= )
a
b
c
a
b
c
double seg_to_point_dis(Line l, Point p){!
Point a = l.first, b = l.second, c = p;!
if(dot(b-a,c-a)<EPS)return abs(c-a);!
if(dot(a-b,c-b)<EPS)return abs(c-b);!
return line_to_point_dis(l,p);!
}
a
b
c
a
b
c
●
!
double seg_to_seg_dis(Line a, Line b){!
double res = seg_to_point_dis(a, b.first);!
res = min(res, set_to_point_dis(a, b.second) );!
res = min(res, set_to_point_dis(b, a.first) );!
res = min(res, set_to_point_dis(b, a.second) );!
return res;!
}
● a b !
◦ a 2 b !
◦ b 2 a !
●
a
b
a
b
● a,b !
● b 2 a !
● a 2 b !
● ccw
 
 
α
-β
b1
b2
bool is_cross(Line a, Line b){!
if(ccw(a.first,a.second,b.first)*!
ccw(a.first,a.second,b.second) <= 0 &&
ccw(b.first,b.second,a.first)*!
ccw(b.first,b.second,a.second) <= 0){!
return true;!
}!
return false;!
}
: AOJ2351 Closest Segment Pair
● N !
● !
● 2 ≦ N ≦ 105
!
● 0 ≦ xi,yi ≦ 100
23
 
 
b1
b2
cp
● a , b !
● a !
●
Point cross_point(Line a, Line b){

double d1 = cross(b.second - b.first,

b.first - a.first);

double d2 = cross(b.second - b.first,

a.second - a.first);

return a.first + (a.second - a.first) * d1/d2;

}
25
 
 
b1
b2
cp
d1 = |b2-b1| * |b1-a1| * sinx!
= |b2-b1| * |o1-a1|!
d2 = |b2-b1| * |a1-a1| * siny!
= |b2-b1| * |o2-a1|!
!
d1/d2 = |o1-a1| / |o2-a1|!
= |cp-a1| / |a1-a1|
o1
o2
: AOJ0187 Stoning Fortune
● 3 3
!
●
3 !
● -1000 ≦ xi,yi ≦ 1000
26

More Related Content

What's hot

C project on a bookshop for saving of coustmer record
C project on a bookshop for saving of coustmer recordC project on a bookshop for saving of coustmer record
C project on a bookshop for saving of coustmer recordZaibi Gondal
 
Jillian Fluet’S Potw Solution
Jillian Fluet’S Potw SolutionJillian Fluet’S Potw Solution
Jillian Fluet’S Potw Solutionjillianfluet
 
Jillians Potw
Jillians PotwJillians Potw
Jillians Potwsabsma
 
11th Maths - Probability - BAYE’S THEOREM
11th Maths - Probability - BAYE’S THEOREM11th Maths - Probability - BAYE’S THEOREM
11th Maths - Probability - BAYE’S THEOREMEdnexa
 
Engineer event in Kyoto 10-04-17
Engineer event in Kyoto 10-04-17Engineer event in Kyoto 10-04-17
Engineer event in Kyoto 10-04-17ryo katsuma
 
Flow chart diagram
Flow chart diagramFlow chart diagram
Flow chart diagramWhar Zina
 
Closest point on OBB to point by j3j3bu5t3r5
Closest point on OBB to point by j3j3bu5t3r5Closest point on OBB to point by j3j3bu5t3r5
Closest point on OBB to point by j3j3bu5t3r5gsantos15
 
Efficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope VolumeEfficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope VolumeVissarion Fisikopoulos
 
Gaya horizontal pada tiang pancang
Gaya horizontal pada tiang pancangGaya horizontal pada tiang pancang
Gaya horizontal pada tiang pancangNurul Angreliany
 
วิธีการคำนวณเงินกู้และดอกเบี้ย
วิธีการคำนวณเงินกู้และดอกเบี้ยวิธีการคำนวณเงินกู้และดอกเบี้ย
วิธีการคำนวณเงินกู้และดอกเบี้ยLoveLovearm
 

What's hot (16)

C project on a bookshop for saving of coustmer record
C project on a bookshop for saving of coustmer recordC project on a bookshop for saving of coustmer record
C project on a bookshop for saving of coustmer record
 
Jillian Fluet’S Potw Solution
Jillian Fluet’S Potw SolutionJillian Fluet’S Potw Solution
Jillian Fluet’S Potw Solution
 
Jillians Potw
Jillians PotwJillians Potw
Jillians Potw
 
11th Maths - Probability - BAYE’S THEOREM
11th Maths - Probability - BAYE’S THEOREM11th Maths - Probability - BAYE’S THEOREM
11th Maths - Probability - BAYE’S THEOREM
 
Engineer event in Kyoto 10-04-17
Engineer event in Kyoto 10-04-17Engineer event in Kyoto 10-04-17
Engineer event in Kyoto 10-04-17
 
Flow chart diagram
Flow chart diagramFlow chart diagram
Flow chart diagram
 
Closest point on OBB to point by j3j3bu5t3r5
Closest point on OBB to point by j3j3bu5t3r5Closest point on OBB to point by j3j3bu5t3r5
Closest point on OBB to point by j3j3bu5t3r5
 
3
33
3
 
Afshaa fybca1
Afshaa fybca1Afshaa fybca1
Afshaa fybca1
 
Leyes de conjuntos (Grafos)
Leyes de conjuntos (Grafos)Leyes de conjuntos (Grafos)
Leyes de conjuntos (Grafos)
 
Strongly Connected Components
Strongly Connected Components Strongly Connected Components
Strongly Connected Components
 
Efficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope VolumeEfficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope Volume
 
Fuvest 2017 - aberta
Fuvest 2017 - abertaFuvest 2017 - aberta
Fuvest 2017 - aberta
 
Gaya horizontal pada tiang pancang
Gaya horizontal pada tiang pancangGaya horizontal pada tiang pancang
Gaya horizontal pada tiang pancang
 
week-5x
week-5xweek-5x
week-5x
 
วิธีการคำนวณเงินกู้และดอกเบี้ย
วิธีการคำนวณเงินกู้และดอกเบี้ยวิธีการคำนวณเงินกู้และดอกเบี้ย
วิธีการคำนวณเงินกู้และดอกเบี้ย
 

Similar to Kika

Kuliah 10 Vektor.pptx
Kuliah 10 Vektor.pptxKuliah 10 Vektor.pptx
Kuliah 10 Vektor.pptxZaenurRohman7
 
Rotation
RotationRotation
Rotationgistri
 
Arduino coding class
Arduino coding classArduino coding class
Arduino coding classJonah Marrs
 
popquiz-q2math.pptx
popquiz-q2math.pptxpopquiz-q2math.pptx
popquiz-q2math.pptxEdenGuerrero
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...akaptur
 
Problemas resueltos de funciones lineales ccesa007
Problemas resueltos de  funciones lineales ccesa007Problemas resueltos de  funciones lineales ccesa007
Problemas resueltos de funciones lineales ccesa007Demetrio Ccesa Rayme
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operatorsAswin Pv
 
Raices de ecuaciones
Raices de ecuacionesRaices de ecuaciones
Raices de ecuacionesNatalia
 
Raices de ecuaciones
Raices de ecuacionesRaices de ecuaciones
Raices de ecuacionesNatalia
 
Mathematical preliminaries in Automata
Mathematical preliminaries in AutomataMathematical preliminaries in Automata
Mathematical preliminaries in AutomataMobeen Mustafa
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh AnkitSinghRajput35
 
PUSH DOWN AUTOMATA VS TURING MACHINE
PUSH DOWN AUTOMATA VS TURING MACHINEPUSH DOWN AUTOMATA VS TURING MACHINE
PUSH DOWN AUTOMATA VS TURING MACHINEAbhishek Shivhare
 

Similar to Kika (20)

D1
D1D1
D1
 
Kuliah 10 Vektor.pptx
Kuliah 10 Vektor.pptxKuliah 10 Vektor.pptx
Kuliah 10 Vektor.pptx
 
Rotation
RotationRotation
Rotation
 
Maths formulae
Maths formulaeMaths formulae
Maths formulae
 
Arduino coding class
Arduino coding classArduino coding class
Arduino coding class
 
popquiz-q2math.pptx
popquiz-q2math.pptxpopquiz-q2math.pptx
popquiz-q2math.pptx
 
Sop and pos
Sop and posSop and pos
Sop and pos
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
Função afim resumo teórico e exercícios - celso brasil
Função afim   resumo teórico e exercícios - celso brasilFunção afim   resumo teórico e exercícios - celso brasil
Função afim resumo teórico e exercícios - celso brasil
 
pendik escort
pendik escortpendik escort
pendik escort
 
Problemas resueltos de funciones lineales ccesa007
Problemas resueltos de  funciones lineales ccesa007Problemas resueltos de  funciones lineales ccesa007
Problemas resueltos de funciones lineales ccesa007
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
 
Raices de ecuaciones
Raices de ecuacionesRaices de ecuaciones
Raices de ecuaciones
 
Raices de ecuaciones
Raices de ecuacionesRaices de ecuaciones
Raices de ecuaciones
 
Combinator parsing
Combinator parsingCombinator parsing
Combinator parsing
 
Mathematical preliminaries in Automata
Mathematical preliminaries in AutomataMathematical preliminaries in Automata
Mathematical preliminaries in Automata
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
 
Lecture 4 (27)
Lecture 4 (27)Lecture 4 (27)
Lecture 4 (27)
 
PUSH DOWN AUTOMATA VS TURING MACHINE
PUSH DOWN AUTOMATA VS TURING MACHINEPUSH DOWN AUTOMATA VS TURING MACHINE
PUSH DOWN AUTOMATA VS TURING MACHINE
 

More from HCPC: 北海道大学競技プログラミングサークル

More from HCPC: 北海道大学競技プログラミングサークル (20)

写像 12 相
写像 12 相写像 12 相
写像 12 相
 
ACPC 2017 Day3 F: 掛け算は楽しい
ACPC 2017 Day3 F: 掛け算は楽しいACPC 2017 Day3 F: 掛け算は楽しい
ACPC 2017 Day3 F: 掛け算は楽しい
 
ACPC 2017 Day3 D: 優柔不断
ACPC 2017 Day3 D: 優柔不断ACPC 2017 Day3 D: 優柔不断
ACPC 2017 Day3 D: 優柔不断
 
ACPC 2019 Day3 G: Restricted DFS
ACPC 2019 Day3 G: Restricted DFSACPC 2019 Day3 G: Restricted DFS
ACPC 2019 Day3 G: Restricted DFS
 
ACPC 2019 Day3 F: 部分文字列分解
ACPC 2019 Day3 F: 部分文字列分解ACPC 2019 Day3 F: 部分文字列分解
ACPC 2019 Day3 F: 部分文字列分解
 
ACPC 2019 Day3 E: 総和の切り取り
ACPC 2019 Day3 E: 総和の切り取りACPC 2019 Day3 E: 総和の切り取り
ACPC 2019 Day3 E: 総和の切り取り
 
ACPC 2019 Day3 B: パフェ
ACPC 2019 Day3 B: パフェACPC 2019 Day3 B: パフェ
ACPC 2019 Day3 B: パフェ
 
ACPC 2019 Day3 A: 間違い探し
ACPC 2019 Day3 A: 間違い探しACPC 2019 Day3 A: 間違い探し
ACPC 2019 Day3 A: 間違い探し
 
HUPC 2019 Day2 G: 木
HUPC 2019 Day2 G: 木HUPC 2019 Day2 G: 木
HUPC 2019 Day2 G: 木
 
HUPC 2019 Day2 E: ジャム
HUPC 2019 Day2 E: ジャムHUPC 2019 Day2 E: ジャム
HUPC 2019 Day2 E: ジャム
 
HUPC 2019 Day2 H: Revenge of UMG
HUPC 2019 Day2 H: Revenge of UMGHUPC 2019 Day2 H: Revenge of UMG
HUPC 2019 Day2 H: Revenge of UMG
 
HUPC 2019 Day2 F: MOD Rush
HUPC 2019 Day2 F: MOD RushHUPC 2019 Day2 F: MOD Rush
HUPC 2019 Day2 F: MOD Rush
 
HUPC 2019 Day2 C: 串刺し
HUPC 2019 Day2 C: 串刺しHUPC 2019 Day2 C: 串刺し
HUPC 2019 Day2 C: 串刺し
 
HUPC 2019 Day1 F: グリッドの番号
HUPC 2019 Day1 F: グリッドの番号HUPC 2019 Day1 F: グリッドの番号
HUPC 2019 Day1 F: グリッドの番号
 
HUPC 2019 Day1 E: 最短経路の復元
HUPC 2019 Day1 E: 最短経路の復元HUPC 2019 Day1 E: 最短経路の復元
HUPC 2019 Day1 E: 最短経路の復元
 
HUPC 2019 Day1 D: 貪欲が最適?
HUPC 2019 Day1 D: 貪欲が最適?HUPC 2019 Day1 D: 貪欲が最適?
HUPC 2019 Day1 D: 貪欲が最適?
 
HUPC 2019 Day1 C: 短絡評価
HUPC 2019 Day1 C: 短絡評価HUPC 2019 Day1 C: 短絡評価
HUPC 2019 Day1 C: 短絡評価
 
HUPC 2019 Day1 B: 自身の 2 倍
HUPC 2019 Day1 B: 自身の 2 倍HUPC 2019 Day1 B: 自身の 2 倍
HUPC 2019 Day1 B: 自身の 2 倍
 
HUPC 2019 Day1 A: four tea
HUPC 2019 Day1 A: four teaHUPC 2019 Day1 A: four tea
HUPC 2019 Day1 A: four tea
 
Convex Hull Trick
Convex Hull TrickConvex Hull Trick
Convex Hull Trick
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

Kika

  • 2. ● ! ● ! ● ! ● ! ● ! ● ! ●
  • 4. ● C++ STL complex ! ◦ ! ● typedef complex<double> Point;! ◦ ! ● x real() y imag() ! ◦ a(x,y) ! ● Point a;! ● a.real() = x; a.imag() = y;! ◦ ! ● x: y: a(x,y) O
  • 6. complex ● ! ◦ complex ! ● ! struct Point{! double x,y;! Point(double a, double b){ x = a; y = b; }! };
  • 7. ● a,b a-b ! ◦ double dis(Point a, Point b){ return abs(a-b); } b(xb,yb) a(xa,ya)
  • 10. ● = |a| * |b| * sinθ
 = |b| * |b xa |
 = × ! ● = × / 2
 = / 2 10    θ
  • 11. ● 2 a,b c ! ● ccw 11 a b
  • 12. ccw int ccw(Point a, Point b, Point c){
 if(cross(b-a,c-a)>EPS)return 1;
 if(cross(b-a,c-a)<-EPS)return -1;
 if(dot(b-a,c-a)<-EPS)return 2;
 if(abs(b-a)+EPS<abs(c-a)return -2;
 return 0;
 } 12 a b
  • 13. : AOJ0035 Is It Convex? ● ! ● 13
  • 14. ● 2 ! ● 2 ! ◦ typedef pair<Point, Point> Line;! ● a b a b ab ab
  • 16. ● ab c a,b c ! ● a b c a b c
  • 17. ● a : ∠BAC > 90°! ● b : ∠ABC > 90°! ● : ! ∠BAC <= 90° ABC <= 90°! ● cosθ(= ) a b c a b c
  • 18. double seg_to_point_dis(Line l, Point p){! Point a = l.first, b = l.second, c = p;! if(dot(b-a,c-a)<EPS)return abs(c-a);! if(dot(a-b,c-b)<EPS)return abs(c-b);! return line_to_point_dis(l,p);! } a b c a b c
  • 19. ● ! double seg_to_seg_dis(Line a, Line b){! double res = seg_to_point_dis(a, b.first);! res = min(res, set_to_point_dis(a, b.second) );! res = min(res, set_to_point_dis(b, a.first) );! res = min(res, set_to_point_dis(b, a.second) );! return res;! }
  • 20. ● a b ! ◦ a 2 b ! ◦ b 2 a ! ● a b a b
  • 21. ● a,b ! ● b 2 a ! ● a 2 b ! ● ccw     α -β b1 b2
  • 22. bool is_cross(Line a, Line b){! if(ccw(a.first,a.second,b.first)*! ccw(a.first,a.second,b.second) <= 0 && ccw(b.first,b.second,a.first)*! ccw(b.first,b.second,a.second) <= 0){! return true;! }! return false;! }
  • 23. : AOJ2351 Closest Segment Pair ● N ! ● ! ● 2 ≦ N ≦ 105 ! ● 0 ≦ xi,yi ≦ 100 23
  • 24.     b1 b2 cp ● a , b ! ● a ! ●
  • 25. Point cross_point(Line a, Line b){
 double d1 = cross(b.second - b.first,
 b.first - a.first);
 double d2 = cross(b.second - b.first,
 a.second - a.first);
 return a.first + (a.second - a.first) * d1/d2;
 } 25     b1 b2 cp d1 = |b2-b1| * |b1-a1| * sinx! = |b2-b1| * |o1-a1|! d2 = |b2-b1| * |a1-a1| * siny! = |b2-b1| * |o2-a1|! ! d1/d2 = |o1-a1| / |o2-a1|! = |cp-a1| / |a1-a1| o1 o2
  • 26. : AOJ0187 Stoning Fortune ● 3 3 ! ● 3 ! ● -1000 ≦ xi,yi ≦ 1000 26