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

Автор Kirill_Maglysh, история, 2 года назад, По-русски

Обратите внимание на необычное время старта раунда.

Привет, Codeforces!

Во Mar/19/2024 11:05 (Moscow time) начнётся Codeforces Round 935 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. Задачи подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

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

Вам будет предложено 8 задач и 2 часа 15 минут на их решение.

Штраф за неверную попытку в этом раунде будет равняться 10 минутам.

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

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

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

Задачи основаны на олимпиаде ВКОШП.Junior. Авторы задач: Kirill_Maglysh, NToneE, Gadget.

Большое спасибо:

  1. Vladosiya за прекрасную координацию раунда.

  2. nigus, Gheal, KKT_89, Noinoiio, systy, FBI, SiERic, moonpieXXIV, nik.danilov, JuicyGrape, Pa_sha, FedShat, an_na, khaser, MountAim, Boris_Ber, PUFL, blook, yakuri354, iluminat_Btopou_AkkayHT за тестирование раунда.

  3. gurovic за ценные комментарии по условиям задач.

  4. MikeMirzayanov за системы Polygon и Codeforces.

Всем удачи!

UPD: Разбор выложен

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

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

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

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

Автокомментарий: текст был обновлен пользователем Kirill_Maglysh (предыдущая версия, новая версия, сравнить).

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

Different start time.

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

Yay! Div3 Round. Note the unusual time!

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

As a tester, I tested some tasks

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

It's on my birthday!!! But I have to go to the school ... T_T

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

Hope to bring my rating back after this round

Good luck for everyone!

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

if i dont submit anything or may submit the first one,will my rating fall?

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

Why is the timing so unusual? Problemsetters please try to hold contests in the regular times only as it's really inconvenient for people studying in universities(as most of them are students) and it's quite difficult to make it on a weekday on such an odd time.

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

good starting time...

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

I want to author a Div.3 , how I can do ? Vladosiya

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

What an unsual time! Maybe there will be less participants than usual days orz.

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

Cf round >>>>>>> school

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

Sleep schedule ruined enough to the point where a 1 AM contest will not affect my mental state. Good luck to all my fellow competitors, and may you gain a cool new color!

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

Автокомментарий: текст был обновлен пользователем Kirill_Maglysh (предыдущая версия, новая версия, сравнить).

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

Wishing everyone a great round and a positive delta !

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

I appreciate the unusual start time, much more convenient for me since contests are typically at 2am for me. You guys should do this more often :)

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

I am excited about Div3 but this time wont allow me to participate

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

