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

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

Hello, Codeforces!

I am very excited to invite you to our contest Codeforces Round 1037 (Div. 3), which starts on 17.07.2025 17:35 (Московское время). You will be given 7 problems and 2 hours and 15 minutes to solve them.

The problems were authored by me, __rose, Pishka12, Chalishkan and I_HATE_MD_DM to solve and alter them.

The round will be hosted by the rules of educational rounds (extended ICPC). Thus, all solutions will be judged on preliminary tests during the round, and after the round, there will be a 12-hour phase of open hacks. After the open hack phase, all accepted solutions will be rejudged on successful hacks. Also, note that there is no score distribution — rank will be determined by number of problems solved, followed by penalty; wrong submissions will incur the usual penalty of 10 minutes, following the rules of educational rounds.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

We would like to thank:

GL HF!

Editoral is out!:

Also I would like to show you the beauty of our country's nature with the stunning backdrop of tourist Peak (3965m)!

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

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

Hope to reach Expert in this legendary contest!

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

It should be 4009

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

as a tester this round is good

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

as a tester this round is peak

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

As a problem setter, I hope you will enjoy these amazing problems.

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

As a first time tester wish positive delta for the ones who r ready to sacrifizs anything for it

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

i was at this peak and the views as beautiful as the tasks on this contest) gl & hf for everyone

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

As a non-tester, I want to test a contest.. Please some coordinator give me a chance!!

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

As a non-tester, I want to test a round, please some coordinator allow me to do one!!

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

as a tester have fun everyone

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

Hope to get back to specialist this round (skill issue)!

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

Hope to reach Expert in this legendary contest!

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

giving credits to the fathers of internet is a sweet gesture ^-^

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

As a participant, I can guarantee there exists some undiscovered peak, 44m higher than this.

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

tourist is everywhere

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

As a participant, I don't think tourist's peak is 3965 cmon guys

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

Tourist has exceeded the peak.

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

In Round 1035,I got 128 rating and reached Expert,but in Round 1036,I lost 103 rating so I back Specialist. All in all, bless i can reach Expert again:)

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

hope to reach green!

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

As a hike-aholic, the mountain successfully drew my attention!

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

As a tester, I wish everyone a smooth contest, green submissions, and a positive delta.

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

How does it work if I participate in this contest, but after rollbacks I become expert right before the contest?

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

As a first time tester, this is definitely one of the peak rounds of all time ( glhf everyone :) )

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

I HAVE to participate

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

.

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

Hope to make a comeback

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

hey guys, I am on a journey to get a coloured rank. If I flopped in this contest, the roast is free—no need to hold back.

It motivates me.

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

Expecting as usual another round of div 3 that C or D will be harder than the next.

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

Hope that D is not mind-tricking :)

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

After a 10 days long break...

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

Why are geometry problems so rare in codeforces. I would love if problem setters made more geometry problems instead of Constructive or Permutation. though i don't hate them

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

As a tester this round is fire,you need to stretch ur mind,solution may be invisible but you need to see a thing

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

Has something changed my penalty meter kept increasing it was 100+ even though i did no wrong submission?

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

Loved F. Errichto's video about heavy/small nodes came helpful. Also amazing test prep for F. I had to safeguard memory + use unordered map with custom hash

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

Noice, good questions for my first ever contest ever. was scared to start codeforces but finally gave it a shot after 8 months of DSA grind. how well of a performance is 4 questions?

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

How to solve A?

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

I was in queue for A submission for like 3 mins like what was that

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

damn math questions damn damn damn

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

Problem F is cool

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

problem $$$F$$$ was cool, I think this is the first time for me to use some SQRT decomposition technique in a live contest xD

also, some solutions for problem $$$G$$$ worked on the hard version but got TLE on test 17-18 on the easy one !^_^

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

