Hello, Codeforces!
We are glad to invite you to take part in Spectral::Cup 2026 Round 1 (Codeforces Round 1094, Div. 1 + Div. 2), which will start on 25.04.2026 17:35 (Московское время). You will be given 8 problems and 2.5 hours to solve them. This round will be combined for Division 1 and Division 2 and will be rated for everyone. At least one problem will be interactive, so please make sure to read the guide for interactive problems before the contest.
All problems are authored by lizhous, Lyz09, ma2021tyoi0037, hzy_____ and me.
We would like to thank the following people for making this round possible:
- Um_nik for pre-reviewing the round.
- Error_Yuan for the coordination and helping with preparation.
- Alexdat2000 for Russian translation.
- Rebex for providing some rejected problems and preparing some problems.
- _Diu_ and zltzlt for International Grandmaster Testing.
- Qwerty1232, _istil and SunsetGlow95 for Grandmaster Testing.
- Arpa for Master Testing.
- teruel, SpyrosAliv and Mahmoud-Atia for Candidate Master Testing.
- Enzinho, JuanJr for Expert Testing.
- nik_exists for Specialist Testing.
- khanter_ for Pupil Testing.
- You for participating the round.
- MikeMirzayanov and KAN for Codeforces and Polygon systems.
The scoring distribution is $$$500$$$ — $$$1250$$$ — $$$1500$$$ — $$$2000$$$ — $$$2250$$$ — $$$3000$$$ — $$$3500$$$ — $$$4000$$$.
UPD: Congratulations to the winners!
UPD: The editorial is out!
Now a few words from our sponsor.
Spectral::Technologies is an HFT fund – we build trading strategies and low-latency infrastructure for global markets. The people doing this: IMO, IOI, IPhO and All-Russian Olympiad medalists and top engineers – people who love the challenge and always want a bigger one. That's who Spectral was built for.
We are actively hiring! Check out our Quant roles:
- Junior Quant – 150–180k USD + profit sharing
- Middle Quant – 240–320k USD + profit sharing
- Senior Quant – 360–500k USD + profit sharing
We’re also hiring for C++, ML, and DevOps roles. Complete the application form to explore career opportunities with us.
We are excited to sponsor this Round as part of Spectral::Cup 2026 — a three-round tournament where prizes get more valuable with every round.
Prizes for Round 1:
Top 30 will get merch bags with stickers and personalized t-shirts.
Make sure that you take part in all three rounds to improve your chances to get the main prizes. We prepared bigger prizes for top performers by their final score in Spectral::Cup 2026. The final score is the sum of your best 2 results according to the GP500.
- Top-3 by final score will get (1st) MacBook Pro, (2nd) iPad Pro, (3rd) Whoop — or USDT equivalent to the prize value
- Top-15 by final score will get Claude subscription
- 30 random participants among top 500 based on the final score will get additional prizes
Code fast, think faster – see you in the next round of Spectral::Cup 2026!








