• Tidak ada hasil yang ditemukan

PDF 二分探索とアルゴリズムデザイン - tp.edu.tw

N/A
N/A
Protected

Academic year: 2023

Membagikan "PDF 二分探索とアルゴリズムデザイン - tp.edu.tw"

Copied!
9
0
0

Teks penuh

(1)

培訓- 3 二分探索とアルゴリズムデザイン

二分探索とアルゴリズムデザイン

Angrybird11 c2251393 October 16, 2013

1 Binary Search

Introduction

: ( ) ξ

:

1. a a < ξ a 1

2. a > ξ 1

3. a =ξ

O(C×lgN) C N

Binary search

1.1 Conclusion

Binary search 1.

...

2. ( )

: 1.

2. a a ( )

i T rue i

(F alse ) :F alse, F alse, , , F alse, T rue, , , , T rue I

(2)

1.2 Exercises 二分探索とアルゴリズムデザイン

i i T rue

( )

OI

3.

Exercise 4 & 5

1.2 Exercises

1.

Algorithm 1 ?

2. (upper )

A x

3. (lower )

A x

4. (JOI 2011 day 2, HOJ 118)

: n(n 100) A A 1 n

Answer(x[]) 700

5. Cave (IOI 2013 day 2) :

n(n≤5000)

n

trycombination(x[])

70000

2 Divide & Conquer

Introduction

II

(3)

2.1 Conclusion 二分探索とアルゴリズムデザイン

1.

2.

3.

(Master theorem) Google

2.1 Conclusion

: Merge sort Voronoi Diagram O(N lgN) Strassen's

2.2 Exercises

1. (TIOJ 1080)

...

2. (TIOJ 1108)

3.

n

1 3

4. (TIOJ 1500)

N

5. (POJ 1741)

n(105) ≤k

6. : (TIOJ 1631)

xy n( 50000) (

)

III

(4)

3. Dynamic Programming 二分探索とアルゴリズムデザイン

3 Dynamic Programming

Introduction

Dynamic Pro-

gramming (Optimization Problem)

(Feasible Solution)

(Optimal Solution) DP

DP ( )

(Subproblem)

(Memoization) DP

(Overlapping Subproblems)

DP DP

DP

• :

• :

3.1 Implementation

DP

( )

• bottom-up:

( )

IV

(5)

3.2 State Compression 二分探索とアルゴリズムデザイン

• top-down:

( )

3.2 State Compression

( )

3.3 Conclusion

DP DP

divide and conquer

( )

3.4 Classic Problems

1.

n S1,1. . . S1,n S2,1. . . S2,n

Si,j 1.

2. ci,j

(n≤106)

V

(6)

3.5 Exercises 二分探索とアルゴリズムデザイン

2.

n ×n 0 1 0

(n 104) 3. <TIOJ 1029>

n

4. <STEP5 0085>

L 1,2, . . . L

a1, a2, . . . aL

(L≤104) 5. 01

v n w

c (n, v 103)

6. Matrix Chain Multiplication

A1, A2, . . . An, A1·A2·. . . An (n≤102)

7. Traveling Salesman Problem

3.5 Exercises

1. <STEP5 0086>

n×m , 3 k ,

3 (k ≤n, m≤103)

2. <TIOJ 1019>

n x x+ 1 x+ 2

1 n (n 105)

3. <TIOJ 1014>

n 1

1 1

(n≤15)

VI

(7)

3.5 Exercises 二分探索とアルゴリズムデザイン

4. <codeforces 214E> Relay Race

n×n ( )

(1,1) (n, n) ( )

(n≤300) 5. <STEP5 0004>

n

( )

1 m ( )

san

(m≤n≤107) 6. <TIOJ 1291> n m

n m (n, m≤200)

7. <TIOJ 1063 >

n×m 0 1 0

(n, m≤103) 8. <STEP5 0042>

9. <STEP5 0069>

σ1, σ2, . . . σn σi (ρ−σi)2 σi

ρ σ12 + σ22 +. . . σn2 = M

(1≤n≤10,1≤σi 100,1≤M 104) 10. <STEP5 0093>

m

n

m &

(1≤n 15,1≤m≤90)

VII

(8)

4. Greedy Algorithm 二分探索とアルゴリズムデザイン

4 Greedy Algorithm

Introduction

DP DP

DP

DP greedy( )

Greedy

greedy (

) greedy

greedy

• DP

• DP greedy

4.1 Conclusion

DP

DP greedy

4.2 Exercises

1.

N xi, yi(xi < yi)

VIII

(9)

4.2 Exercises 二分探索とアルゴリズムデザイン

2.

3. <NPSC2005 pB>

C

4. <NPSC2005 pA>

n

5. <STEP5 0021> ( 100 pB)

N, M N +M

wi

6. <STEP5 0031> ( 101 pA)

L N Ai(A1+A2+. . . AN =L)

X X

7. <POI XII> Toy Cars

N K p

(1≤k ≤n≤105,1≤p≤5×105) 8. <POI X> Chocolate

M ×N 1×1 M−1

X1, X2, . . . XM1 N−1 Y1, Y2, . . . YN1

9. <TIOJ 1432,1465> , H

N K

10. <TIOJ 1406> FISH N

Y Y

IX

Referensi

Dokumen terkait

Action Hypothesis Based poon the theoritical review above the researcher formulated the hypothesis that by using drama technique can improve the student speaking ability at the

Chapter Four focuses on the use of traditional musical influences within this genre as way of claiming a national space; Chapter Five analyses the songs of certain women musicians in