In D , to think of boundaries as l ans r were given variable names but was a distraction.

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

    Hi can you share me your approach for D. My Approach is failing at test case-2

    My Approach (Failed)
    Code

    Edited:

    I figured out out edge case

    Edge Case

    I was using DSU like approach to merge all casinos with overlapping intervals into same group and assigning them their largest reachable value, but turns out we can't win any value within range [l,r] for a casino, rather we would have a specific value 'real'. Thus we can't guarantee that we can play at any casino which will have an overlapping interval

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

      Sorry but I am unable to understand your approach properly, but let me say this that think very greedy, maximizing coins is the goal so sort real[i] array and check if you could achieve the next or next to next or next to next to next and so on.. Thank you

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

This is my first contest. And i solved first two problems. this contest and result will memorable for me.

thank you

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

how can even around 12000 users solve question d.

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

How to solve pF? I think I got TLE because of the heavy node (the node with large deg)

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

Problem E royally f*cked me.

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

How to solve D mannnn???

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

    Just sort the casinos you receive by the amount they are going to give you (because going back is pointless) Then you greedily check where you can advance.

    #include <bits/stdc++.h>
    using namespace std;
    
    #define pii pair<int,int>
    
    struct Pol {
        int l,r,v;
    };
    
    bool fun(Pol a, Pol b) {
        return a.v<b.v;
    }
    
    void solve() {
        int n, k; cin>>n>>k;
        Pol *pool =new Pol[n];
        for(int i=0; i<n; i++) {
            int a,b,c;
            cin>>a>>b>>c;
            Pol pl; pl.l=a; pl.r=b; pl.v=c;
            pool[i]=pl;
        }
    
        int pre=k;
        sort(pool,pool+n,fun);
    
        for(int i=0; i<n; i++) {
            if(pool[i].v>pre) {
                if( pool[i].l<=pre && pre<=pool[i].r ) {
                    pre=pool[i].v;
                }
            }
        }
    
        cout<<pre<<endl;
    
    }
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr); cout.tie(nullptr);
    
        int t=1;
        cin>>t;
        while(t--) solve();
    
        return 0;
    }
    
»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E ?

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

    create a list that is lcm(p[i], s[i]) and recreate p and s and check if they are same

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

    check if res[i] = lcm(a[i], b[i]) works and if not then nothing can work

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

    I did something way more convoluted than what's being suggested. I checked if p[n]==s1 and then for i from 0 to n-2: gcd(p[i],s[i+1])==p[n]. Also checked each of p and s are valid by checking if p[i]%p[i+1]==0 and s[i+1]%s[i]==0

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

    To construct a valid array a such that:

    `p[i] = gcd(p[i-1], a[i])`
    `s[i] = gcd(a[i], s[i+1])`
    `p[n-1] == s[0]`   // i.e., gcd of the entire array

    We observe the following:

    1. From p[i] = gcd(p[i-1], a[i]), it must be that: p[i-1] % p[i] == 0

    2. From s[i] = gcd(a[i], s[i+1]), it must be that: s[i+1] % s[i] == 0

    3. Since a[i] must satisfy both prefix and suffix GCD conditions, it must be divisible by both p[i] and s[i]. So: a[i] % p[i] == 0 and a[i] % s[i] == 0 ⇒ a[i] must be a multiple of lcm(p[i], s[i])

    To check if such an a[i] is valid, try setting: a[i] = lcm(p[i], s[i])

    Then check whether: gcd(p[i-1], a[i]) == p[i]

    Substitute a[i] = lcm(p[i], s[i])

    = gcd(p[i-1], lcm(p[i], s[i]))

    = gcd(p[i-1], (p[i] * s[i]) / gcd(p[i], s[i]))

    = p[i] * gcd(p[i-1] / p[i], s[i] / gcd(p[i], s[i]))

    So, for this to equal p[i], we must have: gcd(p[i-1] / p[i], s[i] / gcd(p[i], s[i])) == 1

    If this condition fails at any index i, then no valid array a[] exists.

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
if( p[1]!=s[n] ) {
    cout<<"NO\n"; return;
}

