Блог пользователя Diall_

Автор Diall_, история, 18 месяцев назад, По-русски

Привет, codeforces \[^-^]/

На связи лаборатория олимпиадного программирования ИТ-кампуса НЕЙМАРК в Нижнем Новгороде!

Мы рады пригласить вас на Codeforces Round 1013 (Div. 3), который состоится во 25.03.2025 17:35 (Московское время).

Раунд основан на задачах финала первой олимпиады НЕЙМАРК. В олимпиаде приняли участие 312 школьников из 28 субъектов РФ. А на итоговом состязании, кроме нижегородцев мы встретили финалистов из Республики Чувашия, Москвы, Тольятти, Кирова, Саранска и Ульяновска.

Если вы участвовали в финале данной олимпиады — пожалуйста, воздержитесь от официального участия в этом раунде.

Тематика задач будет связана с рабочими буднями и выходными нашей лаборатории. Лаборатория существует чуть меньше года, но за это время было проведено несколько тренировочных сборов, множество личных и командных тренировок, а также разработаны десятки задач на школьные и студенческие соревнования (некоторые из этих соревнований вы можете найти в разделе Тренировки на CodeForces). Мы открыли кружки по программированию в школах Нижнего Новгорода и области, а также начали обучение заинтересованных педагогов-информатиков. Также выступали площадкой проведения нескольких соревнований по программированию.

А во 25.03.2025 17:35 (Московское время) мы, наконец, поделимся с вами одним из важнейших итогов нашей работы.

У вас будет 2 часа и 15 минут на то, чтобы решить 7 задач. Штраф за неверную посылку будет равняться 10 минутам. Раунд будет рейтинговым для участников с рейтингом меньше 1600. Участники с рейтингом 1600 и выше могут зарегистрироваться на раунд вне конкурса. Участники с рейтингом ниже 1600 также могут использовать нерейтинговую регистрацию, чтобы поучаствовать в раунде вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов, после её завершения все успешные попытки будут перетестированы на успешных взломах (мы очень надеемся, что в течение нее упадет не очень много решений).

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того, являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Надеемся, что задачи вам понравятся! Для вас их подготовили сотрудники лаборатории Алексей ashmelev Шмелев, Ислам l-_-l Шаяхметов и Диана Diall_ Алясева.

Мы хотели бы поблагодарить MikeMirzayanov за платформы CodeForces и Polygon, а также Vladosiya за координацию подготовки раунда.

Большое спасибо за тестирование: MForest, OG_Matveychick1, Tmitmi, Riladavin, quaha, eepsilon, anotherworld, konred, NerfThis, gtheoden42, sasha00123, ReshuVse, artem., OG_Sergzhick2, bugrova, Itsmylove1

Желаем всем удачи и восхваляем солнце \[^-^]/

Upd. Разбор задач

  • Проголосовать: нравится
  • +203
  • Проголосовать: не нравится

»
18 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится +11 Проголосовать: не нравится

Good luck everyone!

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

It looks really cool. I'm considering participating in this contest, although I'll have to sacrifice some sleep due to the different time zones.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Hoping to get back to expert after a huge drop in rating -____-

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

As a tester, I hope you'll enjoy these problems

Spoiler
»
18 месяцев назад, скрыть # |
Rev. 4  
Проголосовать: нравится +17 Проголосовать: не нравится

As a tester, I wish you good luck and Praise the Sun for your best participation!

\[^-^]/

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +11 Проголосовать: не нравится

\[^-^]/

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +4 Проголосовать: не нравится

Another cool round! \[^-^]/

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Do you guys think this round is going to be harder than typical Div 3 rounds because it is based on an Olympiad?

»
18 месяцев назад, скрыть # |
Rev. 4  
Проголосовать: нравится +10 Проголосовать: не нравится

Hope! we have a contest where

\^-^/

I hope I can solve four problems in this round and finish A, B, and C within 30 minutes as I am a newbie.

Good Luck Everyone

Happy Coding

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

it would be cool if at least once every 2 weeks there would be a div 3 or div 4

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

good luck everyone!

its based on olympiad so its going to be interesting

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I hope I can become Expert after this contest.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It's a chance to be back to CYAN...

  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    The sooner you get it, the sooner you can solve it. Because, it's just a while loop template. Yes, I'm talking about BINARY SEARCH. Problems 'D' and 'E' — I have solved both using BINARY SEARCH! And again, I am going to be CYAN...

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Good Luck Guys...

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +2 Проголосовать: не нравится

