Comments

Isn't it a big gamble to focus in NOI and ignore school? NOI gold is pretty competitive and hard, rather than getting into NOI itself from local competitions.

IQ is a lie, Education is the truth, Practice is the source, Community is the goat.

Already supported by Polygon, but only for C++ and Python. It needs to be supported their at least for Java and Rust before you see it in public contests.

Number 3 is automatically done by G++ compiler (I'm not sure if it needs -O2, but it is done automatically by Codeforces)

G++ is smart and makes any modulo by a constant value much faster in compile time.

Check how does it usually in https://godbolt.org/

On aa2 → I need a job., 13 months ago
+12

Heeeeell nah. if arvindf saying this then what about us the newbies.

On mariza_CY → Balkan OI 2025 teams, 13 months ago
0

Do you have the tasks?

Well, I discussed this with GPTs most of the time, and they provided me the reference websites.

Some Codeforces blogs and Reddits discussed this:

You can easily conclude that all top 10 countries have a national olympiad and have a good team selection method.

The way I see it to make progress is by encouraging participation in olympiads, like:

  • Money prizes (9 countries out of the top 10 does it)
  • University admission (10/10)
  • National Olympiads (10/10)
  • Training camps (10/10)

And it depends on those 4 things how good are they provided.

On RyenCF → CP Language Tierlist, 14 months ago
+10

You know tierlist is cooked when Python is better than C

reasonable, license-based middle ground

If it's cost was higher than the cost of bots/IPs/servers, then it won't prevent

On mariza_CY → JBOI 2025 teams, 18 months ago
+4

What is the website for this year?

It shouldn't recommend problems which have *special problem tag.

It recommended for me these problems: 530A, 130E, 130C.

Link doesn't work, put the invitation link

+1

Sul_A. is the goat

On SYCu → A little Data Structure problem, 19 months ago
0

You can do it in $$$O(n \cdot \log{n})$$$ offline. you only need rollbacks (in this case you just save maximums along with a trie), and you can add offline deletion.

I wish this isn't an April fool

This IOI will be an easy 4 golds for Saudi team :)

On Mousa_Aboubaker → NAOI 2025 Teams, 19 months ago
+4

It would be good to put the official link in the blog: https://naoi2025.algerianoi.com/teams

Saudi Arabia team (identical to BOI 2024):

  • Emad Alharbi (emad234) — 1st time at NAOI, 0 attempts left
  • Mohammed Alasmari (m5588ohammed) — 1st time at NAOI, 1 attempts left
  • Saad Alarifi (Erering) — 1st time at NAOI, 2 attempts left
  • Sultan Alaiban (Sul_A.) — 1st time at NAOI, 1 attempts left
  • Muaath Alqarni (Muaath_5) — 1st time at NAOI, 0 attempts left
  • Mohammad Bashkail (mohammadyay) — 1st time at NAOI, 2 attempts left

Average of max ratings: 1541.5

On Muaath_5 → IMO website is down, 20 months ago
0

I don't know their official email or any website related, if you know tell me.

On Hostek → Help wanted: Wavelet tree, 20 months ago
+29

You can do it using presistent segment tree.

Don't you think this ruins the competition on CSES? because this is the point of CSES

On .Habiba. → Teens Ramadan Marathon 2025., 20 months ago
0

Every Discord invite is expired, can you send an invite that works for infinite amount of people and no expiration date?

On Kanata18 → Combinatorics problem, 22 months ago
0

This problem is the exact same as CSES — Permutations II, although the constraints are $$$n \leq 5000$$$.

Note, this task could be solved in $$$O(n)$$$, you can check it on USACO Guide — Solution

On NemanjaSo2005 → I Reached GM!, 22 months ago
+8

Congrats, hope you the best

On ultraraze → Magical Panda Tree, 22 months ago
0

Sorry, I assumed that it is a full binary tree (either 2 children or 0).

Here is another observation that will solve the problem: For every vertex, all of its adjacent must be in opposite color, otherwise it's not a Magical Panda Tree

If this condition is satisfied, then you can put the root at any vertex that has degree 2.

On ultraraze → Magical Panda Tree, 22 months ago
+5

First, you need to ensure that it is a binary tree.

Any tree such that there exists: - Exactly one node with degree 2 - All other nodes are of either degree 3 or 1

If it was the case, then you found the root.

Now your goal to determine if it's a Magical Panda Tree or not, you can do it using DFS/BFS.

On genesis → DP on Tree with Prefix sum, 22 months ago
0

Well, you can handle this it using your old DP definition.

Here is my submission

On genesis → DP on Tree with Prefix sum, 22 months ago
0

Thanks I was wrong, I'll update it

On genesis → DP on Tree with Prefix sum, 22 months ago
+1

First, you can construct a directed graph consisting of $$$n$$$ edges $$$i \rightarrow A_i$$$ (known as sunflower graph).

The sunflower would look like a cycle and some trees from other nodes.

Example image

Compress the cycle to be a single node and make it the root, so it will become a normal tree.

Now you can do $$$O(N^2)$$$ DP like this:

$$$dp(i, j) = $$$ How many ways to assign numbers to subtree $$$i$$$, such that the assigned number is $$$j$$$.