I just didn't write this down and missed question E. What is the use of this one condition?

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

Hi Codeforces!

In today's problem E, i was confusing about one thing

What is the difference between gcd(a[i], b[i]) != a.back() and gcd(a[i], b[i + 1]) != a.back(), imo the should give the same value however the first one is WA and the second one is passed

Thanks in advance!

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

The problems are good, but I think the samples are too weak...

So many penalties I have made...

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

I can't think straight about E

how did you guys think about the problem ?

I know it's the LCM but why ?

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

Beautiful problems, especially F! Really enjoyed solving the tasks :)

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

For problem F, I'm seeing a concept of heavy light decomposition. Can this problem be done without it or is it necessary? Was trying to optimize cost update by storing what is the total edge cost for particular color of neighbors for every color and every node, but didn't work.

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

How to solve G2?

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

    I had a solution where I fixed the minimum element of the subarray (let's call it x), and the goal was to find the maximum possible median (y) of any subarray that contains x.

    It's not hard to prove that the subarray must either start or end at x, because at least one half (either left or right) need to be dominant so we will only take that part so it is just finding the maximum prefix/suffix starting/ending from the index of x (we are going to model the problem for prefix).

    Now, for a fixed x, we can binary search on the value of y. For each candidate y, we transform the array into +1 if the element is ≥ y, and -1 if it is < y. The idea is that if the number of +1s outweighs the -1s in a subarray, it means elements ≥ y are in the majority, so the median has to be >=y.

    To efficiently check this, we use persistent segment tree to find the maximum prefix sum starting from index of x. This can be Done with a combine function where answer of node represents the maximum prefix sum in the current node => answer of current node = max(answer of left node,(Number of Elements >= y in left node + answer of right node)).

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

      you don't need a persistent segment tree

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

      How do you fix the value of x? Checking each x isn't optimal and doing binary search for x doesn't make sense either.

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

      i think you should try fixing median

      like common technique build array with ele greater than med as 1 and ele less than med as -1 then find subarray whose sum>=0 ans update ans = max(ans,med-min).

      to do this just iterate medians from n to 1 and maintain segment tree and whenever you update pos of your median as 1 in segment tree you call update query now we can say that our answer can grow if subarray include this position so when you are calling update you go to those l,r which include this positon so while calling update you also try to update your answer just maintain max prefix sum max suffix sum total sum and min elemet in segment l,r

      now when you are standing at l,r

      now you have 3 options

      option-1 if(sum of l,r) >=0 ans=max(ans,med-minimum of l,r)

      option-2 int val=maxsuffix sum from mid to l

      now query the prefix mid to r such that val+prefix>=0 and find the minimum in element in this

      prefix and update answer ans=max(ans,med-miniprefix)

      option-3

      int val=maxprefix from mid+1 to r

      now query the suffix mid to l such that val+suffix>=0 and find the minimum in element in this

      suffix and update answer ans=max(ans,med-minisuffix)

      just check my implementation

      https://codeforces.me/contest/2126/submission/329546875

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

I tried to hack others' solutions of F but I got unexpected verdict. Could anyone point out my mistakes please or is there anything wrong like this ?

generator

Edit: it works now

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

Today's F is one of the best problems I've solved in the last few months. Perfect Contest :)

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

Editorial??

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

Me during contest: A-F: that easy? G1-G2: that hard?

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

how to solve F?

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

    let's say when you change color of a vertex from x to y, then result += score[color[x]]-score[color[y]].

    You should init the trees with dfs/bfs to set up the color map (for its children) and its parent color update(just 1 edge) for easy update. Overall complexity should be O((N+Q) * log(N+Q)).

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

tried solving G1 with ordered_multiset to get the median but got TLE, can anyone explain why?

submission link: https://codeforces.me/contest/2126/submission/329538028

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

Can anyone please provide solution for F with HLD.

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

