yhara
September 10, 2016
630

# Competitive Programming in Ruby (101)

## yhara

September 10, 2016

## Transcript

1. ### Compe&&ve Programming in Ruby (101) RubyKaigi 2016 Kyoto A1er Party

LT (2016-09-10) @yhara (Yutaka Hara) RubyKaigi 2016 Kyoto LT (2016-09-10) 1

3. ### Recently I'm trying Compe22ve Programming with my colleagues RubyKaigi 2016

Kyoto LT (2016-09-10) 3

6. ### Write a program fast and correctly RubyKaigi 2016 Kyoto LT

(2016-09-10) 6

7

8
9. ### Sites which supports Ruby • Sphere Online Judge • Aizu

Online Judge • yukicoder • AtCoder ←Today's topic RubyKaigi 2016 Kyoto LT (2016-09-10) 9
10. ### atcoder.jp • AtCoder Grand Contest • AtCoder Regular Contest •

AtCoder Beginner Contest • AtCoder Typical Contest RubyKaigi 2016 Kyoto LT (2016-09-10) 10

12
13. ### ! • Any%me • No %me limit RubyKaigi 2016 Kyoto

LT (2016-09-10) 13
14. ### • AtCoder Grand Contest • AtCoder Regular Contest • AtCoder

Beginner Contest • AtCoder Typical Contest RubyKaigi 2016 Kyoto LT (2016-09-10) 14
15. ### AtCoder Beginner Contest • A: Very easy • B: Easy

• C: Easy? • D: Not really easy RubyKaigi 2016 Kyoto LT (2016-09-10) 15

16

20. ### one-line Reversi • Given N pieces, ﬂip Q ranges •

Calculate the ﬁnal state ••••••••• 1..4 2..6 8..9 ɹɹ↓ ◦•••◦◦•◦◦ RubyKaigi 2016 Kyoto LT (2016-09-10) 20
21. ### Just ﬂipping each pieces? ranges.each do |r| r.each do |i|

line[i] = !line[i] end end RubyKaigi 2016 Kyoto LT (2016-09-10) 21

23. ### 200,000 pieces ! 200,000 ranges ! RubyKaigi 2016 Kyoto LT

(2016-09-10) 23
24. ### Billions of ﬂips ! ranges.each do |r| # <- 200,000

times r.each do |i| # <- 50,000 times or so line[i] = !line[i] end end RubyKaigi 2016 Kyoto LT (2016-09-10) 24
25. ### ⏰ Time Limit = 2 sec. RubyKaigi 2016 Kyoto LT

(2016-09-10) 25
26. ### Be#er algorithm Memorize where color changes 10001 23005 ɹɹɹɹ↓ɹɹ↓ •••...•◦...◦•••

RubyKaigi 2016 Kyoto LT (2016-09-10) 26

28. ### You can try Compe//ve Prograaming in Ruby ! (at least

for beginner contest) RubyKaigi 2016 Kyoto LT (2016-09-10) 28

31. ### ABC037-D • I couldn't pass with Ruby ! • Traversing

1000x1000 maze • Maybe with Ruby3...? RubyKaigi 2016 Kyoto LT (2016-09-10) 31
32. ### Crystal passes ※CrystalɿRuby-like sta0cally typed language RubyKaigi 2016 Kyoto LT

(2016-09-10) 32

33

38. ### (DON'T TRY THIS AT HOME !) RubyKaigi 2016 Kyoto LT

(2016-09-10) 38