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

Автор Enigma27, история, 18 месяцев назад, По-английски

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

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

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

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

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

Is the website opening??

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

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

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

    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.

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

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

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

The contest was nothing less than mental harassment. :(

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

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.

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

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 .

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

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.

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +50 Проголосовать: не нравится
  • 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
»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

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

About time they start hosting ICPC on codeforces ;-;

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

    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).

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

where can we upsolve?

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

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.

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

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?

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

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

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

      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.

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

        can u clarify a little, i didnt understood the part of how r u not using nC2 edges . And what did u meant by components array ? 1 2 3 4 4 6 7 i dont get it.

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

          Let the x coordinates of points be

          6 5 2 4 8 10

          as identity of points dont matter, I can relabel them after sorting them by increasing order of x

          2 4 5 6 8 10 (Labeled by index)

          Now, component array looks like

          1 2 3 4 5 6

          My claim is that for a least costing spanning tree, the array for components would look like

          a a a b b c d e f

          i.e. the points belonging to same component are adjacent on number line, initially that is true, after that, say there are three components

          a < b < c (ranked by coordinates)

          If instead of connecting (a and b) or (b and c) we were to connect components (a and c), it would cost lesser to connect ((a to b) and (b to c) in order) or ((c to b) and (b to a) in order). Proof I am leaving up to you, so we have proven that it is optimal to connect adjacent components, so components at any point would look like the array I gave before 1 2 3 4 4 6 7 (after 4 and 5 were merged).

          If we want to get a minimum costing edge between two components (A on left and B on right), then atleast one of the end point of the edge is rightmost point in A or leftmost point in B.

          As I add atmost 4 edges whenever I join two components, I only check atmost 5 * n edges.

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

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

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

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

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

any hints/solution for Collisions problem??

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

    dp

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

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

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

        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();
            }
        }
        `
        
»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

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

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

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

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

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

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.

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

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.

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

Solutions (SubtasksWhere)

E (bincatmod)
C (Points and Threads)
  • »
    »
    18 месяцев назад, скрыть # ^ |
    Rev. 6  
    Проголосовать: нравится +9 Проголосовать: не нравится
    D (game-2048)
  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится
    Code For C
  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    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, [...])"

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

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

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)
»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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.

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

    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.

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

      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?

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

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.