While reviewing the preliminary contest standings, I found two contestants whose activity appears suspicious: they submitted solutions to every problem within minutes, and the coding style differs markedly from one submission to the next.

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

Hi guys, where can I find the tutorial/editorial? Or is not out yet... this my second contest so im kinda lost

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

HOPE TO REACH PUPIL IN THIS LEGENDARY CONTEST 10/10! FROM MYSIDE

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

F was very cool

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

Hey Can Anyone tell me that I have given my first contest untill then I was unrated and I have submitted my first problem which got ACCEPTED but my account is still showing unrated

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

Problem F can be solved in $$$O(n+q)$$$: 329562348.

When I first thought of the problem, I thought: oh, just use sqrt decomposition (heavy-light partitioning). But then, I thought: Why was the graph being a tree? I realized there's a much simpler solution that exploits this constraint.

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

Nice contest. Thank you authors

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

主题:申诉 Codeforces Round 1037 (Div. 3) 被标记 Unrated 管理员您好: 在 Codeforces Round 1037 (Div. 3) 中,我的提交被判为 Unrated。根据官方 FAQ,轻度 AI 辅助(如润色、重构)是允许的,我在此说明: 所有题目的算法思路均为原创。 以 F 题为例:我自行设计「按节点度数分类,小度数暴力、大度数 map」的做法。 AI 仅用于润色我已写好的代码(变量命名、缩进、注释),无任何逻辑复制。 我已核对最终代码,确保无公开模板逐字重合。 恳请复核,将该场比赛恢复 Rated。如需进一步信息,我乐意配合。 感谢!

Subject: Appeal for Unrated Contest Codeforces Round 1037 (Div. 3) Hi Codeforces team, My submission in Codeforces Round 1037 (Div. 3) was marked Unrated. Per the official FAQ, light AI assistance (styling, refactoring) is allowed. Here are the facts: All algorithms are my own. Such as problem F, I personally devised the “degree-splitting + brute-force for low-degree vertices + map for high-degree vertices” approach. AI was used only to polish my own draft code (renaming, formatting, comments); no logic was copied. I have double-checked the final code and confirm it does not match any public template verbatim. Please review and restore the Rated status. I’m happy to provide any extra details. Thank you!

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