And praise the Sun !

Occasionally, it’s humorously linked to brute-force approaches (like iterating over all possible solutions) because brute-force can be seen as a last resort, much like praying for a solution. I hope you see something like this in the contest.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится -24 Проголосовать: не нравится

As a tester, I have a proof that upvoting this comment will lead to positive delta. But the proof is too long to fit the margin.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

like div3.This means that I can see and solve more interesting problems instead of only doing three problems like div2

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

\^.^/

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +23 Проголосовать: не нравится

Great contest. Relax and solve as much problems as you can!

»
18 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Having this kind of Laboratory and Olympiad event in your region is undoubtedly a blessing. From there, we get such tricky problems that AI models fail to generate solutions. So, bad luck for cheaters (who are going to downvote this!) and exciting for real CP lovers. And of course, I belong to the latter...

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hope for positive delta

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Looking forward to touch 1000 after this contest. In fact, any amount of positive delta would motivate me.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

GL HF! As a tester, I hope you will feel the maximum dope from the tasks and be able to achieve your best results!

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hopefully I will get my specialist back, kinda nervous tho as I feel it would be harder than normal div 3s since it's based on an olympiad

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

like div3.This means that I can see and solve more interesting problems instead of only doing three problems like div2

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится -20 Проголосовать: не нравится

Hope the problems are not chatgpt able.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It's time to up expert:)

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +13 Проголосовать: не нравится

So can anyone tell me how to solve prob G?

UPD: Report a stupid Indian cheater's youtube, share the code from A to F during the contest

  • »
    »
    18 месяцев назад, скрыть # ^ |
    Rev. 5  
    Проголосовать: нравится +6 Проголосовать: не нравится

    UPD : Apparently during system testing right now, I got TLE at test case 27 which is unfortunate plz ignore below.

    Imagine you're Gleb, and you have to cross a river to reach a point exactly s meters away. Each time you paddle, your current power (or energy) determines how far you go. BUTTT every time you decide to turn around to adjust your course, your power drops by 1 (unless you're already at the minimum power of 1). So, you want to minimize turns because every turn costs you power.

    I originally considered trying every possible sequence of moves forward and backward to see which one would land me exactly at point s. this was stupid i am stupid — charles leclerc

    Now here's what I actually did:

    Good ol dp. The key idea was to base my dp state on a modulus (p) and, for each residue modulo p, store a pair of numbers. These numbers represent the minimum and maximum effective move counts/strokes needed to reach that residue.

    Now we can build the state transitions using modular arithmetic. For each residue in the current state, calculate the new residue after a move by taking into account the effect of the stroke. I solved a linear congruence using the extended euclidean algorithm to compute a modular inverse, which was crucial to adjust the equation based on the gcd. Now with rnges I determined the valid range of multipliers (stroke counts) that would keep the move within the acceptable bounds.

    To showcas ethe actual movement, I defined two functions: one for forward moves (fwd) and one for backward moves (bwd). The forward function simulates strokes that add distance, while the backward function handles strokes that subtract distance (after a turn). Now if I alternate between these, I can build a detailed map of all the positions I could reach after any number of moves.

    The final step was to check if the dp state allowed me to reach exactly point s. I did this by looking at the residue corresponding to s and verifying whether the range of move counts included a valid solution. Since every turn reduces my power, the whole process was aimed at finding a sequence of moves that minimizes the number of turns, thereby preserving as much of my initial power as possible.

    Sorry if this is text heavy its hard to explain in text its why I prefer pen n paper

    UPDATE : This is based on number theory and there's a better solution using bitset by Edu175 below mentioned as well.

  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +2 Проголосовать: не нравится

    I just used bitset 312451438

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Cost a lot of time to code Miller-Rabin for problem E. Just to realize it's bad because n <= 10 ** 7.

Damn another minus delta for being such a noob.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

This round is amazing! I really enjoyed D and E.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

was F fenwicktree + dp ??

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Wow! Most balanced Div3 in recent time. Kudos to the everyone involved.

\[^-^]/
»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

really good problems fun F

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anybody tell me how can i use segment tree in this problem, in which i only have to get the sum of the answers in a range such that if value at that index is 1, then take it, or leave it. 312465645

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