Auto comment: topic has been updated by CutieSmileHaruka (previous revision, new revision, compare).
Please do not leak the problem statements like Tsinghua University did...
Also, please do not allow any time travellers to leak problem solutions like April Fools contest did...
Seems pretty well-prepared. Hope this doesn't get leaked and unrated!
Why reject my awesome problems :(
As a tester, please be kind to me because my rating is not 1300.
I really hope this turns out to be a good contest :/
Look interesting! I hope the contest will be well-prepared with complicated and engaged problems.
But I have several questions about job offer: in the post we can see salaries, but I do not understand the final amount of money Quant will have after taxes per month (because it is strongly depended on office location and payments mechanism: fix per month salary or result-dependent bonus)?
The second crucial question: how many hours Quant have to work per day to perform well for the expected reward?
Hey, thanks for the questions!
On compensation: the final take-home does depend on office location and local taxes, but the range in the post can actually be your net, since we also hire in 0% income tax jurisdictions (and fully sponsor the relocation).
On top of that fix, there's a profit-share bonus — it comes in addition to the range, not inside it.
Location is best discussed with our recruiters directly, since it depends both on the position and the candidate.
On how much a Quant needs to work to get that amount: 1) the range you see in the vacancy is fully fixed; 2) we pay bonuses for results, not hours. But we've checked today with the team, and our Quants work 40-45 hours per week = 8-9 hours per day :)
Thank you so much for the answers! Is it possible to contact with some of Quants from you company?
Sure! We'll DM you to arrange
Good luck & Have fun~
As a fan of CutieSmileHaruka, please be kind to me cuz my codeforces rating is only 1400
I'll be unkind to you because your NOI score is not 568
Hope this contest doesn't get leaked and unrated!
Can I reach GM this time? @_@
last time I got hacked because hash and lost GM. T_T
Good luck everyone!
Do you actually hate people with cyan color???
yes
At least they should now add you there...
As a stupid tester, hope you‘ll have fun with those tasty tasks. QwQ
Auto comment: topic has been updated by CutieSmileHaruka (previous revision, new revision, compare).
Keep it up my brother and coach Mahmoud-Atia <3
as a tester (who tested after the blog post was posted), idk what to write but the round is pretty nice
Are there any interactive problems or run-twice problems?
It seems that the blog hasn't mentioned...
can you please explain C
The solution is clearly based on dynamic programming.
At first, I used my standard median-maintenance template, but its time complexity was $$$O(n^2 \log n)$$$ , which was too slow.
Then I noticed that after coordinate compression, the maximum value is small, less than 5000, so I rewrote the median part using a frequency array.
The key observation is that the median of any subarray must be one of the values appearing in the original array, so we only need to consider those values.
Nice observation!
Sorry, the meaning of the observation has changed when translating into English.
It's the median of any subarray must be the median of the array.
I see your accepted code, but I think it's $$$O(n^3)$$$. Because in you rewroted part median can jump from $$$1$$$ to $$$n$$$ and back.
In input: $$$1, n, n, 1, 1, n, n, ..., 1, 1, 2, 3, ..., n-1$$$.
There are $$$n$$$ switching blocks: $$$1, 1$$$ and $$$n,n$$$. At the end numbers from $$$2$$$ to $$$n-1$$$ for anti coordinate compress. Total length: $$$1 + 2 \cdot n + (n-2) = 3 n -1$$$.
If we start median-maintenance from index $$$0$$$ then: median for subarray $$$[1]$$$ is $$$1$$$, for $$$[1, n, n]$$$ is $$$n$$$, for $$$[1, n, n, 1, 1]$$$ is $$$1$$$ and so on. In your code this median switching needs $$$n$$$ iterations in frequency array. In total we have $$$n$$$ blocks ($$$1, 1$$$ and $$$n,n$$$).
So start from index $$$0$$$ require $$$n^2$$$ iterations in frequency array. Same with indexes $$$2, 4, 6, ...$$$ . So total operations: $$$n^2 + (n^2-n) + (n^2-2n) + ... = O(n^3)$$$.
Unfortunately, I not found hack-button so can not to check.
Thank you for your advice, but I think the example is wrong?
After I compressed the array, the elements should be $$$1,m,m,1,\ldots,1,2,3,\ldots,m-1$$$ , when $$$m$$$ is the size of the array after unique.
Btw, there is a hacking button in my submission. If you clicked into my submission, you can see it:)
I think the concern comes from assuming the median jumps arbitrarily each time.
However, since we use a frequency array over a compressed value range (≤ 5000), the median pointer does not reset and scan the whole range every time. It moves incrementally based on frequency changes, so across all transitions its total movement is bounded.
Because of this amortization, the total complexity does not blow up to O(n 3 ), but stays within acceptable limits.
a
Top 15 might already have Claude subscription ;)
wow
Could you elaborate on the exact method to combine two results? For example, when person X gets 1st and 3rd and person Y gets 2nd and 2nd, which one would be considered better?
dw
Hi, The final score is the sum of your best 2 results according to the GP100 scores.
This contest has a lot of cheaters.
Update:I was wrong. It turns out there are a lot of excellent specialists here who monitor this. Thank you so much for not allowing cheaters into the contest.
GKarthik26 is a heavy cheater as he switches between multiple programming languages during the contest. He became grandmaster in 7 contest only. MikeMirzayanov Ban him.
idontwannadothisanymore is also a cheater as he became grandmaster in 5 contest only.MikeMirzayanov Ban him.
Of course we did notice this account, of course we checked it. I checked it once more, I can't see anything telling this is a cheater and not a strong participant. If you have an actual proof, share it please, what you just said doesn't proof anything.
idontwannadothisanymore and NahIdGetHired submitted almost the same code. The only noticeable changes are variable names and small changes in if-else statements, which seem to be done to evade the plagiarism detection tool. I have attached the proof, and you can also compare both users’ solutions. The logic and structure of their code are highly similar, so I request the contest administrators to review these submissions.
idontwannadothisanymore [submission:https://codeforces.me/contest/2170/submission/351041746]
NahIdGetHired [submission:https://codeforces.me/contest/2170/submission/351033870]
XVIII appears to be a very clever cheater and has allegedly been cheating for the past seven months. One of his previous contest solutions was skipped, which gives strong proof of suspicious activity. He also used multiple programming languages during the contest. After today’s contest, he may become the first cheater to reach LGM in only seven months.MikeMirzayanov Ban him.
Hi, I am That GKarthik26 writing this comment/post from alt account
MikeMirzayanov tagging you here because I genuinely want clarification regarding this accusation and the resulting ban.
Saying that I am a “heavy cheater” simply because I switched between programming languages during contests does not make sense. I mainly use Python and Rust, and I occasionally used C++ earlier depending on the problem and performance constraints. Many competitive programmers use multiple languages.
I also do not understand how using two languages during contests can itself be treated as suspicious, or even be described as “multiple programming languages” in the context used by SherlockHolmes007
Also, several people upvoted the accusation, so I want to ask clearly: what exactly is the proof or justification behind it?
My submissions are public and can be checked directly for plagiarism, suspicious similarities, or AI-generated patterns.
I already had a strong programming background before Codeforces:
I have already sent appeals and tried contacting admins/moderators, but I have not received any clarification yet. I am simply asking for transparency and evidence-based judgment instead of assumptions.
Aaaaaaaaah! I really wanted to participate this contest!!!!! I missed the chance.. oh man!!
ngl i loved it!!!!!
like this was the first time when Problem A was challenging and it took me approx 2 hour to solve it and the movement when it clicked!!!!, the happiness was unimaginable
so thanks developers!!
idk why A works, but it worked on the samples => solution proved
what was your solution??
i used Prime Factorisation and mapping, so pretty much I was sure that it will work
wow.
sort(all(a));
cout << (a.back() == 100 ? "YES" : "NO") << "\n";
Ok, I’m actually interested why do people downvote right solution?
For A you need to check only if the arrays has 100, because there i no other way to the number 1. And with having one 100 you can make all the other.
just think about the last 100 ex if total 800 then 701-800. You can only make those last 100 if you have a[i]=100 in the array.
Also why just one a[i]=100 is sufficient its because it allows 0-100 be formed and then lets say for 101-200 we will make something else 100 by taking it fully and this a[i]=100 to make 101 to 200.
I feel like E is easier than D, though the numbers of submissions tell another story. Anyway my best contest so far and loved the problems
same
I'm so stupid or really need Fenwick (or some uncomfortably link sew for $$$O(n^2)$$$) to solve C?
i used dp
probably first
Nice round.
Unfortunately there was not enough time for writing dynamic connectivity offline for F.
Why is time limit so tight on C? I spent too long trying to optimise it and it will likely still FST.
I spent so much time worrying that $$$O(n^2 logn)$$$ would TLE for C... The TL just doesn't seem like intended for $$$O(n^2 logn)$$$, should be 3 sec.
$$$O(n^2)$$$ is probably intended, I was also doing extra $$$log(n)$$$ untill I realized only possible median is the median of whole array
It was a test for whether or not you know how to optimise constant behind $$$O(n^2\log(n))$$$ asymptotic of your solution. In this problem you can use priority_queue instead of multisets to easily fit into the time limit: 372488797
And if you can't optimize constant, you can go for optimizing asymptotic itself as there are exists $$$O(n ^ 2)$$$ solution.
Yeah I don't like being stuck in the limbo state of either "find the n^2 solution that may or may not exist" or "you just have trash constants on your n^2 log n". I wish time limits were a bit more clear. Like either n=9000 or n=2000.
This feeling must be universal cause I always feel the same when I'm dealing with such tasks.
real
I think they were trying to cut $$$O(n^2\log n)$$$ solutions to force observation
For a C? And if they did the time limit probably should've been much tighter. fishy15 used n^2 log n and passed
Very good contest! I really love D and F!
what was the idea for D?
Check prefix sums. Notice pattern. Test pattern on examples. Sort + print = profit
Forget about finding the best permutation. For a given permutation, what would be the answer?
For an inversion (i, j) where i < j and p[i] > p[j], the contribution of this inversion is prefSum[j-1] — prefSum[i-1]. So let's find out for each index i = 1 to n how many times it will contribute +prefSum[i-1] and how many times -prefSum[i-1].
Let: cntLeftGreater[i] = number of indices j < i with p[j] > p[i] cntRightLesser[i] = number of indices j > i with p[j] < p[i]
Notice that the net coefficient for prefSum[i-1] is exactly (cntLeftGreater[i] — cntRightLesser[i]). This actually simplifies to (i — p[i]).
Why??
1) cntLeftGreater[i] + cntLeftLesser[i] = i — 1
2) p[i] = cntLeftLesser[i] + cntRightLesser[i] + 1
From equation (1), cntLeftLesser[i] = i — 1 — cntLeftGreater[i]
Substitute this into equation (2):
p[i] = (i — 1 — cntLeftGreater[i]) + cntRightLesser[i] + 1
p[i] = i — cntLeftGreater[i] + cntRightLesser[i]
Rearranging the terms gives us exactly what we need: cntLeftGreater[i] — cntRightLesser[i] = i — p[i]
So, the total cost for any given permutation just boils down to: Sum over all i from 1 to n of: prefSum[i-1] * (i — p[i]).
Notice that the prefSum[i-1] * i part of the summation doesn't depend on the permutation. We just have to minimize the summation of p[i] * prefSum[i-1]. To do this, we greedily assign the largest prefSum values to the smallest p values (a consequence of the Rearrangement Inequality).
I spent 2 hours to think E and got WA2. It's still "a wonderful contest".
Why does Order Statistic Tree get TLE on problem C? I don't have template for BIT and it lost me soooo much time, just for the same idea but different implementation
Well i think the intended solution was just a O(n^2) dp. I don't see the need for OST or BIT
Is F some data structure thing? I feel like the round lacks a strong logic problem for a Div1...
Basically the same as offline dynamic connectivity.
You can most likely solve it with dynamic connectivity offline, but it's $$$O(m \cdot \log n \cdot \log m)$$$. I think it's the intended solution but idk
Great problems and great round, but it is quite difficult... I use a long time to solve B and D.
Can somebody explain how to optimize C, my O(n^2*log(n)) solution got TLE on pretest 5.
Median of a subarray has to be the median of the entire array
I already did that in my code.
If you know the median that you're targetting, then you can optimize the OST out of your solution. What conditions must be true for an element to be the median of a subarray?
I switched ordered statistic tree to 2 priority queues and it passed
because log should not be needed and pbds is slow af
You only need to know how many elements are greater and smaller in a subarray to determine the median
Think about how can you track if your current subarray median is same as target median.
You can keep count of elements greater than, less than and equal to your target median.
thanks everyone, due to time crunch, i guess i was too invested in the ost solution to not see that we can find the median by just maintaining a greater and smaller count.
I submitted G at 2:28:44 then got Pretest passed with 2000 / 2000 ms. I think I'm going to get TLE in system test :(
Upd: I was so lucky that the submission passed in 1953 ms! :)
Congratulations for AC!
What was the problem with the interaction protocol in E? I didn't have any as I submitted the solution, as a result I needed to do ~30 submissions all of which had WA1 just to understand what was wrong. Turns out in the beginning we have $$$S = {a}$$$, not $$${f(a)}$$$. My bad guys, we always insert $$$f(x)$$$ but suddenly in the beginning we have the number itself. Without any protocols it was really hard to find, which ruined the contest for me. It was incredibly annoying, considering that I found the first 5 tasks really good.
Yeah, I had a similar issue. In any case, I defaulted to writing a simple interactor and managing it using Golovanov399's system: see here . Even so, took me too long to realize that I have a degenerate neurological condition that makes me interpret >= as <= and didn't have enough time to fix my code
Implementing an interactor myself didn't help me as I just carried that mistake when misreading the statement :(
idk for me it's just sad that some rounds have inconsistencies on which one should count
This might be helpful: link
so true...
Screencast(with audio) of me struggling, but managing to solve A and B.
Does greedily selecting values until it achieves a median of $$$v$$$ (the current value you want the subsegment's median to be) not work? I had a template for sliding window median.
Consider the testcase: 7 7 7 7 5 5 5. If you do what you mentioned, you won't get any valid partition.
Consider the array 3 2 2 1 1 2 2 Now according to your logic your first cut would be at 3 2 2 and now you are left with 1 1 2 2 which wont satisfy our given condition. Optimal solutions is 3 2 2 1 1 || 2 || 2
guesswork D
yeah man, i should have jumped to E.
Why do Chinese always create such garbage questions? Please stop embarrassing us on the international stage, OK?
Which problem is "garbage"? I think you shouldn't call the question bad just because you can't solve it yourself.
C was a great problem, tracing the median value was fun.
can you please explain C
why is F's implementation so hard....
Raise hand who all wasted time in B? I wasted so much time to debug...... only to find i missed case when there are zero operations on either of odd or even indices group
chinese rounds are always so cool and fun to solve, thanks for the beautiful problems.
gptforces
My solution for C can you tell why it didn't worked , i didn't find any solution with this approach.
you can see tc2
your code outputs 1 when it should be 3 (1, 1, 1 1 2)
yeah i see that but why does it happen so ,what break's the code logic
Maybe it makes sense to talk about an elephant in the room. I think I've never noticed anybody resubmitting as often as I do whenever I'm close to the time limit — maybe because in the past usually pretests weren't equal to systests, but also mostly because the execution time fluctuates. So whenever (even assuming pretests = systests from now on) I decided to resubmit something and saw somebody who didn't, getting lower time on systest than on pretests (so having an even bigger safety margin), it felt weird that I'm kind of being punished for being cautious while somebody is being somehow "lucky". And today's situation is particularly interesting — those are my submissions:
The time of the last one increased from around 7.3s to 7.9s — so what, a clutch move with the resubmission? Hard to say — for other people I've seen even times less by 1.7s than during the pretests.
So my point is — this feels kind of like a randomness? I'm not sure where do those differences between the times on pretests and systests come from, but I'm not sure whether it's good and "fair" if we are unable to reason about "what our time during the systests will be".
Huh, I've just noticed this blog. Are you saying (by as it seems, rejudging this guy's submission just like that instead of leaving him with TLE as expected), that every time when I was resubmitting because I was afraid of the time going up and losing points because of that, it was pointless?
According to this blog: " Because of how Codeforces works, when a code gets TLE, it will rerun the code several times to see if the code is on the edge of the time limit. By doing this you increase the chances of your code passing significantly!"
I know this trick, but it already showed him TLE, right? The main loop goes over all tests and if one of them gets TLE, then only this one test is rejudged and the main loop continues, right? This case is like a rejudge of a whole submission after already deciding that it got TLE (or at least I understand it like that).
Also I'm not sure how is it connected with the times changing by more than a second.
Hmm getting a rejudge when you already have a system in place is kinda unfair
C is funny!
Can someone explain why 372483665 this submission for B gets WA when it should be getting RE? As far as i can tell, the only problem is that the code is trying to access elements beyond the size of the vector. This verdict costed me precious time during contest :/
I think undefined behavior isn't guaranteed to give RTE
I used segment tree for C
Can someone tell me why greedy solution failing for the problem C.
Your greedy approach fails because it completely ignores the original order of the array. The problem requires partitioning into contiguous subarrays. By just counting < mid and > mid globally, you assume you can rearrange elements freely, which is incorrect. Instead, you need to map the elements to +1 and -1, compute prefix sums to track the balance, and use DP to find the optimal valid contiguous partitions.
I don't think it was a Div1+Div2, it felt more like Div1 difficulty.
Does O(n^2 log n) pass for problem C in C++? I used a segment tree to calculate medians in logn time over n^2 subarrays.
It worked for me, you can see my submission : https://codeforces.me/contest/2222/submission/372523575
Damn, I guess I'll blame python then lol. Managed to get TLE on test 5,6,7,9 on different submissions.
When is the editorial going to be published?
Failed on Problem C... I thought that it could be simply solved by greedy and then my Expert dream broken...
What's more surprising, I passed E and C quickly after getting up. What a pity...
If you're familiar with bitwise operation and brute force, maybe it seems that E would not be very hard?
Sorry to hear that :( Wish you become expert in the upcoming rounds.
Btw I noticed that the number of problems solved on your accounts is low,so I am curious what website do you use for cp training?
E is a great problem.
My mind during contest they gave En^2<5000^2
me running in my mind 5000^2 *T so n^2 dp doesnt work in C
What a dumbo i am ....
How do you guys usually test/debug for interactive problems? I wasted way too much time on E this time
I want to address the plagiarism flag on my 2222E submission. I coded this myself during the contest and I'll try to explain both why the solutions look similar and where they actually differ.
My submission: - https://codeforces.me/contest/2222/submission/372494337
Mentioned submission: - https://codeforces.me/contest/2222/submission/372508678
First, the similarity in the overall structure is honestly kind of expected for this problem. The query budget is n+3, and recovering c alone requires n queries since it can be any of 2^n-1 values. That leaves exactly 3 queries for everything else, which basically forces every correct solution into the same skeleton: set a=0, probe I 0 to separate k=1 from k=2/3, binary search for c with Q queries, then use the last 2-3 queries to tell OR and XOR apart. There's almost no room to do this differently and stay within budget, so the high-level structure converging is a consequence of the problem's constraints, not copying. The Q binary search loop also looks similar for the same reason. Recovering c bit by bit from the top is just the natural binary search, and there aren't many ways to write it. I'll admit this part of the code looks close between the two submissions, but I don't think that's surprising given how little freedom you have there.
Where I think the solutions clearly differ is the OR/XOR disambiguation, which is actually the part of the problem with real design freedom. My solution and the other one make completely different choices here. I split on whether popcount(c) >= 2. In the general case I take p = c & (-c), the lowest set bit, and issue a single I p. Under OR, f(p) = p|c = c which is already in S so the size stays at 2. Under XOR, f(p) = p^c which clears the lowest bit and gives a new element, so size goes to 3. For the special case where c is a power of 2, I find the bit index with __builtin_ctzll(c), pick an adjacent bit j, form x = c|(1LL<<j), and then issue both I x and Q x, using the Q result to decide.
The other solution splits on whether c == maxval. Their special case issues a hardcoded I 1 and reads the size. Their general case finds bit_in (lowest set bit) and bit_out (lowest unset bit), forms x = (1LL<<bit_in)|(1LL<<bit_out) and a threshold thr = c|(1LL<<bit_out), issues I x then Q thr, and uses the Q result.
These case boundaries don't overlap at all. My special case is exactly powers of 2. Their special case is exactly c = 2^n — 1. A power of 2 is never all-ones for n >= 2, and all-ones never has popcount 1. So for every value of c, the two solutions can take different branches and issue different queries. For example with n=3 and c=6, my solution takes p=2 and issues I 2, while theirs finds bit_in=1 and bit_out=0 and issues I 3 then Q 7. The only case where they happen to issue the same query is c=maxval where both end up doing I 1, but for entirely different reasons from entirely different logic.
I know the k=1 branch looks close too, but honestly that subproblem (probe each bit of an unknown number and accumulate) is about as standard as it gets algorithmically. Two people writing that independently are going to produce similar loops. The small differences are there though: I use a separate cur variable initialized to 1 to track the set size, they reuse the outer s variable. I accumulate with c += (1LL << b), they use c = threshold.
If one of us had actually copied from the other, the disambiguation logic would match since that's the hardest and most original part of the solution. It doesn't. I'm happy to provide anything else that would help review this, and I'm asking for it to be reconsidered.
I recently received a notification claiming my submission was plagiarized, which I believe is incorrect and purely coincidental.
The only common part between my code and the mentioned submissions is the use of prefix sums stored as
{sum, index}and sorting them. This is a very standard approach for this problem, and many independent solutions use the same idea.The rest of my implementation is different. I constructed a graph from the sorted order and applied Kahn’s algorithm to generate the permutation. This step is actually unnecessary, and I later realized it was redundant, but I kept it since my solution was already working.
My submission:
Mentioned submissions:
My solution was written independently, and I don't see any similarity with the other submissions other than the above mentioned part .
I request a re-evaluation.
I want to address the plagiarism flag on 2222D - Permutation Construction. I wrote complete code by myself during the contest. I believe this match is a structural collision caused by the mathematical constraints of the problem and standard C++ idioms, rather than copied code
The core logic of this problem relies on rewriting the inversion sum to calculate the contribution of each position. This naturally reduces the problem to a standard greedy assignment based on prefix sums. Because of this, the most optimal and standard C++ implementation requires a very specific sequence of operations:Computing prefix sums and mapping them to their original indices using {sum,index}.Using sort() on this vector.Greedily assigning values from N down to 1 in a single pass. It is one of the universally taught approach for this kind of problem for greedily assigning the value, as a result I think collision must have happened
My submission:
372509312
Mentioned Submissions:
372502371 372508062
I request a reevaluation.
Maybe it’s just me, but the “note” section of problem C should be fixed. How it renders on my screen for the first example is an underline under [3,3,2] and an underline of [2,4,3], which doesn’t make sense given the answer is 3. The same underline issue exists for the second example.
Is it just chrome impacted and why did nobody complain about this?
Congratulations to the winners of Spectral::Cup 2026 Round 1
You will be contacted via private messages with instructions to receive your prize.
Top-30: