The document summarizes the problems from the Northeastern European Regional Contest (NEERC). It provides statistics on each of the 12 problems, including the number of teams that solved it and the overall success rate. It then discusses the key ideas for solving three of the problems - Adjustment Office, Binary vs Decimal, and Cactus Jubilee - in 1-3 sentences each.
I am Racheal W. I am a Probability Assignment Expert at statisticsassignmenthelp.com. I hold a Masters in Statistics from, Massachusetts Institute of Technology, USA.
I have been helping students with their homework for the past 7 years. I solve assignments related to probability.
Visit statisticsassignmenthelp.com or email info@statisticsassignmenthelp.com.
You can also call on +1 678 648 4277 for any assistance with probability assignments.
I try to explain what SOLID principles are all about, how to refactor an example code according to these principles and summarize what are the benefits of writing a SOLID code.
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2016 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem.
Problem statements are available here:
http://neerc.ifmo.ru/information/problems.pdf
The beginning of the following video has the actual review (in Russian): https://www.youtube.com/watch?v=fN25KkNYsjA
I am Racheal W. I am a Probability Assignment Expert at statisticsassignmenthelp.com. I hold a Masters in Statistics from, Massachusetts Institute of Technology, USA.
I have been helping students with their homework for the past 7 years. I solve assignments related to probability.
Visit statisticsassignmenthelp.com or email info@statisticsassignmenthelp.com.
You can also call on +1 678 648 4277 for any assistance with probability assignments.
I try to explain what SOLID principles are all about, how to refactor an example code according to these principles and summarize what are the benefits of writing a SOLID code.
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2016 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem.
Problem statements are available here:
http://neerc.ifmo.ru/information/problems.pdf
The beginning of the following video has the actual review (in Russian): https://www.youtube.com/watch?v=fN25KkNYsjA
Slides from tech talk about the art of non-blocking waiting in Java with LockSupport.park/unpark and AbstractQueuedSynchronizer. Presented on JPoint 2016 Conference.
Многопоточное Программирование - Теория и ПрактикаRoman Elizarov
Многоядерные процессоры используются во всех серверах, рабочих станциях и мобильных устройствах. Написание многопоточных программ необходимо для обеспечения вертикальной масштабируемости, но, в отличие от однопоточных программ, их намного сложней отладить и протестировать, чтобы убедиться в корректности. Важно понимать какие именно гарантии дают те или иные конструкции языка и библиотеки при их многопоточном исполнении и какие подводные камни могут нарушить корректность кода. Доклад будет содержать краткое введение в теорию многопоточного программирования. Мы рассмотрим теоретические модели, которые используются для описания поведения многопоточных программ. Будут рассмотрены понятия последовательной согласованности и линеаризуемости (с примерами) и объяснено зачем это все-нужно программисту-практику. Будет показано как эти понятия применяются в модели памяти Java с примерами кода приводящего к неожиданным результатам с точки зрения человека, который с ней не знаком.
Доклад сделан для конференции Java Point Student Day 2016.
I am Bing Jr. I am a Computer Network Assignment Expert at computernetworkassignmenthelp.com. I hold a Master's in Computer Science from, Glasgow University, UK. I have been helping students with their assignments for the past 10 years. I solve assignments related to the Computer Network.
Visit computernetworkassignmenthelp.com or email support@computernetworkassignmenthelp.com.
You can also call on +1 678 648 4277 for any assistance with the Computer Network Assignment.
JEE Main 2020 Question Paper With Solution 08 Jan 2020 Shift 1 Memory BasedMiso Study
JEE Main 2020 Question Paper With Solution 08 Jan 2020 Shift 1 Memory Based, which helps you to understand the chapter in easy way also downaload sample papers and previous year papers and practice to solve the question on time. Download at www.misostudy.com.
I am Justin M. I am an Algorithm Exam Expert at programmingexamhelp.com. I hold a Bachelor of software engineering from, the University of Massachusetts Amherst, United States. I have been helping students with their exams for the past 9 years. You can hire me to take your exam in Algorithm.
Visit programmingexamhelp.com or email support@programmingexamhelp.com. You can also call on +1 678 648 4277 for any assistance with the Algorithm Exam.
I am Andrew O. I am an Algorithm Assignment Expert at programminghomeworkhelp.com. I hold a master’s in Programming from, the University of Southampton, UK. I have been helping students with their assignments for the past 12 years. I solve assignment related to Algorithms.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with the Algorithm assignment.
Divide-and-Conquer & Dynamic Programming
Divide-and-Conquer: Divide a problem to independent subproblems, find the solutions of the subproblems, and then merge the solutions of the subproblems to the solution of the original problem.
Dynamic Programming: Solve the subproblems (they may overlap with each other) and save their solutions in a table, and then use the table to solve the original problem.
Example 1: Compute Fibonacci number f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2) Using Divide-and-Conquer:
F(n) = F(n-1) + F(n-2)
F(n-2) + F(n-3) + F(n-3) + F(n-4)
F(n-3)+F(n-4) + F(n-4)+F(n-5) + F(n-4)+F(n-5) + F(n-5) + F(n-6)
…………………….
Computing time: T(n) = T(n-1) + T(n-2), T(1) = 0 T(n)=O(2 ) Using Dynamic Programmin: Computing time=O(n)
n
Chapter 8 Dynamic Programming (Planning)
F(0)
F(1)
F(2)
F(3)
F(4)
……
F(n)
Example 2
The matrix-train mutiplication problem
*
Structure of an optimal parenthesization
Matrix Size
A1 30×35
A2 35×15
A3 15×5
A4 5×10
A5 10×20
A6 20×25
Input
6
5
3
2
4
1
3
3
3
3
3
3
3
3
5
1
2
3
4
5
i
j
1 2 3 4 5
s[i,j]
6
5
3
2
4
i
j
m[i,j]
15125
10500
5375
3500
5000
0
11875
7125
2500
1000
0
9375
4375
750
0
7875
2625
0
15750
0
0
1 2 3 4 5 6
1
i-1
k
j
Matrix-Chain-Order(p)
1 n := length[p] -1;
2 for i = 1 to n
3 do m[i,i] := 0;
4 for l =2 to n
5 do {for i=1 to n-l +1
6 do { j := i+ l-1;
7 m[i,j] := ;
8 for k = i to j-1
9 do {q := m[i,k]+m[k+1,j] +p p p ;
10 if q < m[i,j]
11 then {m[i,j] :=q; s[i,j] := k}; }; };
13 return m, s;
Input of algorithm: p , p , … , p (The size of A = p *p )
Computing time O(n )
8
0
1
n
i
i+1
i
3
Example 3
Longest common subsequence (LCS)
A problem from Bioinformatics: the DNA of one organism may be
S1 = ACCGGTCGAGTGCGCGGAAGCCGGCCGAAA, while the DNA of another organism may be S2 = GTCGTTCTTAATGCCGTTGCTCTGTAAA. One goal of comparing two strands of DNA is to determine how “similar” the two strands are, as some measure of how closely related the two organisms are.
Problem Formulization
Given a sequence X = ( ), another sequence Z = ( ) is a subsequence of X if there exists a strictly increasing sequence ( ) of indices of X such that for all j = 1, 2, …k, we have .
Theorem
Let X = ( ) and Y = ( ...
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
Presentation for SPTCC 2017 - http://neerc.ifmo.ru/sptcc/
Video (part 1): https://www.youtube.com/watch?v=W2dOOBN1OQI
Video (part 2): https://www.youtube.com/watch?v=iQsN_IDUTSc
Пишем самый быстрый хеш для кэширования данныхRoman Elizarov
Типичный случай — приложению работающему с БД некоторые объекты нужны так часто, то их необходимо кэшировать в памяти. В этом случае их кладут в структуру данных типа хэш. Однако, бывают случаи, когда даже поиск в этом хэше становится узким местом приложения и решения из стандартных библиотек перестают устраивать по своей производительности.
Основной упор доклада будет не на конкретный алгоритм, а на та техниках дизайна быстрых алгоритмов — на что надо обращать внимание, как вообще подходить к решению подобных задач.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
2. Problems summary
Recap: 224 teams, 12 problems, 5 hours,
20-th NEERC — Jubilee
This review assumes the knowledge of the problem statements
(published separately on http://neerc.ifmo.ru/ web site)
Summary table on the next slide lists problem name and stats
author — author of the original idea
acc — number of teams that had solved the problem (gray bar
denotes a fraction of the teams that solved the problem)
runs — number of total attempts
succ — overall successful attempts rate (percent of accepted
submissions to total, also shown as a bar)
4. Problem A. Adjustment Office
Total
time
0h 1h 2h 3h 4h 5h
196
326
Java C++ Total
Accepted 17 179 196
Rejected 53 273 326
Total 70 452 522
solution team att time size lang
Fastest SPbAU 1 1 7 1,051 C++
Shortest NU 14 2 41 529 C++
Max atts. UrSU 2 10 130 1,650 Java
5. Problem A. Adjustment Office (1)
Recap: n × n grid, each cell (x, y) has value x + y
Initial sum at row or column k is equal to nk + n(n+1)
2
Maintain two pieces of data for rows and columns:
The set of all zeroed out rows Sr and columns Sc, initially
both sets are empty
Two sums sr,c = i∈{1...n}Sr,c
i, initially both sums are n(n+1)
2
The result of row query “R r” is equal to:
n −|Sc| r + sc if r /∈ Sr
0 otherwise
If r /∈ Sr, then Sr ← Sr ∪ {r} and sr ← sr − r
Similarly for column queries
6. Problem B. Binary vs Decimal
Total
time
0h 1h 2h 3h 4h 5h
12
71
Java C++ Total
Accepted 4 8 12
Rejected 4 67 71
Total 8 75 83
solution team att time size lang
Fastest SPb SU 1 2 73 1,914 Java
Shortest ITMO 1 1 112 1,193 Java
Max atts. MAI 5 269 256,031 C++
7. Problem B. Binary vs Decimal (1)
It is easy to prove that 10k
2 has 2k
2 as a suffix, for example:
decimal binary
110 12
1010 10102
10010 11001002
100010 11111010002
Let Ck be a set of all numbers less than 10k, whose decimal
representation is equal to its k last binary digits
Let Ck = Ak ∪ Bk, where all x ∈ Ak have k-th (counting from
zero) digit of 0 and all x ∈ Bk have k-th digit of 1
Bk is a set of bindecimal numbers of length k — one we want
k Ak Bk
0 {0} {}
1 {0} {1}
2 {0, 1} {10, 11}
3 {0, 1, 10, 11} {100, 101, 110, 111}
4 {0, 1, 100, 101} {1000, 1001, 1100, 1101}
8. Problem B. Binary vs Decimal (2)
Define a recursive rule to get Ck from Ck−1
Ak = x x ∈ Ck−1 and k-th bit of x is zero
Bk = x + 10k
x ∈ Ck−1 and k-th bit of x is zero
Ck = Ak ∪ Bk
Keep Ck as an ordered list, so when new Bk is computed as
defined above, the bindecimal numbers in Bk are produced in
ascending order; count them; stop when n-th bindecimal
number is found
Note, that the max answer for n = 10 000 is around 10161, so
it will not fit into any standard data types; need long
arithmetics to implement it
9. Problem C. Cactus Jubilee
Total
time
0h 1h 2h 3h 4h 5h
14
14
Java C++ Total
Accepted 0 14 14
Rejected 0 14 14
Total 0 28 28
solution team att time size lang
Fastest Saratov SU 4 1 124 3,673 C++
Shortest Ural FU 1 2 151 2,735 C++
Max atts. MIPT 2 4 279 3,487 C++
10. Problem C. Cactus Jubilee (1)
Depth-first search (DFS) of the cactus to split the edges of
the cactus into disjoint sets of bridge-trees Bi and cycles Ci
Each back edge found during DFS signals a cycle
Compute size of each Bi and a number of non-adjacent pairs
of edges during the first DFS; do a second DFS to push it to
all adjacent cycles
1
2
3
4
5
6
7
8
9
10 11
1213
14
15
C1
C2
C3
C4
B1
11. Problem C. Cactus Jubilee (2)
When an edge from a bridge-tree Bi is removed, cactus splits
into two connected components
any pair of vertices from these two components can be
reconnected to get a cactus
number of ways can be counted during initial DFS
1
2
3
4
5
6
7
8
9
10 11
1213
14
15
12. Problem C. Cactus Jubilee (3)
When an edge from a cycle Ci is removed, cactus is still
connected; bridge-trees adjacent to cycle merge
any pair of non-adjacent vertices from the same bridge-tree
can be connected to get a cactus
Scan all cycles to figure out the the number of ways to add an
edge for each cycle broken; multiple by the cycle size
1
2
3
4
5
6
7
8
9
10 11
1213
14
15
13. Problem D. Distance on Triangulation
Total
time
0h 1h 2h 3h 4h 5h
9
58
Java C++ Total
Accepted 0 9 9
Rejected 2 56 58
Total 2 65 67
solution team att time size lang
Fastest NNSU 1 145 4,602 C++
Shortest SPbAU 1 1 235 3,579 C++
Max atts. SPb SU 3 6 266 7,846 C++
14. Problem D. Distance on Triangulation (1)
Divide and conquer; prove that each triangulated polygon has
a diagonal that cuts at least n/3 vertices
Randomly picking a diagonal does not work — will time limit
Recursively split polygons this way for a total depth of
O(log n); get O(n) subpolygons of total size O(n log n)
Terminal subpolygons for this problem are the ones that do
not have have any diagonals to split them further — triangles
1 2
3
45
6
15. Problem D. Distance on Triangulation (2)
For each subpolygon precompute the shortest distances from
two ends of the diagonals of that was used to cut out this
subpolygon from the large one
O(n log n) total memory to store the distances
Can be done in O(n log n) by doing breadth-first search in each
subpolygon or in O(n log2
n) by doing recursive queries (see
below for query implementation)
Each query can be answered in O(log n) recursively
Terminal subpolygon (triangle) — trivial
x and y in query are both on one side of splitting diagonal —
recursive query into the corresponding subpolygon
x and y in query are on different sides — use precomputed
distances to diagonal ends (diagonals do not intersect, so
x − y path goes through one of the ends)
16. Problem E. Easy Problemset
Total
time
0h 1h 2h 3h 4h 5h
208
73
Java C++ Total
Accepted 17 191 208
Rejected 9 64 73
Total 26 255 281
solution team att time size lang
Fastest Ural FU 1 1 8 1,011 C++
Shortest NU 14 1 22 426 C++
Max atts. Kyrgyz-Turkish U 1 5 188 781 C++
17. Problem E. Easy Problemset (1)
The easiest problem
Just implement what the problem statement says
Pay attention to judges without remaining problems — don’t
forget to propose a hard problem
Sample inputs and outputs were designed to expose all the
tricky cases to make debugging easy
18. Problem F. Froggy Ford
Total
time
0h 1h 2h 3h 4h 5h
101
501
Java C++ Total
Accepted 5 96 101
Rejected 12 489 501
Total 17 585 602
solution team att time size lang
Fastest NNSU 1 41 2,281 C++
Shortest ITMO 4 1 85 1,600 C++
Max atts. Saratov SU 3 19 217 3,797 C++
19. Problem F. Froggy Ford (1)
Consider a graph with vertices 1, . . . n corresponding to
stones, 0 for the left shore, n + 1 for the right one; obvious
way to compute distances between vertices
The problem of finding the optimal route from 0 to n + 1 as
defined in problem is called minimax path problem
1
2
3
4
5
6
7
0
8
20. Problem F. Froggy Ford (2)
Minimax path form 0 to all other vertices can be found by
Djikstra algorithm with a corresponding minimax update rule;
O(n2); no need to even have a heap in Djikstra
Second invocation of the same algo to find minimax path
from n + 1 to all others
A new optimal stone can be only at the center between a pair
of vertices (stone – stone, stone – shore, shore – shore)
Check all pairs of vertices; O(n2
)
Use precomputed distances to 0 and to n + 1 to find distance
when new stone is placed; pick the optimal case
Make sure to correctly implement distances between shores
(vertices 0 and n + 1); this case is not covered in sample input
21. Problem G. Generators
Total
time
0h 1h 2h 3h 4h 5h
153
380
Java C++ Total
Accepted 9 144 153
Rejected 53 327 380
Total 62 471 533
solution team att time size lang
Fastest MSU 3 1 29 3,169 C++
Shortest Ural FU 4 2 86 1,136 C++
Max atts. Far Eastern FU 19 262 1,699 C++
22. Problem G. Generators (1)
Recap: x
(j)
i+1 = a(j)x
(j)
i + b(j) mod c(j)
Generate c(j) numbers for each LCG — produce all numbers
this LCG can possibly generate; for each LCG find:
the maximum x
(j)
tj
; pay attention to x
(j)
0 (don’t skip it)
the second maximum x
(j)
uj , such that x
(j)
tj
− x
(j)
uj mod k = 0
Pay attention to cases when there is no second maximum, e.g.
all generated numbers are the same or all differences between
them are multiples of k
When n
j=1 x
(j)
tj
mod k = 0 — that’s the answer
Otherwise, find j such that x
(j)
tj
− x
(j)
uj is maximized (if at
least one second maximum uj exists) and replace tj with uj
Otherwise, there is no answer
23. Problem H. Hypercube
Total
time
0h 1h 2h 3h 4h 5h
3
12
Java C++ Total
Accepted 0 3 3
Rejected 0 12 12
Total 0 15 15
solution team att time size lang
Fastest SPb SU 1 1 175 2,241 C++
Shortest SPb SU 1 1 175 2,241 C++
Max atts. Ural FU 1 3 289 5,628 C++
24. Problem H. Hypercube (1)
Disassemble tesseract into 8 cubic cells
Start with an arbitrary cube of an octocube, assume it
corresponds to an arbitrary cell of tesseract
Visit all cubes of a given octocube via DFS
Each time a cube is visited, see what cell it shall correspond
to and if that cell was not used yet
There are two conceptual ways to uniquely identify tesseract’s
cells and to traverse them
3D geometry — represent each cell via numbering of its 8
vertices; no 4D vector manipulations required
4D geomerty — represent each cell via a 4D vector normal;
leads to simpler code
26. Problem H. Hypercube (3)
Solution using 3D geometry
All vertices of a tesseract are numbered from 0 to 15
Cell in a tesseract are represented by cubes of 8 vertex indices
Moving in one of 6 directions in an given octocube, find 4
vertices in that direction on a corresponding face of the
current cube
Among remaining cells find the one that can be
rotated/flipped (in 3D) to get a match of vertices
face-to-face — this is the next cell and its 3D rot’n/flip
0
4
2
6
1
5
3
7
1
5
3
7
9
13
11
15
27. Problem H. Hypercube (4)
Solution using 4D geometry
Keep track of a 4 × 4D vectors: 3 vectors define a basis for
current cell’s hyperplane, 4th vector defines a normal
A normal also uniquely identifies a cell of a tesseract
Moving in one of 6 directions in an given octocube, the
corresponding basis vector of the current hyperplane
(multiplied by ±1 depending on direction in the axis) becomes
the normal of the next cell; the former normal replaces basis
vector in that direction (multiplied by 1) — proper 4D rot’n
x
y
z
norm (0,0,0,-1)
x (0,0,0,1)
y
z
norm (1,0,0,0)
28. Problem I. Iceberg Orders
Total
time
0h 1h 2h 3h 4h 5h
2
Java C++ Total
Accepted 0 0 0
Rejected 0 2 2
Total 0 2 2
29. Problem I. Iceberg Orders (1)
The structure of the code is hinted in the statement:
keep buy and sell orders in the book separately in a sorted tree
maps keyed by the price
at each price keep a list of orders ordered by priority
this way finding a set of orders to match with is efficient —
O(k), where k is the number of orders to match with
The solution is then mostly boils down to implementing what
the problem statement says, with one tricky case
When big order (volume Va is big) comes in, it produces a lot
of trades with other orders that have small tip value TVb;
namely O(Va) trades — too many to simulate directly
Recap: Va is up to 109; while the total number of different
matched order pairs is guaranteed not to exceed 105
30. Problem I. Iceberg Orders (2)
The tricky case is addressed by figuring out how many times
m an incoming order fully matches with all orders at a current
price level
m is found using binary search in O(p log Va) operations,
where p is the number of orders at a given price level
Then, all the m matches can be simulated at one pass in
O(p); simulating remaining pass directly
Care shall taken be in two additional cases
when p k make sure that O(k) operations are performed —
must do one direct order-by-order match at a given price level
first
when incoming order volume Va is so big that the whole price
level with k orders is consumed, must do it in O(k); can afford
additional log in binary search only at the last matched price
level
31. Problem J. Jump
Total
time
0h 1h 2h 3h 4h 5h
52
525
Java C++ Total
Accepted 1 51 52
Rejected 43 482 525
Total 44 533 577
solution team att time size lang
Fastest Ural FU 1 1 33 1,401 C++
Shortest Ural FU 4 5 286 905 C++
Max atts. Perm SU 1 7 251 1,323 C++
32. Problem J. Jump (1)
Recap: must solve in n + 500 queries
Solve the problem in two phases: Phase I with up to 499
queries and Phase II with up to n + 1 queries
Phase I: find QI such that Jump(QI) = n/2
do random queries in this phase
worst case when n = 1000, probability of guessing n/2 bits in a
single random query is
(1000
500 )
21000 = 0.0252 . . .
probability of not finding QI in 499 queries is 2.9 × 10−6
Just quit if Jump(QI) = n is found
Phase II: find solution QII such that Jump(QII) = n
for i = 2 . . . n do queries with Qi ={QI bits 0 and i flipped}
Jump(Qi ) = n/2 if bits 0 and i has the same “correctness”
assume 0 is correct bit in QI; make QII={QI all bits j flipped}
where Jump(Qj ) = n/2; try query QII; quit if got n
assume 0 is not correct; make QII={QI all bits j flipped}
where j = 0 or Jump(Qj ) = n/2; must get Jump(QII) = n
33. Problem K. King’s Inspection
Total
time
0h 1h 2h 3h 4h 5h
24
229
Java C++ Total
Accepted 0 24 24
Rejected 6 223 229
Total 6 247 253
solution team att time size lang
Fastest MIPT 5 2 102 2,920 C++
Shortest ITMO 1 3 212 2,164 C++
Max atts. NEFU 1 9 279 2,865 C++
34. Problem K. King’s Inspection (1)
Count in-degree din
i and out-degree dout
i for each city i; there
is no route if either is zero for any city (important check!)
Identify special cites i: capital (i = 1) and cities with din
i > 1
or dout
i > 1; there are at most 41 special cities
Other cities are ordinary
captial (special) 1 2 ordinary
ordinary 3 4 special
35. Problem K. King’s Inspection (2)
Merge all paths between special cities though ordinary cities.
Ordinary cities: non-capital and din
i = 1 and dout
i = 1
For each special city create a list of outgoing paths to other
special cities
there is no route if more than one outgoing path from a special
city requires going through ordinary cities
if there is one outgoing path through ordinary cities, make it
the only path in the outgoing list
captial (special) 1 2
3 4 special
36. Problem K. King’s Inspection (3)
The picture shows properly reduced graph; but the list of
cities on the reduced paths is still kept to print the answer
Do exhaustive search (backtracking) for a path — at most 220
operations
There are at most 20 special cities with some choice (more
that 1 outgoing path in list)
captial (special) 1 2
3 4 special
37. Problem L. Landscape Improved
Total
time
0h 1h 2h 3h 4h 5h
56
157
Java C++ Total
Accepted 2 54 56
Rejected 8 149 157
Total 10 203 213
solution team att time size lang
Fastest Saratov SU 4 1 53 2,969 C++
Shortest Kazakh-British TU 2 5 289 1,465 C++
Max atts. MIPT 3 9 298 2,880 C++
38. Problem L. Landscape Improved (1)
Do binary search for the answer; try O(log n) guesses at the
answer in the process
For each guess m of the answer count the number of squares
of stones required to build a mountain of height m, if it is
possible; compare the result with n
Let ri be the number of squares of stones required to support
the mountain of height m with a peak at i at the right
i = 2
m = 7 r2 = 9
39. Problem L. Landscape Improved (2)
Let li — the number to support at the left
Total number of squares ti = li + ri + m − hi
The number of required squares is min ti for all i
ri is computed with a single pass for i from 1 to w in O(w)
li with a single pass for i from w to 1
overall time to find a solution is O(w log n)
i = 2
m = 7
l2 = inf cannot support at the left
40. Credits
Special thanks to all jury members and assistants
(in alphabetic order):
Alexander Kaluzhin, Andrey Lopatin, Andrey Stankevich,
Artem Vasilyev, Borys Minaiev, Demid Kucherenko,
Dmitry Shtukenberg, Egor Kulikov, Elena Andreeva,
Gennady Korotkevich, Georgiy Korneev, Gleb Evstropov,
Grigoriy Shovkoplyas, Maxim Buzdalov, Mikhail Dvorkin,
Mikhail Pyaderkin, Mikhail Tikhomirov, Nikita Kravtsov,
Niyaz Nigmatullin, Oleg Hristenko, Pavel Krotkov,
Pavel Kunyavsky, Pavel Mavrin, Petr Mitrichev,
Viktor Omelyanenko, Vitaly Aksenov