
Hello, Codeforces!
We are happy to invite you to an exciting online event: ICPC 2025 Online Winter Challenge powered by Huawei, which will start on December 26, 2025 11:00 UTC (UTC+0). In this Challenge, you will have a unique chance:
- to compete during 16 days online challenge
- to solve 1 exciting problem prepared by Huawei
- to win amazing prizes from Huawei!
As a special prize, Huawei together with ICPC Foundation will provide the travel and an invitation to the 50th Annual ICPC World Finals in a guest role!
Everyone is welcome to participate. It is an individual competition.
Start: December 26, 2025 11:00 UTC (UTC+0)
Finish: January 11, 2026 10:59 UTC (UTC+0)
Prizes
| Rank | Prize | |
| Grand Prize (Rank 1) | € 12 000 EUR + travel and an invitation to the the 50th Annual ICPC World Finals in a guest role | |
| First Prize (Rank 2-6) | € 8,000 EUR | |
| Second Prize (Rank 7-16) | € 3,000 EUR | |
| Third Prize (Rank 17-50): | € 800 EUR | |
| * If the allocated Huawei Challenge prize cannot be delivered to your region for any reason it may be replaced by another prize (if no legal restrictions), at the discretion of the Sponsor. | ||
Challenge Rules and Conditions
By participating in this Challenge, you agree to the Conditions of Participation and Challenge Rules. If you cannot access this document, please email [email protected]
Good luck, we hope this will be fun!
We hope you'll enjoy this complex yet very exciting Challenge!








