SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
ACM ICPC 2013{2014 
Northeastern European Regional Contest 
Problems Review 
Roman Elizarov 
December 1, 2013
Problem A. ASCII Puzzle 
I The problem is solved by exhaustive search 
I
ll each spot in the trivial puzzle from the top-left to the 
bottom-right corner 
I try to place each piece that
ts 
I backtrack after trying all pieces for a place 
I Must check which pieces can be placed on borders 
I and place them only onto the corresponding borders 
I otherwise time-limit will be exceeded
Problem B. Bonus Cards 
I The problem is solved by dynamic programming 
I Let k be the total number of tickets already distributed, 
0  k  n 
I Let g be the number of ICPC card holders who already got 
tickets, max(0; k  b)  g  min(a; k) 
I Let Ps;k;g be the probability of Dmitry getting a ticket with a 
card that has s slots in each draw round 
I s = 2 for ICPC card, and s = 1 for ACM card 
I Use the following equation to compute the desired probability 
Ps;0;0 for each s: 
Ps;k;g = 
s + 2(a  g)Ps;k+1;g+1 + (b  k + g)Ps;k+1;g 
s + 2(a  g) + (b  k + g) 
I Here s +2(a g)+(b k +g) is the total number of slots in 
this draw round for Dmitry's card, for a  g remaining ICPC 
cards, and for b  k + g remaining ACM cards
Problem C. Cactus Automorphisms 
I Use depth-
rst-search to
nd all cycles in the given graph G 
I Build graph G0 with original vertices, and where each cycle in 
G is a new vertex, and each edge which is a part of a cycle is 
a new vertex (new vertices are in white) 
G G0 
1 
3 
2 
13 12 
5 
4 
6 
7 
8 
9 
10 11 
14 
15 
1 
3 
2 
13 12 
5 
4 
6 
7 
8 
9 
10 11 
14 
15
Problem C. Cactus Automorphisms (2) 
I Graph G0 is a tree 
I G0 has an even diameter and has the unique center 
I The center of G0 is either a vertex, a cycle or an edge in G 
I Hang the graph G0 using its center as a root and count a 
number of automorphisms on a tree in bottom-up fashion 
I k identical children of a vertex can be rearranged for k! 
combinations 
I children of a cycle in G can be rearranged for 2 combinations 
if the sequence of children on this cycle can be reversed 
I The root of tree G0 needs a special attention when it 
corresponds to a cycle in G 
I it may have rotational symmetries and/or a mirror symmetry 
I it may have a lot of children, so an ecient algorithm (like 
Knuth-Morris-Pratt) must be used to
nd those symmetries
Problem D. Dictionary 
I Let P be a set of pre
xes for a 
given set of words 
I Build a weighted directed graph 
with nodes P 
I add an edge of weight 1 from a 
pre
x p to all pre

Weitere ähnliche Inhalte

Was ist angesagt?

Bang nguyen to hoa hoc lop 8
Bang nguyen to hoa hoc lop 8Bang nguyen to hoa hoc lop 8
Bang nguyen to hoa hoc lop 8DoKo.VN Channel
 
Tín hiệu, hệ thống và phân giải mạch 5
Tín hiệu, hệ thống và phân giải mạch 5Tín hiệu, hệ thống và phân giải mạch 5
Tín hiệu, hệ thống và phân giải mạch 5Linh Trần Lê
 
Chuyên đề, các dạng toán tổ hợp xác suất
Chuyên đề, các dạng toán tổ hợp xác suấtChuyên đề, các dạng toán tổ hợp xác suất
Chuyên đề, các dạng toán tổ hợp xác suấtThế Giới Tinh Hoa
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Chuyên đề kim loại tác dụng với dung dịch muối
Chuyên đề kim loại tác dụng với dung dịch muốiChuyên đề kim loại tác dụng với dung dịch muối
Chuyên đề kim loại tác dụng với dung dịch muốiPhát Lê
 
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vnMegabook
 
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mới
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mớiBồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mới
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mớiBồi dưỡng Toán lớp 6
 
Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)lieu_lamlam
 
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU nataliej4
 
