Enigma27's blog

By Enigma27, history, 5 weeks ago, In English

All the best to all registered teams for ICPC India 2024 Preliminary Contest.

Attaching an excerpts from my team's codebook (it may help you during the contest).

If you haven't gone through the GoForGold initiative , read this blog and visit the website.

Do register for camp : fill the interest form

UPDATE

Since ICPC prelims will be organized again and it will be difficult for the teams to arrange for travel in short duration thus we will be selecting teams on the basis of :

1. Your past performance in ICPC Regionals/AWC/WF

2. Average rating of your team (~1800+ for div2 and ~2100+ for div1 with some advantage for 2nd/3rd year and IOI candidates)

3. If you have solved >=4 problems in the recent prelims round.

Note : This is a non-profit invite only camp to enhance the CP culture in india. We have more initiative lined up so even if you think you won't be in top50 prelims teams then also register. The selection criteria will be similar to IOITC where if you are in 2nd/3rd year then you will be given a little bit more preference even with lower rank/rating.

For the teams with rank > 50 in prelims, do register in div 2 if your team's average rating is >= 1700-1800 and in div1 if your average team rating is >= 2100.

The camp is also open for IOI participant. Some of them are already coming and also volunteering in the camp (like our orz evenvalue)

Codebook credit : hitman623 , TooDumbToWin, DeshiBasara, _shanky, Enigma27

  • Vote: I like it
  • +24
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you, sir. This will be a great help to all the participants.

»
5 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

Is the website opening??

»
5 weeks ago, # |
  Vote: I like it +61 Vote: I do not like it

Is there a cheat sheet on how to vent out anger after giving a contest on such a shitty website?

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +20 Vote: I do not like it

    I had similar experience in 2017 (my first prelim) but not because of platform but because of problems.

    After finishing contest, me and my team mate (GT_18) went to Assi Ghat in Varanasi and it worked for us.

»
5 weeks ago, # |
  Vote: I like it +17 Vote: I do not like it

Now, what will you guys do? Do a recontest?

»
5 weeks ago, # |
  Vote: I like it +22 Vote: I do not like it