School Time here in China :(

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

SPEEDFORCES!

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

speedforces!

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

Thanks for this "unusual time". In the month of ramadan this time is perfect for me( from Bangladesh)

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

fun fact!
today is the last day of the persian calendar (I guess it's called new years eve)
so, if the round was at it's usual time, most of persian users couldn't participate, so thanks for this
love from Iran, Happy nowrooz <3

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

What an unusual start time! But it's suitable for Chinese students.

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

great questions, but I wonder if problem setters intentionally make div3D easier than div3C most of the time. Problem C took way too much time to understand and implement.

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

Announcement for C was given only after I asked about n/2 being floating point number. Explanation could have been better, wasted so much time in C due to that

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

Problem Statement of B and C was not good. Especially C

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

C makes me want to kick my keyboard.

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

Unusual timing and kinda tough.

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

C makes me want to broke my keyboard.

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

how to E

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

C was implementation heavy....

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

Ignore this comment. Deleted the tutorial, will wait for open hacking phase to complete.

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

Got the idea of problem E in just 10 minutes and the rest of the time passed just doubting myself that it cannot be this easy!!!

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

sorry to say, but the worst div3 statement i've seen in a while. It's just a troll if you don't have even the basic knowledge of english and you just set a problemset with whatever you want. Just a waste of time

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

B,C and H are the most awful problems ever.

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

worst div3 ever seen

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

statement of c was not clear at all

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

Man B & C was laden with the weight of implementation intricacies.!!

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

    I beg to disagree. I would say that B and C are somewhat odd than usual, partially wordings, partially mathematical involvements, but implementations for them are nowhere near intricate.

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

      Master, are you taking my comment personally? You see I am not as skilled as you Master. I am a newbie in Codeforces parlance. So I'm not as good at simple thinking & solutions as you are, Master.

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

        Firstly, I think I should apologize if my words somehow felt like a personal attack. I never meant it that way.

        Secondly, however, I do think my point still stand. Of course, there will be an observable bias coming from me, with more experiences around. However, I do understand where you are coming from to counter-argue, as I had been there (or so I thought).

        For the problems themselves, B is a straight-up math problem, and C literally asks you to do whatever it tells you to.

        Of course, it's not that easy at a glance for newcomers: B's nature might seem dodgy to code at first thinking of how to fit the timespan, or is it required to explicitly define the optimal timespan; C — for now we ignore all the problem statement issues — looks confusing for newer contestants for maintaining the left and right side of the split.

        Still, what I wanna say to defend my point is, it's possible, and very likely, to generalize and abstract your thought process for a clean execution. The mathematical nature of B makes it a three liner if you understand how the math works, C is much cleaner to code once you could visualize how the states of the two sides change when we move the boundary.

        Of course, you don't have to take my thoughtstreams above all at once. One thing, you need to develop your own. Another, it's a steady learning process. You'll get better the more you spend your time thinking and improving. For now, I only state what I did at the original comment, as an opinion that what you have witnessed in your experience is incomplete — I won't say mine is already complete and perfect, but at least today I could cover yours a bit.

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

Is it just me or today's G and H are worth Div2E at least...?

I was quite close to clear G, but cannot really make it — I thought it was just simulating the process but the initial queue order screwed me over.

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

How did you solve F?

i thought it's a ternary search...

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

    Basically, you do what you are told to greedily.

    Loop through all $$$k$$$ that satisfies $$$2k - 1 \le n$$$, each $$$k$$$'s answer will be the $$$k$$$-th largest element over the unaffected indices multiplying by $$$k$$$ itself.

    To maintain the elements properly, we can make two BSTs (or more regularly streamlined in C++ STL as std::multiset), one for the available elements, one for the already chosen one. Choose the largest element from available and throw it to chosen for the act of taking mushroom, and erasing element from either multiset (prioritizing available over chosen) for the act of "cursing".

    My implementation, for reference: 252244274

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

How is the ans for the third test in problem F "8 2". Shouldn't it be "6 2"?

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

a lot of people solved b : (m * 2 — m) / a + (m * 2 — m) / b + somethings and no body will know why LOL

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

Can anyone give me intuitive understanding that why Following the given algorithm strictly and at last swapping positions of l and x's index is correct for Problem E?

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

    Consider 2 cases, whether the target is among the elements visited by binary search.

    If not, we can just swap the last l index with the position of the target since that will not change the search sequence itself.

    If yes, we see that swapping the order of any p[m] <= target will not affect the search sequence, since we are setting the left limit regardless every time.

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

    First I assume that you are saying why this works, swap(1, position(x)) and then swap(1, l). or n instead of 1.

    Solution with 2 swaps

    UPD : Now, I get your question, my friend also told me this solution.

    Solution with 1 swap
»
2 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

252273129 It is the solution for Problem D.I don't know why I'm getting wrong answer on test case 3,jiangly approach and my approach is same even though I'm getting WA.Please help me to find the mistake.

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

Contest authors:

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

the quality of the problems are comparable to div 2 ones really nice ones

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

Overall didn't enjoy the contest. Problem A was ok, for B I didn't like the method. A and B could have been swapped. C was horrible, I had to read the problem statement 4-5 times. There was some clarification about not rounding up n/2 was weird. I feel you were going for a heavy implementation round to make the problems more difficult, sadly I am not a fan of it. D and E were smartly designed and I have fun solving them. But for E, I didn't like how I had to put seed values as 1 and n+1...like I spent 20 mins to figure this out, which I felt could have been improved.

What is done is done. Thank you for the contest! I appreciate your efforts for the round <3.

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

Очень качественный раунд на самом деле, хороший Div.3

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

https://mirror.codeforces.com/contest/1945/hacks/1006163

~10 mins after the contest was finished, I realized I forgot to handle one case lol. This submission should fixed it. Anyway, my screencast is still processing and will be available here.

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

for D just a easy greedy! XD

#include <bits/stdc++.h>
#define int long long
#define rep(i, j, n) for (int i = j; i <= n; i++)
#define pii pair<int, int>
#define psi pair<string, int>
#define pis pair<int, pair<string, int>>
using namespace std;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
template <class T>
using pql = priority_queue<T, vector<T>, less<T>>;
int n,m;
int a[200010];
int b[200010];
int c[200010];
void solve() {
  cin>>n>>m;
  rep(i,1,n){
  	cin>>a[i];
  }
  int aws=0;
  rep(i,1,n){
  	cin>>b[i];
  }
  aws=0;
  rep(i,m+1,n){
  	aws+=min(a[i],b[i]);
  }
  int mins=a[m];
  int sums=a[m];
  for(int i=m-1;i>=1;i--){
  	sums-=a[i+1];
  	sums+=b[i+1];
  	sums+=a[i];
  	mins=min(mins,sums);
  }
  cout<<aws+mins<<endl;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
»
2 года назад, скрыть # |
 
Проголосовать: нравится +78 Проголосовать: не нравится

This contest was an undercover div 2.

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

Problem Statement of B and C was not good. Especially C(2)

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

reading >>>> div1

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

In D-Question, (considering 1based indexing), how does taking the sum of indices m+1 to n inside the min variable actually matter?

My code(give WA on tc3) Code

Correct code Code

By just taking the ans variable out of that min part and directly adding, problem gets fixed I get it that it is more simpler, but I want to know why taking it inside the min part gives problem. Thanks in advance for your help.

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

The problem setters of this round have to enroll English course as fast as they can.

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

either bro is too smart or bro is alt id of MikeMirzayanov

check this out

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

In C, n/2 is not an integer division could save my 1.5 hours

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

Problem E (Binary Search) Video Editorial : (Audio : Hindi)

YOUTUBE EDITORIAL LINK --Click Here

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

it should have been 2:30 or 3:00 Hours contest , 2:15 wasn't enough

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

Does anyone know why my approach for G is incorrect? Basically I'm using a priority queue to check whether there's someone who already ate with higher priority than the current front of the original queue. I take the appropriate first guy and then schedule its insertion to the priority queue. I'm taking into account order of insertion when multiple ppl are to be inserted at once so idk what's wrong.

https://mirror.codeforces.com/contest/1945/submission/252292126

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

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

H problem hint please:
i concluded that its enough to choose 2 elements for gcd and rets n-2 for bitwise and.. not able to proceed further.

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

    I've added hints for H : GCD is Greater on CF Step

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

    Fact : we only choose 2 elements for gcd.

    Proof
    ThinkHint 1
    ThinkHint 2
    ThinkHint 3
    ThinkHint 4
    ThinkHint 5
    ThinkHint 6
    ThinkHint 7
    ThinkHint 8
    ThinkHint 9

    Complete Solution

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

    I haven't implemented this yet, but I think it should be fast enough:

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

Beware whites , nigus is testing

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

in problem C: i have read the statement 10 times and i am still confused why in 4th test case answer is 3 and not 2

testcase ->

000

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

For the problem F, can I know the answer for the following test case? 4 2 7 8 10 2 3 1 4

The number of mushrooms are 2 that's ok but how it says the answer is 16. In my logic, I'll pick 2nd and 4th mushroom because [1, k-1] elements will be power 0 then the answer will be 14 which is maximum possible. But the expected answer is 16, i think they picked the 3rd and 4th mushroom. But my question is if I pick 3rd element then power of that element becomes 0 as P3 = 1, which is < 2. Now, am I wrong to understand or i am missing something? Can anyone help me?

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

252362491

What is wrong in this solution of problem F?

Can anyone explain ?

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

    I had the same problem.

    See this case:

    3
    7 5 8
    3 1 2
    

    The answer is 10 2, not 14 2.

    That's because we remove the elements with indexes $$$p_i$$$, like, choosing $$$k = 2$$$ mushrooms, the magic of the element with index 3 will be zero, because $$$p_1 = 3$$$, so the array will be:

    7 5 0
    3 1 2
    

    It's not the one with index $$$1$$$ or the element with $$$p_i = 1$$$, it's v[p[1]].

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

      This is so confusing, the samples don't have cases like this and the notes don't help.

      Honestly, the problem is good, but I don't know why doing these things just to "overcomplicate" a problem. It's not harder, it's just boring.

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

When will the ratings be out?

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

I didn't get B. If both are starting at the same time, then ans should be infinity. Can somebody explain.

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

Imagine getting hacked for not commenting the debug statements.

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

Системные тесты прошли?

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

How long does it usually take for rating changes to come, and why is it taking so long for this contest's rating changes ???

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

    Because of the large number of participants in Div. 3/Div. 4 competitions, system testing takes a lot of time. And these types of contests have a 12-hour phase of open hacks.

    Please be patient as the user ratings will not be updated until the system testing is complete, which usually takes 1-2 days.

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

Nowadays, Codeforces is taking quite long time for rating updation!

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

I had a solution using binary indexed trees for problem F. But for some reason the case with single value is processing weirdly. https://mirror.codeforces.com/contest/1945/submission/252426399 I have added comments to debug, for the case 1 , 1 ,1 output is coming as 2. can someone help on this ?

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

Can somebody tell me the approx rating of all problems???