[123doc.vn] tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...
[123doc.vn]   tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...[123doc.vn]   tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...
[123doc.vn] tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...Nữ Lê
 
Nhung cong thuc luong giac co ban
Nhung cong thuc luong giac co banNhung cong thuc luong giac co ban
Nhung cong thuc luong giac co banNguyễn Hoành
 
Tín hiệu, hệ thống và phân giải mạch 9
Tín hiệu, hệ thống và phân giải mạch 9Tín hiệu, hệ thống và phân giải mạch 9
Tín hiệu, hệ thống và phân giải mạch 9Linh Trần Lê
 
[Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn
 [Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn [Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn
[Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vnMegabook
 
Tóm tắt công thức vật lí 10
Tóm tắt công thức vật lí 10Tóm tắt công thức vật lí 10
Tóm tắt công thức vật lí 10Borisun
 
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)Nguyen KienHuyen
 
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐ
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐTUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐ
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐBồi dưỡng Toán lớp 6
 
70 cong thuc giai nhanh hoa hoc chon loc
70 cong thuc giai nhanh hoa hoc chon loc70 cong thuc giai nhanh hoa hoc chon loc
70 cong thuc giai nhanh hoa hoc chon locUất Hương
 

Was ist angesagt? (20)

Bang nguyen to hoa hoc lop 8
Bang nguyen to hoa hoc lop 8Bang nguyen to hoa hoc lop 8
Bang nguyen to hoa hoc lop 8
 
Phương pháp tham lam
Phương pháp tham lamPhương pháp tham lam
Phương pháp tham lam
 
Tín hiệu, hệ thống và phân giải mạch 5
Tín hiệu, hệ thống và phân giải mạch 5Tín hiệu, hệ thống và phân giải mạch 5
Tín hiệu, hệ thống và phân giải mạch 5
 
Chuyên đề, các dạng toán tổ hợp xác suất
Chuyên đề, các dạng toán tổ hợp xác suấtChuyên đề, các dạng toán tổ hợp xác suất
Chuyên đề, các dạng toán tổ hợp xác suất
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Chuyên đề kim loại tác dụng với dung dịch muối
Chuyên đề kim loại tác dụng với dung dịch muốiChuyên đề kim loại tác dụng với dung dịch muối
Chuyên đề kim loại tác dụng với dung dịch muối
 
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn
[Phần 2] Tuyển tập 35 công thức giải nhanh bài tập Hóa học vô cơ - Megabook.vn
 
Lipit trinh chieu
Lipit trinh chieuLipit trinh chieu
Lipit trinh chieu
 
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mới
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mớiBồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mới
Bồi dưỡng HSG môn Toán lớp 6 theo 22 chuyên đề của SGK mới
 
Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)
 
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU
NGHIÊN CỨU PHƯƠNG PHÁP QUAY LUI VÀ ỨNG DỤNG GIẢI BÀI TOÁN SUDOKU
 
[123doc.vn] tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...
[123doc.vn]   tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...[123doc.vn]   tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...
[123doc.vn] tong-hop-cach-nhan-biet-mot-so-cation-anion-khi-va-bai-tap-trac...
 
Nhung cong thuc luong giac co ban
Nhung cong thuc luong giac co banNhung cong thuc luong giac co ban
Nhung cong thuc luong giac co ban
 
Tín hiệu, hệ thống và phân giải mạch 9
Tín hiệu, hệ thống và phân giải mạch 9Tín hiệu, hệ thống và phân giải mạch 9
Tín hiệu, hệ thống và phân giải mạch 9
 
[Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn
 [Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn [Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn
[Phần 1l Tổng hợp 55 công thức giải nhanh bài tập hữu cơ, vô cơ - Megabook.vn
 
Tóm tắt công thức vật lí 10
Tóm tắt công thức vật lí 10Tóm tắt công thức vật lí 10
Tóm tắt công thức vật lí 10
 
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)
Tuyen tap cac_bat_dang_thuc_trong_cac_de_thi_tuyen_sing_dai_hoc(ca_hd)
 
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐ
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐTUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐ
TUYỂN TẬP ĐỀ KIỂM TRA 15' - 1 TIẾT - TOÁN LỚP 6 - CHƯƠNG 3 - PHÂN SỐ
 
Giao thoa sóng ánh sáng
Giao thoa sóng ánh sángGiao thoa sóng ánh sáng
Giao thoa sóng ánh sáng
 
70 cong thuc giai nhanh hoa hoc chon loc
70 cong thuc giai nhanh hoa hoc chon loc70 cong thuc giai nhanh hoa hoc chon loc
70 cong thuc giai nhanh hoa hoc chon loc
 

Andere mochten auch

ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
Пишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данныхПишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данныхRoman Elizarov
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?Roman Elizarov
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerRoman Elizarov
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Roman Elizarov
 
Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)Roman Elizarov
 
Многопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и ПрактикаМногопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и ПрактикаRoman Elizarov
 
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Roman Elizarov
 
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
MIPT Fall Programming Training
MIPT Fall Programming TrainingMIPT Fall Programming Training
MIPT Fall Programming TrainingSolodkova
 
Михаил Елизаров «Man in the middle в действии!»
Михаил Елизаров «Man in the middle в действии!»Михаил Елизаров «Man in the middle в действии!»
Михаил Елизаров «Man in the middle в действии!»Mail.ru Group
 
Session 4
Session 4Session 4
Session 4pnanhvn
 

Andere mochten auch (16)

ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
 
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
 
Пишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данныхПишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данных
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmer
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
 
Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)
 
Многопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и ПрактикаМногопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и Практика
 
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
 
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
 
MIPT Fall Programming Training
MIPT Fall Programming TrainingMIPT Fall Programming Training
MIPT Fall Programming Training
 
Михаил Елизаров «Man in the middle в действии!»
Михаил Елизаров «Man in the middle в действии!»Михаил Елизаров «Man in the middle в действии!»
Михаил Елизаров «Man in the middle в действии!»
 
Presentation1
Presentation1Presentation1
Presentation1
 
Unit testing en Windows 10
Unit testing en Windows 10Unit testing en Windows 10
Unit testing en Windows 10
 
Session 4
Session 4Session 4
Session 4
 

Ähnlich wie ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review

Answers withexplanations
Answers withexplanationsAnswers withexplanations
Answers withexplanationsGopi Saiteja
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERmuthukrishnavinayaga
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programminghodcsencet
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questionsGradeup
 
Matrices and row operations 12123 and applications of matrices
Matrices and row operations 12123 and applications of matricesMatrices and row operations 12123 and applications of matrices
Matrices and row operations 12123 and applications of matricesmayaGER
 
Cat paper-2005 - MBA Classes in Mumbai
Cat paper-2005 - MBA Classes in MumbaiCat paper-2005 - MBA Classes in Mumbai
Cat paper-2005 - MBA Classes in Mumbaiseomiamia
 
Ee693 sept2014quiz1
Ee693 sept2014quiz1Ee693 sept2014quiz1
Ee693 sept2014quiz1Gopi Saiteja
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Deepak John
 

Ähnlich wie ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review (20)

Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
 
Answers withexplanations
Answers withexplanationsAnswers withexplanations
Answers withexplanations
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
Mit6 006 f11_quiz1
Mit6 006 f11_quiz1Mit6 006 f11_quiz1
Mit6 006 f11_quiz1
 
Computer Science Assignment Help
Computer Science Assignment Help Computer Science Assignment Help
Computer Science Assignment Help
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
Algorithms Design Exam Help
Algorithms Design Exam HelpAlgorithms Design Exam Help
Algorithms Design Exam Help
 
Matrices and row operations 12123 and applications of matrices
Matrices and row operations 12123 and applications of matricesMatrices and row operations 12123 and applications of matrices
Matrices and row operations 12123 and applications of matrices
 
Cat paper-2005 - MBA Classes in Mumbai
Cat paper-2005 - MBA Classes in MumbaiCat paper-2005 - MBA Classes in Mumbai
Cat paper-2005 - MBA Classes in Mumbai
 
Results of Round 1
Results of Round 1Results of Round 1
Results of Round 1
 
Network Design Assignment Help
Network Design Assignment HelpNetwork Design Assignment Help
Network Design Assignment Help
 
Ee693 sept2014quiz1
Ee693 sept2014quiz1Ee693 sept2014quiz1
Ee693 sept2014quiz1
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4
 

Mehr von Roman Elizarov

Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Roman Elizarov
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Roman Elizarov
 
Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017Roman Elizarov
 
Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017Roman Elizarov
 
Scale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOneScale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOneRoman Elizarov
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines ReloadedRoman Elizarov
 
Lock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesLock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutinesRoman Elizarov
 
Non blocking programming and waiting
Non blocking programming and waitingNon blocking programming and waiting
Non blocking programming and waitingRoman Elizarov
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and FallaciesRoman Elizarov
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure javaRoman Elizarov
 

Mehr von Roman Elizarov (12)

Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017
 
Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017
 
Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017
 
Scale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOneScale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOne
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines Reloaded
 
Lock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesLock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin Coroutines
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Non blocking programming and waiting
Non blocking programming and waitingNon blocking programming and waiting
Non blocking programming and waiting
 
DIY Java Profiling
DIY Java ProfilingDIY Java Profiling
DIY Java Profiling
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure java
 

Kürzlich hochgeladen

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review

  • 1. ACM ICPC 2013{2014 Northeastern European Regional Contest Problems Review Roman Elizarov December 1, 2013
  • 2. Problem A. ASCII Puzzle I The problem is solved by exhaustive search I
  • 3. ll each spot in the trivial puzzle from the top-left to the bottom-right corner I try to place each piece that
  • 4. ts I backtrack after trying all pieces for a place I Must check which pieces can be placed on borders I and place them only onto the corresponding borders I otherwise time-limit will be exceeded
  • 5. Problem B. Bonus Cards I The problem is solved by dynamic programming I Let k be the total number of tickets already distributed, 0 k n I Let g be the number of ICPC card holders who already got tickets, max(0; k b) g min(a; k) I Let Ps;k;g be the probability of Dmitry getting a ticket with a card that has s slots in each draw round I s = 2 for ICPC card, and s = 1 for ACM card I Use the following equation to compute the desired probability Ps;0;0 for each s: Ps;k;g = s + 2(a g)Ps;k+1;g+1 + (b k + g)Ps;k+1;g s + 2(a g) + (b k + g) I Here s +2(a g)+(b k +g) is the total number of slots in this draw round for Dmitry's card, for a g remaining ICPC cards, and for b k + g remaining ACM cards
  • 6. Problem C. Cactus Automorphisms I Use depth-
  • 8. nd all cycles in the given graph G I Build graph G0 with original vertices, and where each cycle in G is a new vertex, and each edge which is a part of a cycle is a new vertex (new vertices are in white) G G0 1 3 2 13 12 5 4 6 7 8 9 10 11 14 15 1 3 2 13 12 5 4 6 7 8 9 10 11 14 15
  • 9. Problem C. Cactus Automorphisms (2) I Graph G0 is a tree I G0 has an even diameter and has the unique center I The center of G0 is either a vertex, a cycle or an edge in G I Hang the graph G0 using its center as a root and count a number of automorphisms on a tree in bottom-up fashion I k identical children of a vertex can be rearranged for k! combinations I children of a cycle in G can be rearranged for 2 combinations if the sequence of children on this cycle can be reversed I The root of tree G0 needs a special attention when it corresponds to a cycle in G I it may have rotational symmetries and/or a mirror symmetry I it may have a lot of children, so an ecient algorithm (like Knuth-Morris-Pratt) must be used to
  • 11. Problem D. Dictionary I Let P be a set of pre
  • 12. xes for a given set of words I Build a weighted directed graph with nodes P I add an edge of weight 1 from a pre
  • 13. x p to all pre
  • 14. xes pc (for all characters c) I add an edge of weight 0 from a pre
  • 15. x p to a pre
  • 16. x q when q is a sux of p I 1-edges of this graph constitute a trie for a given set of words I but it is not an optimal solution I Minimum spanning tree in this weighted directed graph corresponds to the problem answer I use Chu{Liu/Edmonds algorithm a ab abc abcd c cd cde cdef cdefa 1 1 1 1 1 1 1 1 1 0 0 0 An example for words abcd and cdefa
  • 17. Problem E. Easy Geometry I Let (x; yt (x)) be the top point of the polygon at a given coordinate x and (x; yb(x)) be the bottom point of the polygon I these functions can be computed by a binary search I Let sw(x) be the max generalized square of a rectangle of the
  • 18. xed width w with the left edge at x sw(x) = w (minfyt (x); yt (x + w)g maxfyb(x); yb(x + w)g) I Let s(w) = max x sw(x) be the max square of a rectangle of the
  • 19. xed width w I sw(x) is convex, so s(w) can be found by a ternary search I Let s = max w s(w) be the max square of a rectangle | the answer to the problem I s(w) is convex, so s can be found by a ternary search
  • 20. Problem F. Fraud Busters I This is the simplest problem in the contest I It is solved by going over a list of codes and checking each one against a code that was recognized by the scanner
  • 21. Problem G. Green Energy I Compute coordinate z for each point | coordinate of the projection onto a line perpendicular to the sun I Place the largest tower at a point with the max z coordinate I Place other towers in any order on points with decreasing z coordinates so that they do not obscure each other I If min z coordinate is reached and some towers are left, then place them anywhere tower shadows y z x
  • 22. Problem H. Hack Protection I Compute cumulative xor values xi = ji j=1aj ( for xor ) I this way, xor for any subarray [i ; j) is equal to xi xj I Create a map M which keeps for each value of xi the list of indices i with this value of xi I Compute bi ;j | the
  • 23. rst index at or after i where j-th bit of ai becomes zero I Loop for all i0 from 1 to n I using bi ;j one can quickly
  • 24. nd consecutive ranges [ik ; ik+1) of indices where and of subarrays [i0; t) (ik t ik+1) has the same value b I note, that there are at most 32 such ranges for each i0 I use a map M to
  • 25. nd a list of all indices with value of xi0 b I use a binary search on this list (twice) to
  • 26. nd how many indices from this list are in the range [ik ; ik+1) I that is the number of matching values for all subarrays [i0; t)
  • 27. Problem I. Interactive Interception I The state space of a point can be kept in array of min and max possible position for each speed I There are at most 105 possible speeds, so this array can be scanned in a loop on each turn I Find R that splits a state space roughly in half using binary search I Use check 0 R query I Update the state space after reading the answer I Repeat until the point's position can be unambiguously determined
  • 28. Problem J. Join the Conversation I The problem is solved by dynamic programming I For each author maintain a map M from an author to a pair of an index and a length of the maximal conversation with the last message from this author I Process messages in order,
  • 29. nd all mentions in a message, and update map M for the author of this message I if you
  • 30. nd mentions by looking at `@' then do not forget to check for a space before it I the easiest way to
  • 31. nd mentions is to split the message by spaces
  • 32. Problem K. Kabaleo Lite I n = 1 is a special case I the answer depends on the chip of the last player I For n 1 analyze the best strategy for other players: I they place all chips onto the chips of your hidden color h I they will obscure as many as possible of your chips on the board, and will place as many as possible of other colors onto the board I Compute the maximal possible number of chips of each color on the board according to the above I Check each possible move of yours to
  • 33. nd the answer I you win only if the number of your color h on the board exceeds any other number I you need to maintain the number of only two best other color to
  • 34. gure if the above is true