The contest was nothing less than mental harassment. :(

»
5 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

I just don't understand what the problem with Codedrills was and why you guys chose to shift to such a Holy piece of Shit.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    As usual greedy management, tried to make their own platform for contest and literally fked things up

»
5 weeks ago, # |
  Vote: I like it +18 Vote: I do not like it

1100 Rupees for mental harassment and constantly loading the website for whole 30 minutes. WHY ??? Why can't your website handle the traffic if you made us pay for it , where did our money go . This is How you will select best team to represent India , the one with best internet should go to further rounds right ?? Take a recontest or refund us .

Even the standings were disabled but no gain .

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i received a mail about the re contest, so ig it is happening

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I didn't get :(

      • »
        »
        »
        »
        5 weeks ago, # ^ |
        Rev. 2   Vote: I like it +1 Vote: I do not like it

        it is written on the official website for all regionals that the re contest will happen

        so dont worry

        i just hope they fix this issue

        codedrills had a cooldown that u cannot submit 2 solutions under 30s, that helped alot to save from things like mass submissions, they havemt implemented anything like that

        • »
          »
          »
          »
          »
          5 weeks ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          Let's see if they improve or not the next time , it was really frustating for my first time . Btw Thank you for informing .

          • »
            »
            »
            »
            »
            »
            5 weeks ago, # ^ |
              Vote: I like it +8 Vote: I do not like it

            yes its more frustuating when tumhara solve hogaya hai but cancel hogaya hai round :(

»
5 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

I had an exam today, and I didn’t even study for it so I could focus on practicing and performing well. But you completely messed it up. If you can’t handle responsibilities, please don’t take them on.

»
5 weeks ago, # |
Rev. 2   Vote: I like it +50 Vote: I do not like it
  • They change the platform.
  • Realize the issues(during contest),they employ methods to reduce load on server
  • Still nothing changes and then they extend it by half hour
  • Cancel it after realizing that issues are out of control
  • As a participant who has paid money to take part in this and has an end-semester exam tomorrow(Yes, it's Sunday but Indian college things), I am utterly disappointed
»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What a waste of time giving a contest where you can't even see the problems half of the time

»
5 weeks ago, # |
  Vote: I like it +9 Vote: I do not like it

About time they start hosting ICPC on codeforces ;-;

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +37 Vote: I do not like it

    Codedrills worked fine IMO — it was stress-tested and didn't have any issues over the past 3 years and verdicts were super quick too.

    It was a positive change as previously even ICPC regionals had server issues (personal experience from 2016) despite only 10% of teams participating compared to the current online round.

    Unfortunately, what I've heard is that profs who lead ICPC India don't want to use a "third-party" platform (idk why). I think it doesn't make any sense and we should just go back to Codedrills or Codeforces (basically any platform that can deliver a pleasant experience for participants).

»
5 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

where can we upsolve?

»
5 weeks ago, # |
  Vote: I like it +21 Vote: I do not like it

Looks like there was some sort of a DDOS attack? Problems like C and E had >1500 submissions which makes no sense. It would also explain why the server suddenly went down around the 1.5 hr mark.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    It does make sense.

    But aren't the only ones who have access to the website, those with a login ID and password.

    I don't know how it works in details though.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    People were prolly spamming submissions, we were trying to submit D and suddenly the submissions wasn't working so we starting clicking submit as much as possible so that it gets submitted. Honestly they should have servers that can handle 20k-30k submissions.

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I mean if you look at the top 100 in the standings, there are barely any submissions on C/E (maybe <20). I would not expect teams much farther down to have even solved C/E, much less end up accounting for close to 2000 submissions on C for example. Again, I can't be sure of what happened but something feels out-of-place.

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it +16 Vote: I do not like it

        I think people circulated their solution on telegram/discord. That's the only explanation I can think of.

»
5 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

I solved C during the contest but server issues didn't let me submit it, is there a way to submit questions in practice now?

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Could you share the approach? I couldn't figure one out.

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      I used the idea of MST in this, which can be implemented using convex hull and DSU.

      First sort all vertices in increasing order of x, now there are n components and n vertices and possible nC2 edges, we only care about the least costing edges we need to add, initially the least costing edges would be the edges between the adjacent components i.e vertex i, vertex (i+ 1), all such edges would be stored in a set(acting like a priority queue), we remove the lowest costing edge from the set and merge the components they were reffering to,

      so the components array may look somewhat like

      1 2 3 4 4 6 7

      here I merged components 4, 5 and I add the least costing edges between components (4, 3) and (4, 6) using convex hull to the set, we only focus on low costing edges so we can use the rightmost vertex of 3 and leftmost vertex of 6, we can see the equation $$$a_i(x_i-x_j)$$$ as a line so for each component I maintained two convex hulls for edges going towards left and right, it is somewhat along these lines, overall if you have seen convex hull and alot of DSU i don't think it was that dificult.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a reason why these contests are not done on codeforces ?

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone can explain how to approach yesterday's preliminary problem D (Game-2048).

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Knapsack

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      can you share your solution or explain how to use knapsack in that problem

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it +8 Vote: I do not like it

        Weights are the points we score for making blocks of X = 4, 8, 16, 32, .. 2 ^ n, then just use knapsack with repetition.

»
5 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

any hints/solution for Collisions problem??

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    dp

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      Yup I tried something with dp but got WA, can you share your code

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it +4 Vote: I do not like it

        Approach : We consider moving each column either to left or right, the first one will move to right and last one will move to left (consider this as base case), now if the current column moves left then it can collide with previous two if they move right else we move current column to right. This is what me and my friend coded but couldn't submit.

        `
        #include <bits/stdc++.h>
        using namespace std;
        #define int long long
        #define endl "\n"
        const int N = 1e6 + 10;
        const int MOD = 1e9 + 7;
        
        void solve()
        {
            int n; cin >> n;
            int a[n];
            for(int i = 0;i < n; i++) cin >> a[i];
            int ans = 0;
            vector<vector<int>>v(n);
            for(int i = 0;i < n; i++){
                int sz = a[i];
                for(int j = 0;j < sz; j++){
                    int x; cin >> x;
                    v[i].push_back(x);
                }
                sort(v[i].begin(),v[i].end());
            }
            auto calcInt = [&](vector<int>&v1,vector<int>&v2)->int{
                int i = 0,j = 0;
                int count = 0;
                while(i < v1.size() && j < v2.size()){
                    if(v1[i] < v2[j]){i++;}
                    else if(v1[i] > v2[j]){j++;}
                    else{
                        count++;
                        i++;j++;
                    }
                }
                return count;
            };
            vector<vector<int>>match(n,vector<int>(2,0));
            for(int i = 0;i < n; i++){
                if(i - 2 >= 0) match[i][0] = calcInt(v[i - 2],v[i]);
                if(i - 1 >= 0) match[i][1] = calcInt(v[i - 1],v[i]);
            }
            auto f = [&](int i,char ch1,char ch2,auto &&f)->int{
                if(i == n - 1) return ((ch2 == 'R') ? match[i][0] : 0) + ((ch1 == 'R') ? match[i][1] : 0);
                int ans = 1e9;
                ans = min(ans,((ch2 == 'R') ? match[i][0] : 0) + ((ch1 == 'R') ? match[i][1] : 0) + f(i + 1,'L',ch1,f));
                ans = min(ans,f(i + 1,'R',ch1,f));
                return ans;
            };
            cout << f(1,'R','.',f);
        }
        
        signed main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            cout.tie(NULL);
            int t = 1;
            // cin >> t;
            while (t--)
            {
                solve();
            }
        }
        `
        
»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

what was needed to solve buy k, get 1 free? like dp, greedy etc

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Will the prelims be held again or not ? The Update is confusing.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It will happen again.

    • »
      »
      »
      5 weeks ago, # ^ |
      Rev. 2   Vote: I like it +3 Vote: I do not like it

      Can teams that haven't registered before register for this one?

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        That depends on the RCD, I guess their deadline has already passed.

»
5 weeks ago, # |
  Vote: I like it +44 Vote: I do not like it

Recontest clashes with the cf div1 round, please consider moving the contest to a different day or to a different time on the same day.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +29 Vote: I do not like it

    I think 24th should also work

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Actually there are multiple such requests because of exams, interview rounds of campus placement etc.

    But as the regionals are approaching, it's practically impossible to delay it to other date. You can send the request to RCD of corresponding regional.

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      But sir, the recontest is clashing with the launch of a new episode of Faketaxi. How am I supposed to give the contest?? It should definitely be postponed.

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      What about changing the timings? I guess 4.30 to 7 in the evening should be fine?

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it +39 Vote: I do not like it

        Many colleges have exams till the evening (both my teammates got till 8). So, keeping it in the night makes more sense. 24th night seems like a valid time too though.

        • »
          »
          »
          »
          »
          5 weeks ago, # ^ |
            Vote: I like it +33 Vote: I do not like it

          In fact, I have an exam till 6pm on 23rd and I didn't know it at the time of writing that comment 💀. Given the rarity of div1s these days, it would be great if they could avoid the clash, and 24th night seems like a good option for it.

»
5 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

India ICPC prelims 2024 (cancelled one) is over, so where can i test the code i wrote for one of its question. Its saying submission "Too Late", when i try to submit.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    We are thinking of hosting a practice round with the problems from cancelled prelims, so you will be able to submit them soon.

»
5 weeks ago, # |
  Vote: I like it +70 Vote: I do not like it

Solutions (SubtasksWhere)

E (bincatmod)
C (Points and Threads)
  • »
    »
    5 weeks ago, # ^ |
    Rev. 6   Vote: I like it +9 Vote: I do not like it
    D (game-2048)
  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
    Code For C
  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Could you please elaborate on your statement? I cannot see how it forms a continuous subarray: "Notice that while running Kruskal’s algorithm on this graph, the connected components will all be contiguous 'subarrays' of these sorted points. (More formally, there exists a sorted order of edges such that adding them in order, [...])"

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Points and Threads
    Note that it is possible to avoid using cht to eliminate a log factor (though it wasn't necessary to get AC)

    Hint
    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      how do you merge the deques fast? I dont see an easy way

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

we were trying to solve B using the approach that we will add all nodes(except the ones used for creating diameter) to the center node of the diameter according to number of leaves needed. What's wrong with our approach?

Our Solution (Wrong)
»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain the tree construction problem (B)? My approach was first add number of leaf nodes to root node 1. So now the remaining nodes are n-(l+1) and tree has a diameter of 2. Now for every node that we attach to tree will increase diameter by 1. So if remaining nodes+2 ==d then the tree can be constructed else not.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You are extending only 1 leaf mode, what if you can attach some more nodes to any other leaf now without increasing the diameter?

    Take this example one root node and it has l chains each of size d/2 attached to it. Now diameter will be d only but leaves will be l (last mode of each of the l chains) and total nodes will be l*d/2 + 1.

    This structure can hold much more nodes than the solution you mentioned.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      For l chains with d/2 diameter it means that leaf nodes should always be 2 only what iif leaf nodes are 3 then it would not satisfy as per your solution i guess.Your solution says it should always be 2 leaf nodes.

      And as per mine even if i attach d-1 chain to one side and 1 node to other it will still be diameter d and leaf node 2 only. I may be wrong also, could you please provide the solution if you have solved it?

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I think you misunderstood me, L chains of length d/2 connected to a common point.since there are L chains this their will be L leaves.

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Yess thanks i understand now. Could you provide the code for it? It would be great help

»
3 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

We rank 2nd in our college and the first team filled both regionals same as us i.e. Kanpur & Chennai.If they decided to go to only one of the regionals say Kanpur, did we get the chance to go to Chennai regionals or the seat from our college left vacant.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I guess no(this has already happened with one team 5-6 years back), but you can talk to the RCDs to confirm.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You will get the seat if you would have qualified for regionals with them not on the ranklist

    • »
      »
      »
      3 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Aayein?

      • »
        »
        »
        »
        3 weeks ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        i meant if the competiting team (who didn't confirm their seat) was not on the ranklist, then if the other team (who wants the seat now) would have gotten the seat then they will get the seat

        • »
          »
          »
          »
          »
          3 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          They are on the ranklist, he was trying to ask what if they refuse to go to the regionals even after getting invitation.

          • »
            »
            »
            »
            »
            »
            3 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            If a team declines, the next eligible team (from a different college or same college within the limit) gets the spot.