The formula: $$$dp(i, j) = \prod\limits_{c \in adj(i)}{ \sum\limits_{v = 1}^{v \le j} {dp(c, v)} }$$$

This is called Strongly Connected Components (SCC).

You can check some resources: USACO Guide, CP-Algorithms

You need to store the answer for every node after finishing, here what I would modify:

Code

Thanks for the correction

This code seems to be for problem CSES — Distinct Colors.

If you did small to large, the complexity would be $$$O(n \cdot \log{(n)}^2)$$$, but this code is $$$O(n^2)$$$

Isn't this just Suffix Array?

Yes, it can be done.

Write the grader in resources section then select it as grader for *.py files at runtime

Here is another source mentions this technique:

https://robert1003.github.io/2020/02/14/graphs-and-segment-tree.html

On 0xF1 → IOI 2024 predictions, 2 years ago
0

Saudi Arabia Team:

Max:

  • Adeeb: Silver
  • Ahmad: Silver
  • Essa: Silver
  • Saad: Bronze

It's better to use mt19937 instead of rand()

Read this blog for more

On carcinisation → IOI 2024 Teams, 2 years ago
+33

Saudi Arabia's team:

  • Adeeb Alshehry (Saudi) — 3rd time at IOI, 0 attempts left
  • Ahmad Alhashim (vahmad) — 1st time at IOI, 0 attempts left
  • Essa Almousa (Essa2006) — 2nd time at IOI, 0 attempts left
  • Saad Alarifi (Erering) — 1st time at IOI, 3 attempts left
+8

When will every country participated and I can discuss problems?

Amazing, can you also upload it on Firefox?

This problem already exists in Codeforces (Div.1 — B — Xor Pyramid), and here is my solution:

Do a range dp, where $$$pyr(l, r)$$$ is the value of the head of the pyramid if we considered range $$$[l, r]$$$.

$$$pyr(l, r) = pyr(l, r-1) \oplus pyr(l+1, r)$$$

And you can create another DP where you calculate the maximum:

$$$dp(l, r) = max(dp(l, r-1), dp(l+1, r), pyr(l, r))$$$

You're right, it might be because of random-access and you are defining vectors inside the function (i.e. heap/stack thing).

But I don't think so because I resubmitted with defining in global and no difference.

I guess it's a compiler optimization

In your code if $$$g[i][j]$$$ is false, it won't do anything in the loop.

I guess GCC adds if (!g[i][j]) break; to the end of line 19

On aqua4 → CF tool CP Editor Edition, 3 years ago
0

Does it work when submitting problems on groups/private mashups?

+1

I think you solution is something like this:

Let's sort points, then do this DP:

$$$dp(i, msk) =$$$ Maximum number of points $$$\leq p_i$$$, where $$$msk$$$ is a bitmask of used segments.

$$$dp(i, msk) = min(dp(i-1, msk), dp(lowerbound(i-sz_j), msk \oplus 2^j))$$$

As a participant you hacked, I wanted to say that probably many people know that their hashes are weak.

I was actually speed coding this problem in last 9 minutes & I managed to get it accepted.

The only thing that I thought it could defend my hash is randomized base, but it also got hacked because you can submit too many testcases with some range of bases you try to hack + I used a bad random srand(time(0)), I should've used double hash.

I believe this is a good lesson :)

On Zenitsiuuu → IATI 2024 Discussion, 3 years ago
+8

Is there a mirror/virtual where I can submit?

On tbquan08hanoi → Substring Reversal, 3 years ago
+8

I found this code which solves CSES — Subtring Reversals using some kind of sqrt blocking

On bashkort → IOI 2023 Predictions, 3 years ago
0

Essa2006, MrDeboo, heqr, three bronze medals for Saudi Arabia

On FO7 → Wonderful DP problem, 3 years ago
0

Sorry, I misunderstood, edited it

On FO7 → Wonderful DP problem, 3 years ago
0

Longest subsequence with at most $$$k$$$ non-equalling elements?

$$$dp_{i,p,j} = $$$ Longest subsequence with $$$k$$$ non-equalling elements, ending with element $$$p$$$

$$$dp_{i,p,j} = max(dp_{i,p,j}, dp_{i-1,p,j})$$$

$$$dp_{i,a_i,j} = max(dp_{i,a_i,j}, dp_{i-1,p,j-(a_i \neq p)}+1))$$$

Time Complexity: $$$O(n^3)$$$

Memory Complexity: can be optimized to be $$$O(n^2)$$$, probably $$$O(n)$$$

Yes, I solved it using Parallel Binary Search, it's really similar to Stamp Rally.

Can you explain your idea? or send your code?

Accepted Code: https://cses.fi/paste/bfe897265843ddb05a70d4/

USACO Guide is a really good resource that contains explainations, videos, problems, and solutions.

These tasks also solvable using Parallel Binary Search:

Auto comment: topic has been updated by Muaath_5 (previous revision, new revision, compare).

On Zlobober → Checkers with testlib.h, 4 years ago
-16

What should I put in the checker in intractive problems?

The intractor is enough in my case.