G wrong ans on test 7 :( could not debug, not sure if solution is correct though.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

please review whoever submitted F in the last 30 minutes

I'm pretty sure 70% of them are fake

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

My screencast for this contest, for anyone interested: click

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

How do you come up the intuition for E? Any ideas and topics to practice ?

Tried to compute Sieve of Erastosthenes and then brute force it

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

F can be solved by assuming an edge between two points if it is reachable. After that, it is kind of dp on the graph which is pretty systematic.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I just cannot process the fact that I mindsolved $$$F$$$ 50 minutes ago of End of contest, and finished implementing it (along with debugging) , 10 minutes after end of contest , just realized my implementation skill is slow

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

I've just realized that Igor can go to row i - 1 only from row i

I thought that he can go to row i - 2 from row i if d is 2, but seems like this can't happen

nice problem btw

»
18 месяцев назад, скрыть # |
Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

What am i missing here for D ? 312462491 [](https://codeforces.me/contest/2091/submission/312473448)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // this is the code

include <bits/stdc++.h>

using namespace std;

void solve(){

int n, m, k;

cin>>n>>m>>k;

int total = m * n;

int value = (total - k) / n;

if( value == 0)
cout<<m<<endl;

else{
    cout<< m / (value + 1) << endl;
}

}

int main(){

ios::sync_with_stdio(0);

cin.tie(0);

int t; cin>>t;

while(t--){

    solve();

}
return 0;

} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

For C, does anyone have a proof of why it is impossible to form such a permutation for even values of $$$n$$$?

  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    in C when you have even n you cannot interchange 1 element at a time. What i mean to say is you need just 1 element to be at its own place for example 1 on a1 or 2 on a2, etc but when we have even n we swap 2 numbers or say we need to leave 2 numbers as is to its place for example -> 1 3 2 5 4 6 -> here 1 is left on one place but now we need to swap all other numbers say swapped 6 and 4 above and it becomes -> 1 3 2 5 6 4, but now you see the real problem any two consecutive numbers together because they will take their own place in some cycle which means -> 1 3 2 5 6 4 will become -> 4 1 3 2 5 6 and it is not allowed, i hope you were satisfied with my answer

  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +18 Проголосовать: не нравится

    Here's a mathematical explanation wrote it quickly in notion

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Terrible statement for F. Understanding it took a lot of time. Request for the authors to take out checking of comprehension from CP.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

E was relatively very easy , You guys should've removed the constraint of sum of n over all testcases doesnt exceed 1e7. Atleast then precomputation would come into play

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

is the intended solution of G is $$$O(k^3)$$$? I was frustrated when saw $$$O(k^3)$$$ solutions, because I thought that wouldn't pass TL

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hello, I want to inform you that the account bombardiro_crokodilo is mine and I accidentally sent two identical codes. Can you please ignore the code?

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone help to make this work 312418567

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hi, I participated in Round 1013 and registered as a contestant. I solved 4 problems during the contest, and my rating is below 1600. However, I was marked as "Unrated, Allowed". Could you please check if there was a mistake?

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

On 8th April, we have another div-3 round scheduled. Obviously, it's a short interval between two div-3 rounds.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Who can explain O(1) solution for problem D? I seen ksun42's solution but can't understand it

  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    First of all, we want to distribute the k desks as evenly across the n rows to keep the maximum number of desks in a single row as small as possible. The most desks we then get in a row is occupied = ceil(k/n). In such a row, we have free = m — occupied empty slots. Once more, we want to divide/break up the occupied slots in that row as evenly via the free slots: max_bench = ceil(occupied / (free+1)) (if you have x empty slots, you can break the desks in the row up into x+1 benches).

    ksun42's solution uses the fact that ceil(x/y) = int((x+y-1)/y).

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

A little bit standard (-__-) but very fascinating. (*^_^*)

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Why hasn't my rating got reflected, although I understand that i am not a trusted participant because I have participated in less than 5 contests, but it says if my rating was never above 1600 it would be considered as rated right, can someone explain.

  • »
    »
    18 месяцев назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    You just not in offical standings table because you are untrusted. As you know, it is because of some reasons. not offical == unoffical

    It doesn't means you are unrated. Just you are not in standings.

    Your rating will be updated after we run with hacked submission's datas, same as others

    Unless you checked as Unrated Participation...

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится
»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

My submissions just been ignored, they say that my solution for problem F is the same as of some others. However i didn’t sent my code or copy and paste a solution from anybody. I can’t prove it now but may be i could find proof later.