Пишем самый быстрый хеш для кэширования данныхRoman Elizarov
Типичный случай — приложению работающему с БД некоторые объекты нужны так часто, то их необходимо кэшировать в памяти. В этом случае их кладут в структуру данных типа хэш. Однако, бывают случаи, когда даже поиск в этом хэше становится узким местом приложения и решения из стандартных библиотек перестают устраивать по своей производительности.
Основной упор доклада будет не на конкретный алгоритм, а на та техниках дизайна быстрых алгоритмов — на что надо обращать внимание, как вообще подходить к решению подобных задач.
The theory of concurrent programming for a seasoned programmerRoman Elizarov
The document discusses concurrent programming theory and models. It begins with basic definitions of processes, threads, and shared memory models. It then covers formal models of computation including shared objects and registers. Key concepts discussed include linearizability, happens-before relations, mutual exclusion, and non-blocking algorithms.
The document describes solutions to several algorithmic problems:
1) It proposes using a sweeping line algorithm to check polygons for self-intersections and intersections between polygons.
2) It suggests a solution that uses left-hand and right-hand rule traversals from an entrance to a lair, precomputing blocked cells to efficiently check if an obstacle blocks both paths.
3) It outlines an approach using dynamic programming to build a protein sequence from prefix and suffix to maximize the number of explained peaks in a matrix, in O(n3) time.
The document summarizes programming training events hosted by Moscow Institute of Physics and Technology in preparation for the ACM International Collegiate Programming Contest. It details that the Fall 2013 training saw participation from 28 teams across 17 universities in 5 countries, with 7 teams qualifying as finalists in the ACM contest. The Fall 2014 training is scheduled from November 12-22 at the Moscow Institute of Physics and Technology, with participants asked to register online.
13 3 arithmetic and geometric series and their sumshisema01
This document discusses arithmetic and geometric series. It defines a series as the sum of the terms of a sequence, and defines notation for representing the sum of n terms. It provides the formulas for calculating the sum of finite arithmetic and geometric series, and includes examples of applying the formulas to find sums. It also includes practice problems for readers to solve.
Problem solving on acm international collegiate programming contestFedor Tsarev
This document provides tips for problem solving as part of an ACM International Collegiate Programming Contest team. It emphasizes the importance of collaboration, testing solutions thoroughly before submitting, and debugging carefully if a solution is rejected. The key recommendations are to start with simpler problems, work as a team with assigned roles, thoroughly discuss and test solutions, and focus on fixing existing problems in the last hour rather than starting new ones.
The document discusses different search techniques including binary search, bisection, and ternary search. It provides descriptions of binary search and gives iterative and recursive pseudocode implementations. It also discusses the logarithmic worst case performance of binary search. Ternary search is introduced as a technique for finding the minimum or maximum of a unimodal function. Bisection is described as dividing elements into two parts and sorting one part to enable binary search.
The document discusses the theory of concurrent programming. It begins by defining key terms like process, thread, and shared memory. It then introduces a model of concurrent computation using shared objects and threads. The model assumes threads communicate by performing operations on shared objects like registers and memory. Properties of concurrent programs are discussed, like nondeterminism. Lamport's "happens before" model is introduced to define relations between operations in an execution. Linearizability is defined as a desirable property where concurrent histories can be extended to a legal and serial history. Atomic or linearizable objects are those where all histories satisfy this property.
This document contains information about various 3D shapes or solids. It divides solids into two groups: Group A includes cylinders and prisms which have bases and tops of the same shape, while Group B includes cones and pyramids which have a pointed top. The document provides details on the dimensional parameters, projections and solving problems related to different solids. It also discusses positions of the center of gravity for freely suspended solids.
1. The document describes various solids and their classification into two groups - Group A consisting of solids with bases and tops of the same shape, and Group B consisting of solids with bases of some shape and just a point as the top.
2. Dimensional parameters of different solids like cylinders, cones, prisms and pyramids are defined. Positions of solids relative to planes are also described.
3. Three step methods for solving problems involving solids inclined to horizontal and vertical planes are outlined. Various categories of illustrated problems involving different cases are listed.
The document discusses different types of solids and their projections. It classifies solids into two groups - Group A solids have the same shape for the top and base, including cylinders and prisms. Group B solids have the base of some shape and a point for the top, including cones and pyramids. It provides steps for drawing projections of solids in different positions and orientations, including problems showing projections of specific solids like pyramids, cylinders, and cones in various configurations.
The document discusses different types of solids and their projections. It is divided into two major sections.
Section one classifies solids into two groups - Group A solids have the same shape for the top and base, such as prisms and cylinders. Group B solids have the base of one shape and a point top called the apex, such as pyramids and cones. It then provides examples and diagrams of different solids.
Section two provides steps for solving problems involving solids. It explains how to assume the solid is standing on a plane based on its orientation, and how to draw front and top views. It also categorizes example problems and provides solutions for problems involving solids like py
1. The document discusses different types of solids and their classification into two groups based on the shape of their top and base.
2. It provides instructions on how to solve problems involving solids by assuming their position and orientation, and drawing their front, top, and side views in three steps.
3. Examples of problems involving solids like cubes, pyramids, cylinders, and cones in different orientations are presented along with their step-by-step solutions.
1. The document discusses different types of solids and their classification into two groups: Group A solids have the same shape for the top and base, while Group B solids have the base of some shape and just a point for the top.
2. It provides details on the dimensional parameters of solids like cylinders, cones, prisms and pyramids. It also describes how to solve problems involving solids in three steps: assuming the solid standing on a reference plane, drawing the front and top views, and considering any remaining inclinations.
3. An example problem is given involving drawing the projections of a freely suspended pentagonal pyramid with conditions specified.
1. The document discusses different types of solids and their classification into two groups based on the shape of their top and base.
2. It provides instructions on how to solve problems involving solids through a three step process of assuming the solid in different positions and drawing their front and top views.
3. Examples of problems involving solids like cubes, pyramids, cylinders and cones in different orientations are presented along with their step-by-step solutions.
1. The document discusses different types of solids and their classification into two groups: Group A includes solids with bases of the same shape as the top like cylinders and prisms, while Group B includes solids with the top being a single point called the apex, like cones and pyramids.
2. It provides details on the dimensional parameters of different solids like their faces, edges, bases, etc. It also discusses different positions of solids relative to planes like standing, resting, or lying.
3. Steps to solve problems involving solids inclined to horizontal and vertical planes are outlined. The document contains examples of problems involving solids like cylinders, cones, cubes, and tetrahed
1. The document discusses different types of solids and their classification into two groups - Group A includes solids with bases of the same shape as the top, like cylinders and prisms. Group B includes solids with the base of one shape and just a point as the top, like cones and pyramids.
2. It then provides dimensional parameters and definitions for different solids like triangular faces, slant edges, generators, etc. It also discusses positions of solids relative to planes like standing, resting, and lying.
3. The rest of the document contains 10 problems solving different configurations of solids through their projections using standard procedures like making visible lines dark and hidden lines dotted. This includes
1. The document describes various solids and their dimensional parameters including rectangular prisms, triangular prisms, square pyramids, cylinders, and cones. It discusses their faces, edges, and other geometric features.
2. Methods for solving problems involving solids are presented. Problems can be solved in three steps: 1) assume the solid is standing on the plane it is inclined to, 2) draw projections considering the solid's inclination, and 3) draw final projections considering any remaining inclinations.
3. Several example problems are shown applying this three-step method to solids inclined to horizontal and vertical planes in different positions like standing, resting, or freely suspended. This includes determining front, top/
- The document discusses drawing projections of solids. It provides steps to solve problems involving drawing projections of solids that are inclined or freely suspended.
- It explains that three views are typically needed to represent a 3D solid on a 2D surface: a front view, top view, and side view. It outlines a three step process for drawing projections of inclined solids: 1) assume the solid is standing on the plane it is inclined to, 2) draw projections in that position, 3) draw projections considering the remaining inclinations.
- It provides examples of applying these steps to problems involving solids like prisms, pyramids, cylinders and cones in different orientations. Guidelines are given for determining which
The document discusses the development of surfaces of solids. It begins by defining development as the shape of an unfolded sheet obtained by cutting open a hollow object from one side. Developments are 2D representations that show the true area and dimensions of an object. Various solids like prisms, cylinders, cones, pyramids and their sections can be developed. Developments have many engineering applications in sheet metal fabrication. The document then provides examples of developing different solids and solving problems involving finding the developments of cut sections. It concludes by constructing the path of a particle moving in a helical path around a cone.
This document discusses polygons and how to find the measures of their interior and exterior angles without using a protractor. It defines polygons as closed shapes made of line segments. Polygons are named based on the number of sides and can be regular or irregular. The interior angles of any polygon sum to (n-2)×180°, where n is the number of sides. The exterior angles of any polygon sum to 360°. For regular polygons, each interior angle is the same measure and each exterior angle is 360° divided by the number of sides. The document provides examples of using these rules to find missing angle measures.
The document discusses various types of solids and their classification. It provides information on dimensional parameters of solids like prisms, pyramids, cylinders and cones. It also describes positions of solids like standing, resting and lying on horizontal and vertical planes. Several example problems are given with step-by-step solutions to draw projections of different solids in various orientations.
This document discusses different types of solids and their properties. It provides steps for solving problems involving solids.
Group A solids like cylinders and prisms have bases and tops of the same shape. Group B solids like cones and pyramids have a point top called an apex.
Problems involving solids are solved in three steps: 1) assume the solid is standing on its plane of inclination, 2) draw front and top views considering the inclination axis, 3) draw final views considering any remaining inclinations.
Several example problems are provided and walked through step-by-step to demonstrate how to draw the projections of solids in different orientations. Freely suspended solids have their
This document discusses different types of solids and their properties. It provides steps for solving problems involving solids.
Group A solids like cylinders and prisms have bases and tops of the same shape. Group B solids like cones and pyramids have a point top called an apex.
Problems involving solids are solved in three steps: 1) assume the solid is standing on its base plane, 2) draw projections considering the axis position, 3) draw final projections considering any remaining inclinations.
Several example problems are provided and walked through step-by-step to demonstrate how to draw projections of solids in different orientations. Key properties of solids like the center of gravity are also
1. The document classifies solids into two groups - Group A solids have bases and tops of the same shape, while Group B solids have a base of some shape and just a point as a top.
2. Problems involving solids are solved in three steps: 1) assume the solid is standing on its base plane, 2) consider the solid's inclination, 3) consider any remaining inclination to draw the final views.
3. Key solids discussed include cylinders, cones, prisms, pyramids, tetrahedrons, and their dimensional parameters, positions of centers of gravity, and examples of how to draw their projections when resting, inclined, or freely suspended.
1) The document classifies solids into two groups - Group A solids have bases and tops of the same shape, while Group B solids have a base of some shape and just a point as a top.
2) Problems involving solids are solved in three steps - assuming the solid standing on a reference plane, drawing projections based on that, then considering additional inclinations.
3) Freely suspended solids have their center of gravity located at specific points along their axis depending on the solid type - cylinders and prisms have their CG at the midpoint, while cones and pyramids have their CG a quarter of the way from the base.
The document discusses the process of determining the true shape of a plane figure given its projections. It describes using an auxiliary plane method with the following steps:
1. Draw the given front and top views.
2. Select a line in the views representing true length and draw a plane perpendicular to it.
3. Project one view onto the auxiliary plane.
4. Draw a second plane parallel to the projected view and project the other view onto it.
5. The projected view on the second plane represents the true shape of the object.
The method converts one inclined view to a line view using an auxiliary plane, then projects the other view onto a parallel plane to obtain the true shape.
Similar to ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review (20)
The document discusses asynchronous programming with Kotlin coroutines. It begins by describing problems with callbacks and futures for asynchronous code, such as callback hell and complex combinators. Kotlin coroutines provide a natural way to write asynchronous code using suspending functions that read like regular synchronous code but can suspend and resume. This is achieved by compiling coroutines to state machines under the hood. The document demonstrates how coroutines integrate well with libraries like Retrofit for making asynchronous HTTP requests. It also discusses different ways to launch coroutines, such as using coroutine builders.
Scale Up with Lock-Free Algorithms @ JavaOneRoman Elizarov
This document provides a summary of a presentation on using lock-free algorithms to scale shared mutable state on the JVM. It begins with an introduction to the speaker and discusses why shared mutable state is needed for big data and real-time processing. It then uses a toy problem of implementing a concurrent stack to demonstrate the challenges of synchronization and contention. The presentation introduces the use of atomic references and compare-and-set operations to implement lock-free push and pop operations on the concurrent stack in a non-blocking manner, improving scalability.
The document summarizes Roman Elizarov's presentation on Kotlin coroutines at the JVM Language Summit in 2017. The presentation recapped the initial Kotlin coroutines prototype, discussed issues with its design, and outlined the solutions adopted in Kotlin 1.1. This included using suspending functions instead of async/await keywords, tail suspension to avoid stack overflows, and abstraction to provide a natural coroutine declaration syntax.
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
The document discusses lock-free algorithms for Kotlin coroutines. It covers the implementation of a lock-free doubly linked list using single-word compare-and-swap operations. It also discusses how to build more complex atomic operations, like a multi-word compare-and-swap, to enable select expressions in Kotlin coroutines.
The document introduces coroutines in Kotlin. It discusses how coroutines make asynchronous code easier to write by allowing suspending functions and avoiding callback hell. Coroutines were introduced in early languages like Simula but fell out of favor due to multithreading. They are now regaining popularity for writing asynchronous non-blocking code. The document then covers how coroutines work in Kotlin, including suspending functions, coroutine builders like launch and async, and how coroutines avoid issues with approaches like callbacks and futures. It notes that coroutines in Kotlin are currently experimental but can be used in production code.
This document discusses advanced non-blocking concurrency techniques. It begins with an introduction to lock-free programming and why it can provide benefits over locking approaches. It then covers concepts like blocking, non-blocking algorithms, and waiting without locks. Specific lock-free algorithms for a toy problem, waiting, and wakeup are presented. The document also discusses using the AbstractQueuedSynchronizer for implementing lock-free waiting queues and provides examples of how to make lock-free code fair. It concludes by emphasizing that lock-free programming is error-prone and the importance of learning patterns for concurrent code.
This document discusses different approaches for profiling Java applications without using third-party tools. It begins by explaining the benefits of a do-it-yourself approach such as avoiding reliability and compliance concerns with tools. Various profiling types are then covered, including CPU profiling using wall clock time and calls, sampling, and memory profiling using JVM options. Bytecode manipulation is also presented as a method using ASM to add profiling code without changing sources. The document emphasizes learning the Java Virtual Machine and using its built-in capabilities for profiling purposes.
The document discusses Java serialization and common myths surrounding it. It summarizes that Java serialization allows for flexible evolution of classes while maintaining backwards compatibility through the use of serialVersionUID. It debunks common myths that Java serialization is slow, inflexible, or that changing private fields breaks compatibility. The document explains that serialization performance depends more on how streams are used rather than the underlying implementation.
The document discusses a market data vendor that processes data from exchange feeds and distributes it to customers. It provides millions of quotes per second using a pure Java solution called QDS Core, which parses, normalizes, and distributes the data. QDS Core uses optimized data structures like arrays and lock-free synchronization to achieve high performance. The vendor also provides an easier to use API called dxFeed on top of QDS Core to enable integration.
Keynote : Presentation on SASE TechnologyPriyanka Aash
Secure Access Service Edge (SASE) solutions are revolutionizing enterprise networks by integrating SD-WAN with comprehensive security services. Traditionally, enterprises managed multiple point solutions for network and security needs, leading to complexity and resource-intensive operations. SASE, as defined by Gartner, consolidates these functions into a unified cloud-based service, offering SD-WAN capabilities alongside advanced security features like secure web gateways, CASB, and remote browser isolation. This convergence not only simplifies management but also enhances security posture and application performance across global networks and cloud environments. Discover how adopting SASE can streamline operations and fortify your enterprise's digital transformation strategy.
Improving Learning Content Efficiency with Reusable Learning ContentEnterprise Knowledge
Enterprise Knowledge’s Emily Crockett, Content Engineering Consultant, presented “Improve Learning Content Efficiency with Reusable Learning Content” at the Learning Ideas conference on June 13th, 2024.
This presentation explored the basics of reusable learning content, including the types of reuse and the key benefits of reuse such as improved content maintenance efficiency, reduced organizational risk, and scalable differentiated instruction & personalization. After this primer on reuse, Crockett laid out the basic steps to start building reusable learning content alongside a real-life example and the technology stack needed to support dynamic content. Key objectives included:
- Be able to explain the difference between reusable learning content and duplicate content
- Explore how a well-designed learning content model can reduce duplicate content and improve your team’s efficiency
- Identify key tasks and steps in creating a learning content model
How UiPath Discovery Suite supports identification of Agentic Process Automat...DianaGray10
📚 Understand the basics of the newly persona-based LLM-powered Agentic Process Automation and discover how existing UiPath Discovery Suite products like Communication Mining, Process Mining, and Task Mining can be leveraged to identify APA candidates.
Topics Covered:
💡 Idea Behind APA: Explore the innovative concept of Agentic Process Automation and its significance in modern workflows.
🔄 How APA is Different from RPA: Learn the key differences between Agentic Process Automation and Robotic Process Automation.
🚀 Discover the Advantages of APA: Uncover the unique benefits of implementing APA in your organization.
🔍 Identifying APA Candidates with UiPath Discovery Products: See how UiPath's Communication Mining, Process Mining, and Task Mining tools can help pinpoint potential APA candidates.
🔮 Discussion on Expected Future Impacts: Engage in a discussion on the potential future impacts of APA on various industries and business processes.
Enhance your knowledge on the forefront of automation technology and stay ahead with Agentic Process Automation. 🧠💼✨
Speakers:
Arun Kumar Asokan, Delivery Director (US) @ qBotica and UiPath MVP
Naveen Chatlapalli, Solution Architect @ Ashling Partners and UiPath MVP
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Zilliz
Enterprises have traditionally prioritized data quantity, assuming more is better for AI performance. However, a new reality is setting in: high-quality data, not just volume, is the key. This shift exposes a critical gap – many organizations struggle to understand their existing data and lack effective curation strategies and tools. This talk dives into these data challenges and explores the methods of automating data curation.
It's your unstructured data: How to get your GenAI app to production (and spe...Zilliz
So you've successfully built a GenAI app POC for your company -- now comes the hard part: bringing it to production. Aparavi addresses the challenges of AI projects while addressing data privacy and PII. Our Service for RAG helps AI developers and data scientists to scale their app to 1000s to millions of users using corporate unstructured data. Aparavi’s AI Data Loader cleans, prepares and then loads only the relevant unstructured data for each AI project/app, enabling you to operationalize the creation of GenAI apps easily and accurately while giving you the time to focus on what you really want to do - building a great AI application with useful and relevant context. All within your environment and never having to share private corporate data with anyone - not even Aparavi.
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...Fwdays
.NET 8 brought a lot of improvements for developers and maturity to the Azure serverless container ecosystem. So, this talk will cover these changes and explain how you can apply them to your projects. Another reason for this talk is the re-invention of Serverless from a DevOps perspective as a Platform Engineering trend with Backstage and the recent Radius project from Microsoft. So now is the perfect time to look at developer productivity tooling and serverless apps from Microsoft's perspective.
Keynote : AI & Future Of Offensive SecurityPriyanka Aash
In the presentation, the focus is on the transformative impact of artificial intelligence (AI) in cybersecurity, particularly in the context of malware generation and adversarial attacks. AI promises to revolutionize the field by enabling scalable solutions to historically challenging problems such as continuous threat simulation, autonomous attack path generation, and the creation of sophisticated attack payloads. The discussions underscore how AI-powered tools like AI-based penetration testing can outpace traditional methods, enhancing security posture by efficiently identifying and mitigating vulnerabilities across complex attack surfaces. The use of AI in red teaming further amplifies these capabilities, allowing organizations to validate security controls effectively against diverse adversarial scenarios. These advancements not only streamline testing processes but also bolster defense strategies, ensuring readiness against evolving cyber threats.
Choosing the Best Outlook OST to PST Converter: Key Features and Considerationswebbyacad software
When looking for a good software utility to convert Outlook OST files to PST format, it is important to find one that is easy to use and has useful features. WebbyAcad OST to PST Converter Tool is a great choice because it is simple to use for anyone, whether you are tech-savvy or not. It can smoothly change your files to PST while keeping all your data safe and secure. Plus, it can handle large amounts of data and convert multiple files at once, which can save you a lot of time. It even comes with 24*7 technical support assistance and a free trial, so you can try it out before making a decision. Whether you need to recover, move, or back up your data, Webbyacad OST to PST Converter is a reliable option that gives you all the support you need to manage your Outlook data effectively.
DefCamp_2016_Chemerkin_Yury-publish.pdf - Presentation by Yury Chemerkin at DefCamp 2016 discussing mobile app vulnerabilities, data protection issues, and analysis of security levels across different types of mobile applications.
Mastering OnlyFans Clone App Development: Key Strategies for SuccessDavid Wilson
Dive into the critical elements of OnlyFans clone app development, from understanding user needs and designing engaging platforms to implementing robust monetization strategies and ensuring scalability. Discover how RichestSoft can guide you through the development process, offering expert insights and proven strategies to help you succeed in the competitive market of content monetization.
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...Snarky Security
How wonderful it is that in our modern age, every bit of our biological data can be digitized, stored, and potentially pilfered by cyber thieves! Isn't it just splendid to think that while scientists are busy pushing the boundaries of biotechnology, hackers could be plotting the next big bio-data heist? This delightful scenario is brought to you by the ever-expanding digital landscape of biology and biotechnology, where the integration of computer science, engineering, and data science transforms our understanding and manipulation of biological systems.
While the fusion of technology and biology offers immense benefits, it also necessitates a careful consideration of the ethical, security, and associated social implications. But let's be honest, in the grand scheme of things, what's a little risk compared to potential scientific achievements? After all, progress in biotechnology waits for no one, and we're just along for the ride in this thrilling, slightly terrifying, adventure.
So, as we continue to navigate this complex landscape, let's not forget the importance of robust data protection measures and collaborative international efforts to safeguard sensitive biological information. After all, what could possibly go wrong?
-------------------------
This document provides a comprehensive analysis of the security implications biological data use. The analysis explores various aspects of biological data security, including the vulnerabilities associated with data access, the potential for misuse by state and non-state actors, and the implications for national and transnational security. Key aspects considered include the impact of technological advancements on data security, the role of international policies in data governance, and the strategies for mitigating risks associated with unauthorized data access.
This view offers valuable insights for security professionals, policymakers, and industry leaders across various sectors, highlighting the importance of robust data protection measures and collaborative international efforts to safeguard sensitive biological information. The analysis serves as a crucial resource for understanding the complex dynamics at the intersection of biotechnology and security, providing actionable recommendations to enhance biosecurity in an digital and interconnected world.
The evolving landscape of biology and biotechnology, significantly influenced by advancements in computer science, engineering, and data science, is reshaping our understanding and manipulation of biological systems. The integration of these disciplines has led to the development of fields such as computational biology and synthetic biology, which utilize computational power and engineering principles to solve complex biological problems and innovate new biotechnological applications. This interdisciplinary approach has not only accelerated research and development but also introduced new capabilities such as gene editing and biomanufact
Intel Unveils Core Ultra 200V Lunar chip .pdfTech Guru
Intel has made a significant breakthrough in the world of processors with the introduction of its Core Ultra 200V mobile processor series, codenamed Lunar Lake. This innovative processor marks a fundamental shift in the way Intel creates processors, with a high degree of aggregation, including memory-on-package (MoP). The Core Ultra 300 MX series is designed to power thin-and-light devices that are capable of handling the latest AI applications, including Microsoft's Copilot+ experiences.
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
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
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
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