Do the usual codeforces AI usage rules apply to this as well?
Yes
Hello, can we get this problem's checker file?
2025 feels like it just started last month.
Can minors (below 18) participate?
If so, can they get prize money?
terms and conditions say you can as long as a parent is consenting for you, idk where they would consent tho
It says "unless otherwise agreed to by Organizer and Sponsor, with appropriate parental/guardian consent", which means should be agreed to by Organizer and Sponsor.
It's good to have more contests than usual in December. Vacation :)
Start in 2025 ends in 2026
Will this challenge be like-> it will provide set of problems for each day within a given time frame or something else?
I expect 1 optimization problem that you can work on for 17 days and submit multiple times without any penalty. Here's the last one of this kind to give you an idea: https://codeforces.com/contest/1953/problem/A
Correct, will be one problem
Will it be rated ? I guess no but just to confirm
Round is unrated
Is it rated?
it wasnt last year hopefully same this time too..
No. Round is unrated
2026 says, ready to start for welcome ICPC 2025...
From what ive read, there doesnt seem to be a specifics requirement to use both the front and back cameras for anti-cheat purposes iss this still considered not allowed, or is it now permitted?
Hello thank you for doing evant. I'm big fan of Huawei. Good luck
Why it pushes off for a week?
I'm anxiously looking forward to the problem provided by Huawei.
Reward a Huawei Watch。
Yau!
$$$\text{Win amazing prizes from Huawei!}$$$
I already use a Huawei product, thanks.
How to prepare for this kind of contests? (Optimization/ approximation/ heuristics)
Checkout these problems (ICPC Challenge 2023 and 2024)
https://codeforces.com/contest/1885/problem/A https://codeforces.com/contest/2015/problem/A
Good Luck!
Thanks! And how to prepare for them?
Do you have solution of 2024 problem?
Se puede recibir la recompensa desde cuba ?
Will the problem statement pdf version or some test cases be shown?
Is this contest rated?
no
this contest is for single person
Yes
Is python allowed?
Of course, the same as the regular contests on Codeforces.
If you turn 18 during the time period of the competition are you still eligible for the prizes. And if rating changes apply then how shall they be judged.
But what if the latest submission got a lower score than previous submission? It's impossible to resubmit the same code. Is this a typo and is this supposed to be "latest submission with highest score"?
nvm this is heuristics problem, latest submission makes sense
saket5ingh this guy is an AI-cheater (see his submissions for round 1069). He's currently ranked 8th, totally unfair.
This contest is a joke. I spent 3-4 hours finetuning parameter, estimate server's test cases scope, got rank 11, just for the next day to get pushed down to rank 38. And it's only been day 4!
How often do you actively tackle such tasks?
Usually for these adhoc contests, once my heuristics reach a state that I can't improve my solution anymore, I explore the tests and finetune constants like max iterations or leaves to get the highest score, and rerun many times to average the points. For this adhoc contest, not all tests are released so I submitted multiple times and estimate what the tests on the server covers.
I don't think my approach for closed-set test cases adhoc contest is the proper approach, it's hacky but yeah, that's what I do for this one. For open-set test cases, you only submit the solution so it's a bit easier
Read the rules again. Only one link that did not score 0 (for each participant) will be tested at the end. Therefore, selecting constants to pass the pre-tests is not a very good practice. This is my personal opinion.
Yeah I noticed that too, but I think the pre-tests have some traits of the final tests, so finetuning to pre-tests might generalize to edge cases in final tests.
Also luck is 30% of the points as this is heuristics lol
Alright I actually change my mind, Im gonna learn some more optimization technique. Keeping with the current implementation doesn't seem to be the way
Well the hidden test case will take care of him.
will there be participation certificate on this particular contest
no. Read the rules
ICPCNews
[UPDATE]: It's been solved.
Forwarding a message from msmits, whose account has been disabled. He is currently competing in the Huawei contest.
Dear Codeforces Administration Team,
My Codeforces account (handle: msmits) appears to have been disabled just now. I was surprised by this action, as I am not aware of having violated any Codeforces rules.
Perhaps I submitted a few too many times, I am not sure. Today I have been frantically coding and submitting because of the excitement. I did not intend to break any rules. Currently it is the last 2 days of the huawei contest. I am ranked 4th atm and I hope I can continue the contest.
Greetings,
Michiel Smits
Will there be a virtual contest this year?
There's something I didn't understand about this problem. From the SCORE formula, alpha, beta, the 'convergence ratio,' 'M*R,' and '1' ( :D ) should be constants, leaving 'maximum flow conflict' and 'OXC adjustment cost' as the variables to optimize. It seems the 'OXC adjustment cost' worsens every time you modify a port, but there must be something I'm missing about the 'maximum flow conflict.' In my mind, if one query requires 12 connections between groups ga and gb and there's only one way to satisfy it, then the 'maximum flow conflict' would be 12. If I set a new connection between these two groups, I could distribute the load, and the 'maximum flow conflict' would be 6. A third connection would allow a 'maximum flow conflict' of 4, and so on. At the same time, if the same query requires 10 connections between groups ga and gc, and there's just one connection between groups ga and gb and one connection between groups ga and gc, the 'maximum flow conflict' will still be 12. Am I correct?
You are right, but ports are shared and limited, so number of connections should be allocated proportional to traffic demand such that the peaks are leveled out. Also demand seems to change every query so adjustment cost is hard to optimized (the tests are also designed so there are not enough ports for conflict to get down to 1/3/7 I think)
For testcases 1-11 a flow conflict of 1 is always possible except for the first query of case #05. Testcase 12-19 (1:3) can all be solved with a conflict of 4. Testcase 20-23 (1:7) can all be solved with a conflict of 8.
So it's about achieving those low conflicts while minimizing the adjustment cost
Thanks for the reply, BKkoi and eulerscheZahl! I was hoping there might be some twist in the definition that I couldn't understand, but unfortunately, I'm the idiot who has no clue how to solve it. I didn’t expect to score as well as the guys from above (thanks to these contests, they’ve probably traveled to China more than I’ve traveled to my nearest city), but I’ve been stuck in the same place no matter what I've tried. What's the best way to make progress with heuristic algorithms, if anyone has advice to share? I’m talking about something that bridges the gap between the basics of simulated annealing / tabu search and the books that give math-heavy explanations with no source code.
I think atcoder is the best place for this at the moment. They host heuristic contests about once per month — varying between 4 hours and 10 days. You compete and try your best. Afterwards you can see the codes of other contestants and some also share a written summary. Most of those write-ups are in Japanese but google translate makes it understandable.
CodinGame will also host a contest soon, probably starting end of January with a 2 weeks duration. This will be a game contest, where you submit a program that plays the game against programs from other contestants. They also have a lot of old contests still available to play for fun and a forum to read up on approaches.
Just try to learn 1 or 2 new tricks every time. You will also gain some intuition of what approach will or won't work.
Does the rating finalized??
Nope, they use DcOJ (their own OJ), as mentioned in the rules
If it helps, you can check my solution at https://github.com/lmBored/oxc_ports_arrangement_adhoc
I didn't get as high score as eulerscheZahl (didn't work on this enough to get max conflict 1 for test 6-11 I think), but I think this solution is quite robust — I probably have over-engineered some part though.
A tip I got from this contest is it's really useful to do
cerr/coutto debug each step (e.g. print maxflow, or bipartite matching assignment, etc.)My code and a summary are here: https://github.com/eulerscheZahl/CodingContests/tree/master/Huawei/Codeforces2025
Hm interesting, I was using greedy for both phrases — find perfect plane assignment then spine assignment. I didn't think of/expect assigning tasks randomly then fixes violations would perform better so kinda neglected this approach from the start:((
This approach seems to work really well for saturated cases like test 1-11, nice!
Thanks for sharing!
How does your solution switch from trying to achieve $$$max\underline{{ }}conflict=1$$$ to minimizing readjustment cost for $$$max\underline{{ }}conflict=2$$$? Are minimizing max conflict and minimizing readjustment cost with the current max conflict two separate stages?
I see pretests results in your repository, could you please add the final tests results as well?
I try to find a solution with conflict=1 for a bit. If I don't find a valid assignment after a certain time (4e5 mutations), I give up and solve with conflict=2 and a reduced set of tasks instead.
I updated the repo to use the final scores now. Also thanks a lot for sharing your ideas in the post below.
Thank you so much, BKkoi and eulerscheZahl! That’s priceless, guys! Following eulerscheZahl’s previous tip, 'Just try to learn 1 or 2 new tricks every time,' I might conclude that I got a third of the top score just because I wrote around 500 lines of code, not more than 1500 like you did (just kidding, don’t take it seriously :)). I wasn’t expecting C# and an OOP approach to take a top position—that's a curious surprise.
It took me a long while to figure this out and you seem to be thinking just as I was at the start of the contest. You seem to be considering flow conflicts as how many flows are passing by a pair of OXC ports, but that is only half of story. The puzzle piece you are probably missing is that the connection between a leaf and a spine also matters for the scoring.
As an example, consider a setup of 2 groups, 2 spine, 2 leafs, 1 OXC, 2 links, 1 plane. Consider the only flows queried to be (0, 0, 1, 0) and (0, 1, 1, 0). Then if you answer (0, 0, 0, 0, 0) and (1, 0, 0, 0, 1), you would think you are using different ports because you used different links and the maximum conflict would be 1. However, the connections you used in terms of (group, leaf, spine) was (0, 0, 0), (1, 0, 0), (0, 1, 1) and (1, 0, 0). Note that (1, 0, 0) appeared twice, meaning 2 flow conflicts happened here. Since both flows are using different port pairs, it caused only one flow conflict on that side. Then maximum flow conflict is two because of the (group, leaf, spine) connections.
Oh, that’s interesting. I never considered the connection between a leaf and a spine. I’ve wasted two weeks and still couldn’t figure it out. Let me analyze your example... maybe I’ll need another two weeks to understand it, who knows :).
I got it now! In less than two weeks. I’m making some progress :). Thanks, Voz_bonita!
Will there be any cheater detection done on this contest? I strongly believe that users wolfefrre and uuehhhe, who placed 5th and 8th respectively, have cheated (likely by using AI assistance) to achieve such placements. Both accounts were created 5 days ago and follow very similar behavior patterns.
The only activity on both accounts is a participation on the recent Codeforces Hello 2026 contest and an extremely small number of submissions on this problem given such great results. The user "uuehhhe" had a mere 19 submissions on this problem in total, of which interestingly 4 were compile errors, before skyrocketing to a score of 125k.
I have checked the actual performance of "uuehhhe" on Hello 2026 and saw that they have managed to solve the first 7 problems in a time frame of only 30 minutes. Anyone familiar with regular Codeforces contests will know this is humanely impossible to achieve even for the best competitors, let alone a newly created account.
Of course after checking their code for some of the problems it becomes immediately clear that it is AI generated, containing some AI artifacts such as "int T; if (!(cin >> T)) return 0;". This exact line is something that would be never written by an actual human in a competitive programming contest but for some reason is extremely common in AI generated code. The other user mentioned has similar patterns in their code.
Examples of AI generated submissions during an active contest (breaking Codeforces rules):
https://codeforces.com/contest/2183/submission/356825826
https://codeforces.com/contest/2183/submission/356828477
The fact that they have created an account and immediately started with cheating on Hello 2026 leads me to believe there is absolutely zero chance these users were not breaking rules on this contest as well.
This is absolutely unfair and unacceptable. Cheaters were able to reach 125k in just two or three days, while I worked hard for two weeks, only to fail the system tests (rk 15 to rk 52 due to two TLEs). Well, in most of my pretests, the runtime was under 3 seconds, and even the worst case took only around 4 seconds. I strongly believe that participants who achieve extremely high scores with only a few submissions should be investigated.
Heya, I didn’t cheat and didn’t use AI. I’m not a pro CP’er; my background is mostly engineering. I worked and tested offline in a local setup and only started submitting near the end, so the submission count is low. Account age, number of submissions, or common template lines aren’t proof of cheating. If there are concerns, I’m fine with an official check-I stand by my results.
And, what is this “Hello 2026 cheating” nonsense? Why do that?
Not sure what you mean by "common template lines". int n, k; if (!(cin >> n >> k)) return; in your submission for problem B in contest Hello 2026 is not a "common template line", it's a line that would never be written by a human participant in a contest environment and is a clear indicator of AI usage. Why would you need to check the validity of the input if by the definition of the problem you are solving you know the input is valid? Because you didn't actually write this line and most AIs prefer to put this kind of redundant safeguard in the code and people who cheat don't even bother to remove it (or are unaware it gives them away). So you tell me why you felt the need to cheat on Hello 2026.
"I worked and tested offline in a local setup and only started submitting near the end" there is zero reason or logic for this. There are no constraints on submission rate, you get results 1-2 minutes after submitting, and the given tests are all in 1:1 ratio and is a really bad representation of the overall tests. There is zero reason for someone to "participate" since the first day and proceed to not submit for the first 10 days.
"And, what is this “Hello 2026 cheating” nonsense? Why do that?"
You can't even defend your stuff in the contest but just try to waive it off by saying that it is nonsense. "Why do that?" we don't want cheaters here that's why.
However, the problem contains 23 test cases. You only tested on 01-05, where the first three are trivial. So how exactly did you do your local testing? I’d honestly like to learn, being able to cover 18 hidden tests offline would be very interesting.
aliqi also managed to reach 125k in just 20 submits, first being 6 days before the deadline. i’m not saying that this is cheated necessarily, just that it follows the same pattern. it’s probably best to check all submissions anyway
I'll share my ideas and thoughts. Final score ~110k.
Having reached a score of around 100k, I realized with simple math that the only real way to get to the top is to learn how to solve the convergence ratio == 1 problem. I spent a couple of days trying: shuffling the data, writing algorithms similar to Kuhn's algorithm and Mincost Max Flow, changing the query distribution in the Greedy Search Engine, but all to no avail. Unfortunately, I was too slow to learn how to solve the convergence ratio == 1 case.
I can only share ideas on how to optimize the second part of the score (cases 3 and 7), where the results are near the top. I used a couple of different data ordering strategies: data normalization (Ga < Gb) and a lot of random data shuffling, data normalization, and ordering by group number Ga (I don't know why, but this is the only strategy that yielded an increase). Attempts to create isomorphic datasets failed =)
When constructing, we proceed as follows: we enumerate all possible paths for each query. For each query, we run four search stages (until the first successful one). In the first stage, we try to use an existing connection (including from the previous batch of queries); in the second stage, we find a connection that no other connection breaks (-1 -1) (including from the previous batch of queries, we master OXC with 0 for T == 0, and for the rest, with M — 1); in the third stage, we break empty one-way connections from the previous batch of queries; in the fourth, we break two-way connections. The final score is ~110k; on tests 4-11, I lose 10-16k.
P.S. Regarding the fight against AI cheating, as the chair of the jury for the quarterfinals, for which the qualification is held online, I have simply given up on the fight because the diversity of models has become enormous, and the code is different. Everyone always claims they wrote the code themselves. And as a result, the qualifier winner takes 25th place out of 35 teams at the LAN tournament.
Thanks for the interesting tournament.
Thanks for sharing! Could you add your final tests results?
Yes, sure. https://pastebin.com/RZqMzmuW
Nice, your approach for the second part is indeed consistently better than mine
Our North Korean comrade Sung.An won this contest. Will he logistically be able to attend the ICPC World Finals and receive the prize money?
Would anyone be willing to share how to construct a connection scheme such that max_conflict equals the convergence ratio?
Using a greedy algorithm, I can only achieve solutions where max_conflict = convergence_ratio + 1 (except for the first three test cases, where I used DFS to achieve max_conflict = 1). As a result, I scored about 82k on the max_conflict metric, plus an additional 27k from the minimize-adjustment score.
I've tried various approaches to improve this—such as reordering the data, network flow algorithms, maximum matching, graph coloring, and more—but none seem to yield better results. So if you have a better method, I’d greatly appreciate it if you could share!
I already linked an approach that solves the 1:1 testcases except for 3 queries in the final testset — rank 20, 123.9k score: https://github.com/eulerscheZahl/CodingContests/tree/master/Huawei/Codeforces2025
for the 1:3 and 1:7 you can only achieve a conflict of 4 or 8 respectively. The number of flows going from one plane to another is not a multiple of the convergence ratio, making a lower conflict impossible.
Thank you for your sharing!
I’ve briefly read through your approach and those of others. Most solutions follow a similar high-level strategy, but I was surprised to see that—unlike others in the comments who leveraged bipartite graph properties—you achieved such highly efficient results using only a heuristic search algorithm (
SolveContainersfunction).I also tried similar search algorithms, but most of them took several minutes or even longer to produce a result. That’s why I’m especially impressed by how well your algorithm performs. Although it doesn’t yield optimal solutions on two specific data points, it’s still an excellent achievement—well done!
3rd place.
I'd like to thank the organizers for the problem. It felt meaningful and I enjoyed solving it, although I think it would be better to reduce the gap between what's guaranteed by the problem statement and what's actually true — either by providing more information or by covering the allowed test space better. If you've committed to certain 23 sets of parameters $$$(N, S, L, M, K, P, Q_{1..5})$$$, I do not see why not list them in the problem statement when they can be extracted from pretests; if $$$Q_{1..5}$$$ can differ slightly, it still seems ok to list them for both pretests and final tests. I've spent a considerable time thinking about $$$Q \ll NSL/2$$$ with no way of testing on such cases; maybe it was useful for the general problem, maybe it wasn't, it almost certainly wasn't useful for the final tests, however I could not exclude with certainty that there would be 230 diverse final tests instead of 23, of which some would break the $$$Q \approx NSL / 2$$$ pattern.
My solution is based on an augmenting chain search in a bipartite graph between variables $$$l$$$ and value assignments $$$r$$$ with somewhat arbitrary constraints of how many of certain $$$l \leftarrow r$$$ are taken. With some simple constraints it's a bipartite matching algorithm generalized to vertex capacities higher than 1, identical to Kuhn's algorithm. Unfortunately, for complicated constraints a simple augmenting chain may not exist although a more general reassignment is possible, and even if such a chain exists, it can be blocked by visiting an intermediate state with an incorrect recursive path. To find a link in a chain it is necessary to intersect the sets of assigned variables over all constraints that are saturated and prevent assigning $$$l \leftarrow r$$$. I'll start with the described constraint satisfaction version and later extend it with an optimization objective for the OXC adjustment cost.
For a long time I've tried to apply this algorithm to more or less the complete problem for $$$max\underline{{ }}conflict=1$$$. Turns out it's really bad at it, since with many constraints the set intersection for each potential assignment often becomes empty, and adding some shuffling algorithms didn't help enough.
Then I reluctantly switched to hierarchical or sequential assignment — for example, start with assigning demands only their planes somehow uniformly, then solve for the other variables keeping the plane assignment fixed. If the plane assignment made the problem unsatisfiable, too bad. But actually, with correct constraints each stage can be guaranteed satisfiable except for certain input parameters.
The final sequence I've used is planes $$$\rightarrow$$$ spines $$$\rightarrow$$$ OXCs $$$\rightarrow$$$ SO links.
Plane assignment must satisfy that each leaf-plane combination is used at most $$$S/P$$$ times, with the guarantee that each leaf degree in the leaf-leaf multigraph is at most $$$S$$$. For even $$$S/P$$$ such an assignment can always be constructed using Euler circuit and bipartite perfect matching, for odd it may not exist, for example when $$$S=P$$$ and demands create a triangle between leaves. This is why testcase 5 query 1 is impossible to solve with $$$max\underline{{ }}conflict=1$$$. For the AC algorithm this stage limits each demand-plane assignment with two constraints, and at least two links always exist from each unsatisfied demand.
Spine assignment must satisfy separately for each plane that each leaf-spine combination is used at most once, with the guarantee that each leaf degree in the leaf-leaf multigraph is at most $$$S/P$$$. It is trivial to solve by processing demands sequentially and assigning them any available spine at each demand endpoint, but since we'll need to optimize OXC adjustment cost and provide certain guarantees for the next stage, I've used the AC algorithm again. Considering even $$$S/P$$$, it is desirable for this stage to create a bipartite graph between spines, for example by forcing different parity of the spines at the two ends of each demand, or even forcing the spine indices to always differ exactly in the lowest bit. Such an assignment always exists by the same argument and the problem structure for the AC algorithm choosing a pair of spines to assign is also the same.
OXC assigment must satisfy separately for each plane that each spine-OXC combination is used at most $$$K$$$ times, with the guarantee that each spine degree in the spine-spine multigraph is at most $$$L$$$. Again it's the same problem. For even $$$K$$$ a solution always exists. For odd $$$K$$$ a solution may not exist, but if $$$S/P$$$ is even, the previous stage guaranteed the existence of a solution by enforcing bipartiteness. The only case left is covered by tests only in the first test case, for which this stage can certainly manage colouring two parallel edges in two colours.
SO link assignment is trivial to solve by processing demands sequentially, and even trivial to solve optimally for the OXC adjustment cost by selecting only no-adjustment assignments in the first pass and the rest in the second.
To incorporate the OXC adjustment cost into the algorithm, for each stage I defined an objective. The first stage minimizes the sum of absolute differences between the number of plane-group-group assignments in this query and the previous one. The second and the third do the same for plane-group-spine-group-spine and plane-OXC-group-spine-group-spine respectively. Then the AC algorithm can track the change of objective with each assignment/unassignment. The fastest modification is to order the immediate assignments $$$l \leftarrow r$$$ and reassignments $$$l' \not\leftarrow r, l \leftarrow r$$$ by the objective change. The slowest modification is to replace the recursive Kuhn-like implementation with an iterative Dijkstra-like implementation with negative edges without any visited masks, potentially allowing each $$$l$$$ to be revisited with lower and lower path cost again and again, even several times in a single chain, with exponential complexity worst case. I've used the latter everywhere, it turns out to be fast enough in practice.
That's it for the general $$$max\underline{{ }}conflict=1$$$ solution. If $$$S=P$$$ and plane assignment fails, I've used the same stages, but modified the objective of the first to also minimize the number of 2-demand buckets group-group-plane assignments can be merged into (to minimize the number of un-paired demands for $$$max\underline{{ }}conflict=2$$$), merged pairs of demands into one, skipped the spine stage, expanded pairs after the SO stage. This reduces the number of used OXC connections close to twice.
The remaining part of the solution handles the $$$max\underline{{ }}conflict=\frac{LP}{MK}+1$$$ case. In pretests $$$max\underline{{ }}conflict=\frac{LP}{MK} \gt 1$$$ was impossible, so I've focused on using less OXC connections and reusing the old ones with fixed $$$max\underline{{ }}conflict=\frac{LP}{MK}+1$$$. This part is also split into two stages.
Allocate the OXC connections minimizing the adjustment cost but providing sufficient group-group bandwidth. All the possible connections are partitioned into group-group cliques for each plane, OXC, spine, SO link index tuple. Each clique can provide a perfect matching. The point of this partition is to limit how badly a new connection can break the old ones. Then the group pairs are ordered by demand/bandwidth ratio in priority queues. Pairs allowing a connection reuse are biased to be selected earlier than pairs with somewhat higher ratio. As long as any pair has insufficient bandwidth and can reuse a connection, connection reuse is forced. If a group has sufficient bandwidth and can not reuse a connection, it is ignored. If the only way to satisfy a pair with insufficient bandwidth is to ignore the clique partitioning, it is done as a last resort. Sometimes the reuse prioritization is too aggressive and doesn't let some bandwidth requirements to be satisfied, for these rare cases there is a fallback with a less aggressive prioritization. I've tried to replace this stage with the AC algorithm as well, but didn't have enough time to develop it to comparable performance.
Assign demands the allocated group-group connections while satisfying the $$$max\underline{{ }}conflict$$$ constraint using the AC algorithm with no objective. There are 3 constraints limiting a demand-connection assignment, but 2 of them are pretty weak since leaf-spine connections are sparse, so it mostly achieves perfect saturation of the group-group connections.
Regarding the augmenting chain idea, here is a complementary in this comment: https://codeforces.com/blog/entry/148541?#comment-1349945 . In the paper we also did some rigorous proof around it using graph theory knowledge :)
14th place
I wrote an algorithm that always find a solution with $$$MFC=1$$$ (maximum flow conflict) when $$$CR=1$$$ (convergence ratio) in two cases. Either when $$$(S/P)$$$ is even (tests 2,3,4,6,8,9,10,11) or when $$$K=2$$$ and the graph of flows between leaves is bipartite (tests 5 and 7, excepts first querry of 5 where the graph is not bipartite).
The idea will be to create $$$S/2$$$ pairs of spines ($$$s$$$, $$$s+1$$$) belonging to the same plane. For each flow between two leaves, we will create a connection from the spine $$$s$$$ to the spine $$$s+1$$$.
To do so, we first use the fact that each leaf appears in at most $$$S$$$ flows. Let's denote by $$$G$$$ the unoriented graph of flows between leaves. Each node of this graph is at most degree $$$S$$$. So it's possible to orient the edges of this graph in order to obtain a graph $$$G'$$$ with $$$\text{in_deg}(v) \leq S/2$$$ and $$$\text{out_deg}(v) \leq S/2$$$ for every vertex $$$v$$$ of $$$G'$$$. To do so one can add a new vertex $$$v_{odd}$$$ to $$$G$$$, then connect all vertices of $$$G$$$ whose degree is odd to $$$v_{odd}$$$, and then compute an eulerian cycle inside this new graph. The cycle can then be oriented, and we use this orientation for the construction of $$$G'$$$.
Now that we have an oriented graph of flows $$$G'$$$ with $$$\text{in_deg}(v) \leq S/2$$$ and $$$\text{out_deg}(v) \leq S/2$$$ for every vertex. We can now create a bipartite graph $$$B = X \cup Y$$$ where each side $$$X$$$ and $$$Y$$$ contains $$$N \cdot L$$$ vertices. One vertex $$$x_{g,l}$$$ in $$$X$$$ ($$$y_{g,l}$$$ in $$$Y$$$) for each leaf $$$(g,l)$$$. For each oriented flow $$$(g_A, l_A) \rightarrow (g_B, l_B)$$$ of $$$G'$$$ we add an edge between $$$x_{g_A, l_A}$$$ and $$$y_{g_B, l_B}$$$. Thus $$$deg(x_{g,l}) = \text{out_deg}((g,l)) \leq S/2$$$ and $$$deg(y_{g,l}) = \text{in_deg}((g,l)) \leq S/2$$$. Such a bipartite graph can be partitioned in $$$S/2$$$ maximum matching.
Each of the $$$S/2$$$ maximum matchings $$$M$$$ corresponds to a collection of oriented flows assigned to a pair of spines ($$$s$$$, $$$s+1$$$). In fact, as $$$M$$$ is a mathching of $$$B$$$, each leaf appears at most one time as the origin of a flow and at most one time as the destination of flow. So each leaf will be connected at most one time to the spine $$$s$$$ and at most one time to the spine $$$s+1$$$.
Now we only need to create the connections inside the OXCs of the plane. To do so, we create a new bipartite graph $$$B' = U \cup V$$$ where each side $$$U$$$ and $$$V$$$ contains $$$N$$$ vertices, one for each group. Vertices are named $$$u_g$$$ and $$$v_g$$$ for each group $$$g \leq N$$$. For each oriented flow $$$(g_A, l_A) \rightarrow (g_B, l_B)$$$ in $$$M$$$, we add an edge between $$$u_{g_A}$$$ and $$$v_{g_B}$$$. It can be verified that $$$deg(u_g) \leq L$$$ and $$$deg(v_g) \leq L$$$ for each group $$$g$$$. This is because each group has $$$L$$$ leaves and each leaf appears at most one time. Then $$$B'$$$ can be partitioned in $$$L$$$ maximum matchings. Each matching $$$M'$$$ computed corresponds to a set of oriented flows assigned to one of the M/P OXCs of the plane using one of the K indices of links spine-OXC. This works because when $$$CR=1$$$, we have $$$L = (M/P)*K$$$. The corresponding OXC and link index are $$$m_{M'}$$$ and $$$k_{M'}$$$.
Finally, we map each oriented flow $$$(g_A, l_A) \rightarrow (g_B, l_B)$$$ in $$$M$$$ to one of the edges $$$(u_{g_A})-(v_{g_B})$$$. This last edge belongs to a matching $$$M'$$$ such that we can connect the two leaves of this flow using the OXC $$$m_{M'}$$$ between the ports $$$(g_A, s, k_{M'})$$$ and $$$(g_B, s+1, k_{M'})$$$. As $$$M'$$$ is a matching of $$$B'$$$ we now have a solution with $$$MFC=1$$$ as each port is used at most one time.
In that case, each flow is assigned to one spine.
To do so, we use the fact the graph of flows $$$G$$$ is bipartite. Each node of $$$G$$$ has degree at most $$$S$$$, so we can partition $$$G$$$ in $$$S$$$ maximum matchings. Each maximum matching $$$M$$$ corresponds to a set of flows that can be assigned to a single spine $$$s$$$ as each leaf appears at most one time.
For each matching $$$M$$$, we now need to setup the connection of the OXCs belonging the plane of $$$s$$$. We will make connections between ports with link index $$$k=0$$$ and $$$k=1$$$. For this, we create a new graph $$$G'$$$ with $$$N$$$ vertices. One vertex $$$v_g$$$ for each group. For each flow $$$(g_A, l_A) - (g_B, l_B)$$$ in $$$M$$$, we add an edge $$$v_{g_A} - v_{g_B}$$$ in $$$G'$$$. As each group has $$$L$$$ leaves and each leaf appears at most one time in $$$M$$$, $$$deg(v) \leq L$$$ for each vertex $$$v$$$ in $$$G'$$$. We can then orient the edges of $$$G'$$$ in order to obtain a new graph $$$H$$$ with $$$\text{in_deg}(v) \leq L/2$$$ and $$$\text{out_deg}(v) \leq L/2$$$ for each vertex $$$v$$$ in $$$H$$$.
We now create a bipartite graph $$$B = X \cup Y$$$ where each side $$$X$$$ and $$$Y$$$ contains $$$N$$$ vertices, one for each group. For each oriented arc $$$g_A \rightarrow g_B$$$ in $$$H$$$, we add an edge $$$x_{g_A} - y_{g_B}$$$ in $$$B$$$. Vertices of $$$B$$$ have at most degree $$$L/2$$$, so $$$B$$$ can be partitioned in $$$L/2$$$ maximum matchings. As $$$CR=1$$$, we have $$$L = (M/P)*K$$$, and since $$$K=2$$$, we have $$$M/P=L/2$$$. Thus each mathching $$$M'$$$ in $$$B$$$ can be assigned to $$$m_{M'}$$$, one of the OXC of the plane.
Finally, we map each oriented flow $$$(g_A,l_A)-(g_B,l_B)$$$ in M to one of the edges $$$x_{g_A} - y_{g_B}$$$. This last edge belongs to a matching M′ such that we can connect the two leaves of this flow using the OXC $$$m_{M'}$$$ between the ports $$$(g_A,s,0)$$$ and $$$(g_B,s,1)$$$. As M′ is a matching of B we now have a solution with MFC=1 as each port is used at most one time.
I finished 124th overall. I realised that my approach was more heuristic and yours more structural. What would you recommend training specifically to start seeing these types of constructions before rather than after coding?
So how I went to this algorithm?
I first looked at the best scores in the ranking and realized it could only be achieved with MFC=1 on the tests with CR=1. Knowing the value of Q, I knew we had to use almost all connections inside OXCs, and reaching MFC=1 appeared very complicated to me. So I thought either there is something inside the inputs or there is a constructive algorithm that always find a solution. I deeply looked in testcases 4 and 5. I saw that except in the first querry of both test, the graph of flow was bipartite. I understood it could be useful to share the flows among the spines. Then I only had to find a way to correctly setup OXCs for each spine. I couldn't find anything, and more, I had no guarantee it could be feasible. Then I realized that I was not using the fact that K could be 2 or that their could be several spines per plane. I then deeply thoughts about how it could be used. And only then, I realized that I could construct new bipartite graphs and use matchings again either between different link indices $$$k$$$, or between spines in the same plane.
Subject: Clarification regarding similarity warning — submission 357317276 (Problem 2177A)
Dear Codeforces Administration,
I am reaching out about the "significantly coincides" notice related to my submission 357317276 for Problem 2177A. I want to affirm that I composed my solution on my own and did not replicate any code from other participants.
This task is a well-defined optimization and graph-theory challenge, and the constraints inherently lead numerous solvers to utilize a limited collection of traditional methods. Consequently, independently developed solutions may appear alike at a structural level, particularly when they apply the same standard algorithms.
• Edmonds' Blossom algorithm (general graph matching), which builds factorization-style steps and perfect matchings. Because the algorithm is very specific, many implementations use almost the same data structures and control flow. • For an assignment step (minimizing the difference between current and previous configurations), the Hungarian/Kuhn-Munkres algorithm (assignment/minimum-cost perfect matching in bipartite graphs) is employed. Standard O(n^3) Hungarian implementations have a very familiar structure and usually employ the same primal-dual/potential arrays.
Algorithmic convergence because of the mathematical nature of the problem By reusing prior OXC connections, the problem seeks to minimize both maximum conflict and an edit-distance-style "adjustment cost." This goal tends to compel matching/decomposition approaches as well as deterministic constructions like regular-graph factorization concepts and Euler-tour style edge partitioning in certain situations. Independent solutions frequently converge on similar decomposition + assignment pipelines because these are common, mathematically constrained building blocks.
Adherence and absence of public disclosure I am aware of the guidelines and the warning that even inadvertent leakage—such as using public paste services with default public settings—is prohibited. During the competition, I didn't purposefully publish or distribute my solution.
I can offer proof of independent development, such as local timestamps, and incremental versions, if that would be useful. I humbly ask that this case be reviewed manually, and I would be pleased to supply any more details that may be required.
source Link which I review and take help- https://codeforces.com/blog/entry/92339
https://cp-algorithms.com/graph/hungarian-algorithm.html
https://github.com/kth-competitive-programming/kactl/blob/main/content/graph/WeightedMatching.h
https://en.wikipedia.org/wiki/2-factor_theorem
https://codeforces.com/blog/entry/8790
Sincerely, Jigyasu
Thanks to organizers for the contest. Is it true that this time there will be no T-Shirts as prices?
Why did my points become zero? On the contest ending day, my score was around 115k points. For Problem A – OXC Ports Arrangement Problem, my submission shows:“Submission has been skipped (ignored) by Vladosiya” Because of this, I’m not getting any points and it shows 0 points now. Could someone please explain why this happened?
Will the problem be available to upsolving post contest (I am unable to resubmit after the contest is over)?
When will the final rankings for the retest be released?
My previous account 'Komimi' was disabled during the contest. This is my sixth time participating in the icpc challenge. I sent a message to MikeMirzayanov and ICPCNews, but neither of them have replied. I started on the 15th day of the competition and submitted a total of 100 times in the last two days. That was all I did. Yet, three hours before the end of the competition, my account was disabled. This account was registered later.
Hi guys. I am (broadly speaking) one of the problem setters. I provided the baseline algorithm of the 1:1 case for this problem as well as the Huawei internal software of OXC port arrangement :)
I would like to share with you our work: https://arxiv.org/abs/2507.12265 which solves the 2-layer problem with the idea of replacement chain/augmenting chain. We are pleased to see that most of the top participants have used similar ideas. This problem involves a 3-layer network, so you will need some extra processing, but the algorithm itself can be used directly as a subproblem solver.
It should be noted that the data in this problem is a bit weak mainly because the problem preparer middle_aged_man was about to leave Huawei and therefore did not polish the data enough lol, some of the solutions are not perfect/polished enough in the case of more complex/real data, even the top-ranked ones, but they are suitable enough for this problem. Therefore we recommend you to learn the well-polished full version in our work.
Aside from the lengthy background story and motivation, the paper is very interesting, so we recommend you read it, and we welcome any suggestions for improvement :)
Has the prize money been delivered? I entered the delivery address..
I misspelled my email in the contact info (.cokm instead of .com) :Face with Peeking Eye: Is it possible to resend the reward email
I haven't received any information either, even though the address is correct. I don't understand whether this is because I'm in Russia or if no one has received anything yet.
My friend is also from Jordan, and he received an email, so I double-checked my info, and indeed it was incorrect, and I am not sure who to contact, so I sent it here.
I don't see in the post anything that excludes winners from Russia. Did you check junk/spam? Maybe it was lost somewhere there
Well this is the mail I used to contact the Huawei team in both challenges in December 2025: [email protected]
They said that if you need to check or ask anything, just sent them a mail. If you can't reply to their mail in time, they will send you back a mail to claim the prize in early April due to changes in currency rate.
Thanks for the replies, I'll try emailing them myself. The email wasn't in my spam or inbox. The address is correct.
It's okay, they will send you back a letter to correct your info. If you can't reply in time, they will get in touch with you back in early April. No problem!
I got the email, thanks!