SlideShare a Scribd company logo
ACM ICPC 2014{2015 
Northeastern European Regional Contest 
Problems Review 
Roman Elizarov 
December 7, 2014
Problem A. Alter Board 
I The minimal answer to this problem is bn=2c + bm=2c 
I The solution is to make inversions on each even row and each 
even column 
I To prove that the answer is minimal consider the
rst column 
with its n cells that form n  1 neighbouring pairs 
I to turn all cells of the
rst column in the same color inversions 
must span the
rst column 
I each spanning inversion makes at most two neighbouring pairs 
of the same color 
I so the minimum of d(n  1)=2e = bn=2c inversions are needed 
I Then consider the top row in the same way
Problem B. Burrito King 
I Consider the problem as a sum of vectors in (a; b) coordinates 
I The resulting vector may not go above b = B line and must 
extend on a axis as far as possible 
I It is optimal to greedily add (ai ; bi ) ingredient vectors starting 
from the ones that have the least angle to 0a line (or maximal 
ai=bi ), until b = B line is crossed 
I Be careful about corner cases with ai = 0 and/or bi = 0 
a 
b 
B 
0 A
Problem C. Cactus Generator 
I This is a straightforward problem for parsing and OO design 
I De
ne class for graph with a method to generate graph given 
index of the
rst and the vertices 
I De
ne class for various range types 
I Parse and construct classes tree 
I Build the resulting graph 
I Connect arbitrary pairs of vertices of odd degree in the 
resulting graph using temporary edges 
I Use classical algorithm for Eulerian path 
I Remove temporary edges to get the minimal number of 
covering paths
Problem D. Damage Assessment 
I Numerically integrate the square section by dx 
I The square of the cut at a given x coordinate is a simple 
planar geometry problem 
I Take care about leftmost point with in
nite derivative 
I however, the required precision does not make this a big 
problem 
I the square section at this point is small 
x
Problem E. Epic Win! 
I There is a simple solution with up to n2 states 
I Build your FSM as n copies of a winning FSM with n states 
I Each state of a winning FSM corresponds to a state in the 
opponent FSM 
I Each move of a winning FSM is a winning move for the 
corresponding opponent's move 
I Next state in a winning FSM corresponds to the opponent 
move and opponent's next state 
I Leave other transitions unde
ned 
I The
rst copy of a winning FMS starts in its
rst state and 
wins an opponent that stats in it
rst state by construction 
I Model the behaviour of the opponent and your FSM for all 
opponent start states from the states 2 to n 
I When a yet unde
ned transition is reached, then insert a 
transition to a fresh copy of a winning FSM into the state 
corresponding to the opponent's, thus ensuring win in this copy 
I Stop modelling when loop is detected 
I Loop is inside one copy of a winning FSM and is always 
winning by construction
Problem F. Filter 
I Nothing fancy here 
I Just implement what the problem statement asks for in a 
straightforward way 
I The hardest part seems to be reading and understanding the 
problem statement
Problem G. Gomoku 
I The
rst player's strategy has pretty strict priorities in the 
moves it makes and it can be exploited 
I Make the

More Related Content

Viewers also liked

Пишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данныхПишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данных
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 programmer
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 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
Roman Elizarov
 
MIPT Fall Programming Training
MIPT Fall Programming TrainingMIPT Fall Programming Training
MIPT Fall Programming Training
Solodkova
 
11 x1 t14 06 sum of a geometric series (2012)
11 x1 t14 06 sum of a geometric series (2012)11 x1 t14 06 sum of a geometric series (2012)
11 x1 t14 06 sum of a geometric series (2012)
Nigel Simmons
 
13 3 arithmetic and geometric series and their sums
13 3 arithmetic and geometric series and their sums13 3 arithmetic and geometric series and their sums
13 3 arithmetic and geometric series and their sums
hisema01
 
Problem solving on acm international collegiate programming contest
Problem solving on acm international collegiate programming contestProblem solving on acm international collegiate programming contest
Problem solving on acm international collegiate programming contest
Fedor Tsarev
 
05 динамическое программирование
05 динамическое программирование05 динамическое программирование
05 динамическое программирование
Fedor Tsarev
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
Shakil Ahmed
 
20130420 bitbyte
20130420 bitbyte20130420 bitbyte
20130420 bitbyte
Devexperts
 
Codefreeze rus
Codefreeze rusCodefreeze rus
Codefreeze rus
Devexperts
 
How to improve java performance
How to improve java performanceHow to improve java performance
How to improve java performance
Devexperts
 
Browsers. Magic is inside.
Browsers. Magic is inside.Browsers. Magic is inside.
Browsers. Magic is inside.
Devexperts
 
Effective websites development
Effective websites developmentEffective websites development
Effective websites development
Devexperts
 

Viewers also liked (15)

Пишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данныхПишем самый быстрый хеш для кэширования данных
Пишем самый быстрый хеш для кэширования данных
 
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
 
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
 
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
 
MIPT Fall Programming Training
MIPT Fall Programming TrainingMIPT Fall Programming Training
MIPT Fall Programming Training
 
11 x1 t14 06 sum of a geometric series (2012)
11 x1 t14 06 sum of a geometric series (2012)11 x1 t14 06 sum of a geometric series (2012)
11 x1 t14 06 sum of a geometric series (2012)
 
13 3 arithmetic and geometric series and their sums
13 3 arithmetic and geometric series and their sums13 3 arithmetic and geometric series and their sums
13 3 arithmetic and geometric series and their sums
 
Problem solving on acm international collegiate programming contest
Problem solving on acm international collegiate programming contestProblem solving on acm international collegiate programming contest
Problem solving on acm international collegiate programming contest
 
05 динамическое программирование
05 динамическое программирование05 динамическое программирование
05 динамическое программирование
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
 
20130420 bitbyte
20130420 bitbyte20130420 bitbyte
20130420 bitbyte
 
Codefreeze rus
Codefreeze rusCodefreeze rus
Codefreeze rus
 
How to improve java performance
How to improve java performanceHow to improve java performance
How to improve java performance
 
Browsers. Magic is inside.
Browsers. Magic is inside.Browsers. Magic is inside.
Browsers. Magic is inside.
 
Effective websites development
Effective websites developmentEffective websites development
Effective websites development
 

Similar to ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review

Engineering garphics projection of solids
Engineering garphics   projection of solidsEngineering garphics   projection of solids
Engineering garphics projection of solids
Pranav Kulshrestha
 
Projection of Solids
Projection of SolidsProjection of Solids
Projection of solids
Projection of solidsProjection of solids
Projection of solids
Abhay Jain
 
Projectionofsolids 120517063655-phpapp01
Projectionofsolids 120517063655-phpapp01Projectionofsolids 120517063655-phpapp01
Projectionofsolids 120517063655-phpapp01
bjslides
 
Engineering Graphics Projection of Solids.pptx
Engineering Graphics Projection of Solids.pptxEngineering Graphics Projection of Solids.pptx
Engineering Graphics Projection of Solids.pptx
Prashant Borakhede
 
Projection of solids
Projection of solidsProjection of solids
Projection of solids
gtuautonomous
 
Projectionofsolids(thedirectdata[1].com)
Projectionofsolids(thedirectdata[1].com)Projectionofsolids(thedirectdata[1].com)
Projectionofsolids(thedirectdata[1].com)
Ravi Patel
 
5 projection of solids
5 projection of solids5 projection of solids
5 projection of solids
Shaman Gupta
 
Projection of solids(thedirectdata.com)
Projection of solids(thedirectdata.com)Projection of solids(thedirectdata.com)
Projection of solids(thedirectdata.com)
India
 
UNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.pptUNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.ppt
VijayalakshmiR64
 
6. Projection of solids.ppt
6. Projection of solids.ppt6. Projection of solids.ppt
6. Projection of solids.ppt
GosalaHarinathGowd
 
Unit -4.pptx
Unit -4.pptxUnit -4.pptx
Unit -4.pptx
GandlaPraveenKumar
 
surface development.ppt
surface development.pptsurface development.ppt
surface development.ppt
ssuser6cdd2d
 
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
ReifalynFulig
 
UNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.pptUNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.ppt
VijayalakshmiR64
 
Unit 5
Unit 5Unit 5
projection of solids
projection of solidsprojection of solids
projection of solids
Chukka Nikhil Chakravarthy
 
projection of solide
projection of solideprojection of solide
projection of solide
Chukka Nikhil Chakravarthy
 
Unit 6
Unit 6Unit 6
Projection of planes revised
Projection of planes revisedProjection of planes revised
Projection of planes revised
Manoranjan Kumar
 

Similar to ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review (20)

Engineering garphics projection of solids
Engineering garphics   projection of solidsEngineering garphics   projection of solids
Engineering garphics projection of solids
 
Projection of Solids
Projection of SolidsProjection of Solids
Projection of Solids
 
Projection of solids
Projection of solidsProjection of solids
Projection of solids
 
Projectionofsolids 120517063655-phpapp01
Projectionofsolids 120517063655-phpapp01Projectionofsolids 120517063655-phpapp01
Projectionofsolids 120517063655-phpapp01
 
Engineering Graphics Projection of Solids.pptx
Engineering Graphics Projection of Solids.pptxEngineering Graphics Projection of Solids.pptx
Engineering Graphics Projection of Solids.pptx
 
Projection of solids
Projection of solidsProjection of solids
Projection of solids
 
Projectionofsolids(thedirectdata[1].com)
Projectionofsolids(thedirectdata[1].com)Projectionofsolids(thedirectdata[1].com)
Projectionofsolids(thedirectdata[1].com)
 
5 projection of solids
5 projection of solids5 projection of solids
5 projection of solids
 
Projection of solids(thedirectdata.com)
Projection of solids(thedirectdata.com)Projection of solids(thedirectdata.com)
Projection of solids(thedirectdata.com)
 
UNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.pptUNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.ppt
 
6. Projection of solids.ppt
6. Projection of solids.ppt6. Projection of solids.ppt
6. Projection of solids.ppt
 
Unit -4.pptx
Unit -4.pptxUnit -4.pptx
Unit -4.pptx
 
surface development.ppt
surface development.pptsurface development.ppt
surface development.ppt
 
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
1mm1g3a-sumofinteriorandexterioranglesinpolygons-170218173450.ppt
 
UNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.pptUNIT-3 PROJECTION OF SOLIDS.ppt
UNIT-3 PROJECTION OF SOLIDS.ppt
 
Unit 5
Unit 5Unit 5
Unit 5
 
projection of solids
projection of solidsprojection of solids
projection of solids
 
projection of solide
projection of solideprojection of solide
projection of solide
 
Unit 6
Unit 6Unit 6
Unit 6
 
Projection of planes revised
Projection of planes revisedProjection of planes revised
Projection of planes revised
 

More from Roman Elizarov

Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018
Roman 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 2017
Roman Elizarov
 
Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017
Roman Elizarov
 
Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017
Roman 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 @ JavaOne
Roman Elizarov
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines Reloaded
Roman Elizarov
 
Lock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesLock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin Coroutines
Roman Elizarov
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
Roman Elizarov
 
Non blocking programming and waiting
Non blocking programming and waitingNon blocking programming and waiting
Non blocking programming and waiting
Roman Elizarov
 
DIY Java Profiling
DIY Java ProfilingDIY Java Profiling
DIY Java Profiling
Roman Elizarov
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
Roman 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 java
Roman Elizarov
 

More from 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
 

Recently uploaded

Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
Priyanka Aash
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
Enterprise Knowledge
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Zilliz
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
Fwdays
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
Priyanka Aash
 
Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+
Zilliz
 
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and ConsiderationsChoosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
webbyacad software
 
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdfDefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
Yury Chemerkin
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
David Wilson
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
FIDO Alliance
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
Baishakhi Ray
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
ankush9927
 
UX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business GoalsUX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business Goals
FIDO Alliance
 
What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024
Stephanie Beckett
 
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Snarky Security
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
isBullShit
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
Tech Guru
 
FIDO Munich Seminar Introduction to FIDO.pptx
FIDO Munich Seminar Introduction to FIDO.pptxFIDO Munich Seminar Introduction to FIDO.pptx
FIDO Munich Seminar Introduction to FIDO.pptx
FIDO Alliance
 

Recently uploaded (20)

Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
 
Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+
 
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and ConsiderationsChoosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
 
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdfDefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
 
UX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business GoalsUX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business Goals
 
What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024
 
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
 
FIDO Munich Seminar Introduction to FIDO.pptx
FIDO Munich Seminar Introduction to FIDO.pptxFIDO Munich Seminar Introduction to FIDO.pptx
FIDO Munich Seminar Introduction to FIDO.pptx
 

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

  • 1. ACM ICPC 2014{2015 Northeastern European Regional Contest Problems Review Roman Elizarov December 7, 2014
  • 2. Problem A. Alter Board I The minimal answer to this problem is bn=2c + bm=2c I The solution is to make inversions on each even row and each even column I To prove that the answer is minimal consider the
  • 3. rst column with its n cells that form n 1 neighbouring pairs I to turn all cells of the
  • 4. rst column in the same color inversions must span the
  • 5. rst column I each spanning inversion makes at most two neighbouring pairs of the same color I so the minimum of d(n 1)=2e = bn=2c inversions are needed I Then consider the top row in the same way
  • 6. Problem B. Burrito King I Consider the problem as a sum of vectors in (a; b) coordinates I The resulting vector may not go above b = B line and must extend on a axis as far as possible I It is optimal to greedily add (ai ; bi ) ingredient vectors starting from the ones that have the least angle to 0a line (or maximal ai=bi ), until b = B line is crossed I Be careful about corner cases with ai = 0 and/or bi = 0 a b B 0 A
  • 7. Problem C. Cactus Generator I This is a straightforward problem for parsing and OO design I De
  • 8. ne class for graph with a method to generate graph given index of the
  • 9. rst and the vertices I De
  • 10. ne class for various range types I Parse and construct classes tree I Build the resulting graph I Connect arbitrary pairs of vertices of odd degree in the resulting graph using temporary edges I Use classical algorithm for Eulerian path I Remove temporary edges to get the minimal number of covering paths
  • 11. Problem D. Damage Assessment I Numerically integrate the square section by dx I The square of the cut at a given x coordinate is a simple planar geometry problem I Take care about leftmost point with in
  • 12. nite derivative I however, the required precision does not make this a big problem I the square section at this point is small x
  • 13. Problem E. Epic Win! I There is a simple solution with up to n2 states I Build your FSM as n copies of a winning FSM with n states I Each state of a winning FSM corresponds to a state in the opponent FSM I Each move of a winning FSM is a winning move for the corresponding opponent's move I Next state in a winning FSM corresponds to the opponent move and opponent's next state I Leave other transitions unde
  • 15. rst copy of a winning FMS starts in its
  • 16. rst state and wins an opponent that stats in it
  • 17. rst state by construction I Model the behaviour of the opponent and your FSM for all opponent start states from the states 2 to n I When a yet unde
  • 18. ned transition is reached, then insert a transition to a fresh copy of a winning FSM into the state corresponding to the opponent's, thus ensuring win in this copy I Stop modelling when loop is detected I Loop is inside one copy of a winning FSM and is always winning by construction
  • 19. Problem F. Filter I Nothing fancy here I Just implement what the problem statement asks for in a straightforward way I The hardest part seems to be reading and understanding the problem statement
  • 21. rst player's strategy has pretty strict priorities in the moves it makes and it can be exploited I Make the
  • 22. rst move into the free space of the board 2 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 23. Problem G. Gomoku cont'd I The opponent must play around the center and you form a diagonal 2 4 3 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 24. Problem G. Gomoku cont'd I The opponent forms three in a row and you make defensive moves 2 4 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 25. Problem G. Gomoku cont'd I The opponent closes two in a row at one side, and you extend in on the other 10 2 4 9 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 26. Problem G. Gomoku cont'd I The opponent closes the three on the other side, but you continue oence at building a winning position 11 10 2 4 12 9 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 27. Problem G. Gomoku cont'd I Force the opponent into a sequence of defensive moves I Then close four in a row with a hole that is formed by the opponent defence 15 11 14 18 10 19 2 20 4 16 12 17 9 13 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 28. Problem G. Gomoku cont'd I The opponent closes your open three, you extend it, forming a winning fork 15 22 11 14 18 10 19 2 20 4 16 12 17 9 21 13 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 29. Problem G. Gomoku win I You win I It is very hard to win otherwise, because playing
  • 30. rst in gomoku gives an enormous advantage even to such a simple strategy 26 23 15 22 11 14 18 10 19 2 20 4 16 12 17 24 9 21 13 25 6 3 1 5 7 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
  • 31. Problem H. Hidden Maze I Make a rooted tree I Lets compute how many times each edge is a median I Start with an edge with lowest ci and work in increasing order of ci I For each edge ci look at its lowest vertex j in the tree I For each path from j down into the subtree, let the balance be the number of edges with c higher than current ci minus the number of edges with c lower than current ci I For each vertex j maintain an array bj I with 2dj + 1 elements bj [] for jj di , where dj is a depth of subtree rooted at j I each item bj [] contains a number of paths down from j with a balance I including an empty path with balance zero
  • 32. Problem H. Hidden Maze cont'd I Initial bj [] is the number of paths of a length down from vertex j P I It is easy to compute recursively in O( dj ) while building rooted tree I From the current vertex j walk up the tree I For all vertices k up tree from j compute the number of paths with balance zero going from down up to j , then up to k then down to other subtree of k I paths with zero balance are the ones where ci is the median X =dj :::dj bj [] (bk [ k;j] bk#[ k;j k;k#]) I where k # is the next vertex from k down on the path to j and j is the next vertex up from j I and k;j is the sum of balances on a path from k to j I The total complexity is O( P dj hj ), where hj is the height of vertex j | length of path from root
  • 33. Problem H. Hidden Maze cont'd I Update bj [] when done with an edge ci I For all vertices k up tree from j update the bk arrow taking into account that ci balance changes from 1 to 1 bk [] bk [] + bj [ k;j + 1] bj [ k;j 1] I The total complexity is also O( P dj hj ) I However, for the graph randomly generated as described in the problem statement P (dj hj ) = O(n p n)
  • 34. Problem I. Improvements I Consider transposition aj | the number of ship at coordinate j , that is reverse to what is given in the input I It is easy to prove that the chain of ships that remain on their initial position corresponds to a subsequence of aj with a special property: I it is an increasing sequence of numbers aj followed by decreasing sequence of numbers aj I Increasing/decreasing subsequence is a well-known problem with O(n log n) solution using dynamic programming 0 0 1 1 3 2 4 3 2 4
  • 35. Problem J. Jokewithpermutation I This problem is solved with exhaustive search I for each number try all positions that it can occupy I start search with numbers that can occupy fewest number of possible positions
  • 36. Problem K. Knockout Racing I Nothing fancy here I Just implement what the problem statement asks for in a straightforward way I This is the easiest problem in the contest