First live contest this year, editorial taking longer than usual... I miss super-fast editorials :=(

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

主题:申诉 Codeforces Round 1037 (Div. 3) 被标记 Unrated 管理员您好: 在 Codeforces Round 1037 (Div. 3) 中,我的提交被判为 Unrated。根据官方 FAQ,轻度 AI 辅助(如润色、重构)是允许的,我在此说明: 所有题目的算法思路均为原创。 以 F 题为例:我自行设计「按节点度数分类,小度数暴力、大度数 map」的做法。 AI 仅用于润色我已写好的代码(变量命名、缩进、注释),无任何逻辑复制。 我已核对最终代码,确保无公开模板逐字重合。 恳请复核,将该场比赛恢复 Rated。如需进一步信息,我乐意配合。 感谢!

Subject: Appeal for Unrated Contest Codeforces Round 1037 (Div. 3) Hi Codeforces team, My submission in Codeforces Round 1037 (Div. 3) was marked Unrated. Per the official FAQ, light AI assistance (styling, refactoring) is allowed. Here are the facts: All algorithms are my own. Such as problem F, I personally devised the “degree-splitting + brute-force for low-degree vertices + map for high-degree vertices” approach. AI was used only to polish my own draft code (renaming, formatting, comments); no logic was copied. I have double-checked the final code and confirm it does not match any public template verbatim. Please review and restore the Rated status. I’m happy to provide any extra details. Thank you!

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

    关于我为什么要用AI润色代码,因为我要给学弟学妹解释代码是什么意思,我自己写的代码风格不太好阅读,所以我需要用AI在不改变代码逻辑的情况下让代码更适合新手阅读。我保证所有题目的算法思路都是我自己想的。请求恢复rated,感激不尽!

    Regarding why I used AI to polish my code: I need to explain the code to my junior classmates, but my original style is hard to read. Therefore, I used AI solely to make the code more beginner-friendly without altering its logic. I guarantee that the algorithmic ideas for every problem are entirely my own. I sincerely request that this submission be reinstated as rated. Thank you very much!

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

How do you do G man I don't understand

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

My submission of 'B' got TLE on test case 7 in system testing. I think, at least the first 10 test cases should be capable enough to reject a submission during contest... I am feeling so saaad...

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

How weak the pretest is?

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

WTF IS TEST 51 IN F?????

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

im never doing a d3 or edu ever again... i get fst literally every time for the dumbest reasons, i mean cmon you couldve EASILY put a case in e to stop that

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

why the my solution for the E is skipped??

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

The number of hacks in F and G are crazy in this contest.

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

Fucking Weak Pretest(s) !!! So sad...

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

When will the ratings get updated?

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

my ranking showing 17000 around solved 2 questions will i get any rating for the contest it is still showing unrated. will i get any rating for the contest i had participated first time in codeforces contest

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

    Ratings are not updated yet for all participants, will be updated soon. The 'unrated' text you're seeing doesn't necessarily mean the contest is unrated for you. That text also appears when ratings simply haven't been updated yet.

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

i guess i will go to sleep and hopefully see myself green tomorrow ;-;

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

why my rating has not come yet?

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

Can anyone help me to debug my submission for F, I am getting TLE at 41th testcase.

Don't know what is getting wrong.

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

editorial when?

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

a good contest, thanks for the author.

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

insanely weak pretests for B

come on dropped from like 2k rank to 6k

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

Still no tutorial?

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

For the B problem https://codeforces.me/contest/2126/problem/B why is this code not correct ? ~~~~~

include

include

include

using namespace std; int main(){

int t;
cin>>t;

while(t--){

    int n,k;
    cin>>n>>k;
    vector<int>arr(n,0);
    for(int i=0;i<n;i++)cin>>arr[i];

    int cnt=0;

    for(int i=0;i<n;){
        if(arr[i]==0){
            bool onePresent=false;
            int j=i;
            int daysLeft=k;
            while(j<n && j<=i+k-1){
                if(arr[j]==1){
                    onePresent=true;
                    break;
                }
                j++;
                daysLeft--;
            }
            if(!onePresent && !daysLeft)cnt++;
            i+=(k+1);
        }
        else i+=1;
    }
    cout<<cnt<<endl;
}

} ~~~~~~

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

    First, if the current i isn't right, you have to increment the i with 1 only, but you don't do this in the condition (when doing cnt++ you should increase i with k + 1 else you should increment it only 1)

    Second, you will get TLE because imagine that the sequence is k — 1 zeros and 1, and the sequence goes with this pattern, so you need to use binary search to know the next index of 1.

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

During the contest, I solved problem D, but to be honest, I just somehow guessed the solution because it seemed that the problem was very similar to some classic greedy problem.

I just experimented with how to sort the intervals. Initially, I sorted the array as I did in the classic problem, by the right side of the interval, and I found that the solution was wrong. So I just changed that to sort based on 'real' instead, and the solution passed, but I didn't understand why it worked.

Can someone explain how to approach these types of problems more systematically? How do you usually prove greedy solutions instead of just guessing?

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

    This is not difficult. This has nothing to do with the size of the right boundary. Let’s assume the number of current coins is x. We can perform the operation when l≤x≤r. We certainly want our number of coins to increase, so this is related to the value of real. When real>x, performing the operation will definitely lead to a better outcome.

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

On problem F

I got the memory limit exceeded because of creating array 2D with size O(N * sqrt(N)) and for each elements got long long int.

After that, I increase the BLOCK size to 1000, still MLE, and 2000 then got accepted.

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

Toturial?

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

Great contest, thanks to the authors!