r/programmingcontests • • Nov 18 '18

Italian programming competition

Thumbnail
codeflows.io
2 Upvotes

r/programmingcontests • • Oct 30 '24

Exun clan's annual competitive programming contest is being hosted soon!!

1 Upvotes

r/programmingcontests • • Oct 30 '24

ChipWits Demo is a free game (on Steam) where you program a cute little robot to solve puzzles. It now features periodic programming contests with live leaderboards. There are less < 2 days left for the October Challenge: Trick or Treat. Can you pickup treats and zap treats with the fewest cycles?

Thumbnail
gallery
1 Upvotes

r/programmingcontests • • Dec 15 '23

Why TLE help please.

1 Upvotes

I ran this code on my local machine, and it works without a problem. However, when I submit it, it returns a "TLE" status even for the first TEST_CASE.

2 4
1 3
5 7

Here is the code:

#include <iostream>
#include <vector>
using namespace std;
vector<pair<long, long>> v(50);
long n, k;

bool good(long m) {
  // for a segment [l,r] find the number of elements < m
  // number of elements less than m = 0 when l >= m
  // number of elements less than m = min(m-l,r-l+1);

  long cnt_less_than_m = 0;
  for (int i = 0; i < n; i++) {
    long l = v[i].first;
    long r = v[i].second;
    if (m <= l)
      cnt_less_than_m += 0;
    else
      cnt_less_than_m += min(m - l, r - l + 1);
  }
  return cnt_less_than_m <= k;
}

int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    long x;
    cin >> x;
    v[i].first = x;
    cin >> x;
    v[i].second = x;
  }

  // now we have to find the k-th element...
  // if x is the k-th element, then x should be the largest element such that
  // the number of elements less than x (<k) as elements can repeat, hence not k-1.
  // let's make a function cnt(x) that counts the number of elements less
  // than x. if cnt(x)<k, we move the left pointer; else, the right pointer.

  long l = -2e9 - 1;  // as the lowest element is -2e9
  long r = 2e9 + 1;
  while (l + 1 < r) {
    long mid = l + (r - l) / 2;
    if (good(mid)) {
      l = mid;
    } else
      r = mid;
  }
  cout << l << "\\n";
}

This is the problem link from the EDU SECTION of CF: Problem Link



r/programmingcontests • • Dec 11 '23

Self studying x Uni Team

1 Upvotes

Hi, i am a CS freshman and my university will be selecting students for the Uni competitive programming team, it is kind of a class, but they also participate on competitions together. I'm not sure it is worth it(I would have to pay an additional fee to participate on this class). Do you guys think it is better to self study competitive programming, with books and internet resources, or is it better to enroll in this class even with the additional cost of it?


r/programmingcontests • • Nov 02 '23

Are there any broadcast competitive programming events?

1 Upvotes

I'd watch the shit outta that. Like competitive gaming but with a skill that's actually useful.


r/programmingcontests • • Oct 09 '23

DMOJ giga chad

Post image
1 Upvotes

r/programmingcontests • • Sep 21 '23

How to solve problems without thinking?

1 Upvotes

I’m wondering if anyone manages to solve problems with very little thinking?

Thoughts definitely get in the way. There are thoughts on the problem, variety of approaches, but in the end almost none of them were useful when the solution arises.

I keep writing a variety of subsolutions that eventually have nothing to do with the solution.

Is there something outside of thinking I can do to solve problems? Has anyone reached this level? Should I scribble something on paper barely related to the problem?


r/programmingcontests • • Jul 22 '23

HACKATHON || ALL AGES AND LEVELS

1 Upvotes

Hack United is Very Excited to Annouce its First Hackathon! # United Hacks What is a Hackathon?

A hackathon is a contest where in a certain time frame you can build anything ranging from an app, website, algorithm, a robot, or actually anything!

More Information

πŸ“† Friday, August 4th-6th πŸ’» Beginner and advanced hackers welcome! πŸ† Cool prizes and FREE SWAG! $10,000+ in prizes πŸ… Certificates for every participant (add to linkedin + resume!) πŸ‘¨β€πŸ« Workshops teaching you more then just basic coding mechanics (resume/internship panel's) πŸ‘¨β€βš–οΈ Industry Professional Judges (network!)

The Theme

Mental Health Mental health has emerged as one of the most pressing global issues of our time, affecting individuals from all walks of life. The challenges surrounding mental health are multi-faceted, including the prevalence of conditions such as depression, anxiety, bipolar disorder, and many others. The impact of these conditions can be far-reaching, affecting not only the individuals themselves but also their families, communities, and society as a whole. Fortunately, technology has the potential to play a significant role in addressing and improving mental health outcomes. The team at United Hacks challenges YOU to make a project helping this pressing issue in society.

How to Register (These steps must all be completed for registration)

  1. Go to https://unitedhacks.hackunited.org/ and click Register on the top right. Then fill out the information needed and press Submit

  2. Go to https://unitedhacks23.devpost.com/ and click the Join Hackathon Button. Then fill out the information needed and press Submit

  3. (Optional) Find some teammates in <#1129859906598617218>

  4. Congrats! You're all set for August 4th

Even if you are not sure whether or not you will be participating in United Hacks... Still sign up to gain access to exclusive giveaways and workshops! discord.gg/hackunited


r/programmingcontests • • Jun 17 '23

We're adding a leaderboard to the upcoming reboot of ChipWits. We'd love to get your ideas for how to make it a great competitive experience.

Post image
1 Upvotes

r/programmingcontests • • Jun 14 '23

Prized Real world Competition

1 Upvotes

Hi, does somebody have a link or a name where I can find real world competitions with a monetary reward. Similar to Kaggle Competitions but not with machine learning but more general Cs problems/ projects. Does something like that even exist?

Regards


r/programmingcontests • • Dec 12 '22

Function f(n) - Recursion Basics

1 Upvotes

Hello, guys.

Anyone help to solve this question?

Function f(n) is given with recurrent relation:

f(n) = f(n-1) + f(n - 2) + ... + f(2) + f(1)

f(1) = 1

Find the value of f(n) mod 123456789.

1 ≀ n ≀ 10****9


r/programmingcontests • • Dec 06 '22

2nd Annual Robo-Reindeer Rumble!

1 Upvotes

The 2022 Robo Reindeer Rumble World Championship is underway!

Robo Reindeer Rumble is a free programming game hosted at MiniScript.org. Six robotic reindeer duke it out with snowballs and meadow mines, each controlled by a (usually short) MiniScript program. The last reindeer standing wins! Every December we have a global competition to see who can program the most effective reindeer.

For details and to enter, go to: https://forums.miniscript.org/d/293-2n


r/programmingcontests • • Nov 09 '22

Army Game coding Problem

1 Upvotes

dear sisters and brothers, i am stuck to this problem on hackerrank , can anyone tell me just algorithm ? https://www.hackerrank.com/challenges/game-with-cells/problem?isFullScreen=false


r/programmingcontests • • Sep 29 '22

help related to a merge sort problem

1 Upvotes

Suppose a streaming service for some reason, is worried about account sharing and comes to you with n total login instances. Suppose also that streaming service provides you with the means (e.g., an api) only to compare the login info of two of the items (i.e., login instances) in the list. By this, we mean that you can select any two logins from the list and pass them into an equivalence tester (i.e., provided api) which tells you, in constant time, if the logins were produced from the same account. You are asked to find out if there exists a set of at least n/2 logins that were from the same account. Design an algorithm that solves this problem in ΞΈ(nlog(n)) total invocations of the equivalence tester.

I know they want me to solve the problem by merge sort but I'm not sure what to do in merging phase should i just compare all the elements in left and right array and if i do so will that still be time complexity of o(nlogn)


r/programmingcontests • • Sep 28 '22

Understanding space optimized solution for distinct subsequence dynamic programming problem

1 Upvotes

I was trying out distinct subsequence problem:

Given two strings s and t, return the number of distinct subsequences of s which equals t. For example, if s = "rabbbit" and t = "rabbit", then the answer is 3 as there are 3 ways you can generate "rabbit" from s.

I came up with following space optimized solution:

def numDistinct(self, s: str, t: str) -> int:
    
    prev_row = [1] * (len(s) + 1) 
    
    for ti in range(1, len(t)+1):
        
        cur_row = [0] * (len(s) + 1)
        
        for si in range(1, len(s)+1):
            if s[si-1] == t[ti-1]:
                cur_row[si] = prev_row[si-1] + cur_row[si-1]
            else:
                cur_row[si] = cur_row[si-1]
                
        prev_row = cur_row
        
    return prev_row[-1]

Above solution required two arrays prev_row and cur_row.

Then I checked this discussion on leetcode.

It says following:

Notice that we keep the whole m*n matrix simply for dp[i - 1][j - 1]. So we can simply store that value in a single variable and further optimize the space complexity. The final code is as follows.

   class Solution {
   public:
       int numDistinct(string s, string t) {
           int m = t.length(), n = s.length();
           vector<int> cur(m + 1, 0);
           cur[0] = 1;
           for (int j = 1; j <= n; j++) { 
               int pre = 1;
               for (int i = 1; i <= m; i++) {
                   int temp = cur[i];
                   cur[i] = cur[i] + (t[i - 1] == s[j - 1] ? pre : 0);
                   pre = temp;
               }
           }
           return cur[m];
       }
   };

It seems that this solution is doing it with single array cur and a variable pre. I guess pre in ? pre : is meant to reference dp[i - 1][j - 1]. Also, I guess, cur[i] in = cur[i] + maps to dp[i][j - 1]. Thus it should be cur[i-1] instead of cur[i] I am somehow not able to fully grasp this solution as its in C and follows different indexing. Can someone explain this solution more.

Also can someone explain further optimization done in the solution given in comments:

int numDistinct(string s, string t) {
     int n = s.length(), m = t.length();
     vector<int> dp(m+1, 0);
     dp[0] = 1;
     for (int j = 1; j <= n; j++){
         for (int i = m; i >= 1; i--){
             dp[i] += s[j-1] == t[i-1] ? dp[i-1] : 0;
         }
     }
    return dp[m];
}

r/programmingcontests • • Jul 08 '22

Coder One: an exciting AI programming competition with $5K+ AUD prize pool

1 Upvotes

Coder One is a fun online event where your goal is to program an AI player to compete in a multiplayer game against other teams. Top teams will battle it out on an exciting livestream finale (check out last year's stream here).

πŸ“ 1 β€” 14 September 2022 (AEST)

πŸ₯Š Open to participants of all levels across the globe

πŸ† $5,000AUD+ cash prizes, digital certificates, giveaways, job opportunities and more

🎟️ $10 entry

Learn more and register at: https://www.gocoder.one

If you have any questions feel free to comment or DM!


r/programmingcontests • • Jul 07 '22

IP2Location Programming Contest 2022

1 Upvotes

Develop your idea now to stand a chance to win prizes worth $14,444 in total.

Join the contest now at https://contest.ip2location.com/


r/programmingcontests • • May 05 '22

Why isn't the rank updated when doing path compression in union by ranks on disjoint sets?

1 Upvotes

Hello,

I read and saw a bunch of union by rank tutorials, and none of them updated the ranks while doing path compression. It is boggling my mind how not updating the ranks is still giving the right answer.

Any insight on this will be helpful.


r/programmingcontests • • Apr 24 '22

Guidance Regarding Question from an old Interview

1 Upvotes

Was going through GFG (GeeksForGeeks), and came along this one question that I can't seem to tackle no matter what. I post the question underneath as is, and request that someone help me understand how should I go along with it.

Arya has N balls arranged in a row. Some balls are colored and some not. There are some M types of colors in Arya’s world and color balls have colors out of only these given M colors.
Arya decided to color the remaining balls and put all the adjacent balls with same color in 1 group.

For example lets say after coloring the rows of balls have these colors :
{1, 2, 2, 3, 3, 3, 1, 1, 4, 5}. Then Arya can put them into following 6 groups : {1}, {2, 2}, {3, 3, 3}, {1, 1}, {4} and {5}. Arya wants these number of groups to be exactly K.

Now the coloring also has some cost associated. So as already told that there are M colors, coloring each ball i with color j costs C(i, j).
Arya want to use minimum paint for this task. You need to help her.
It is guaranteed that we can paint the balls such that K groups are formed.

I can't seem to find anything online, but as I understand it this would use dynamic programming. Now I have search for generating K groups with minimum cost, and have found a few solutions, but these still leave me confused since they are tackling it with an assumed cost of 1, and also do not handle the edge case of no ball being colored.


r/programmingcontests • • Jan 25 '22

(Basic) Segment Trees with beautiful diagrams!

Thumbnail
desmondwillowbrook.github.io
1 Upvotes

r/programmingcontests • • Dec 28 '21

Regarding HLD vs Centroid Decomposition Vs Euler travel technique(ETT)

1 Upvotes

Recently studied centroid decomposition and Euler travel technique/ flattening tree. Have no idea how HLD works.

Am confused how to identify the questions where to use one of 3 techniques mentioned on query on trees problems.

Also Is there need to study HLD or most of hod ques can be solved by centroid decomposition and Ett? Thanks in advance.


r/programmingcontests • • Dec 09 '21

How do you deal with failing unknown test cases?

1 Upvotes

I was trying to solve hackerrank's abbreviation problem:

You can perform the following operations on the string a:

* Capitalize zero or more of a's lowercase letters.

* Delete all of the remaining lowercase letters in a.

Given two strings a and b determine if it's possible to make a equal to b as described. If so, print YES on a new line. Otherwise, print NO.

I came up with below python solution, it is passing 7 out of 16 test cases but failing in remaining 9 test cases. How can I fix this solution, given that those test cases are locked? Also I have a general question that how you really deal with such locked / unknown test cases while practicing on online platforms and also during actual coding tests?

def abbreviation(a, b):
    ai = 0
    bi = 0
    while True:
        if bi == len(b): # note len(b) is after last index
            if ai == len(a): # note len(a) is after last index
                return 'YES'
            else:
                if a[ai:].islower():
                    return 'YES'
                else:
                    return 'NO'
        if ai == len(a): # if a exhausted before b
            return 'NO'
        if a[ai].islower():
            if a[ai].upper() == b[bi]:
                ai += 1
                bi += 1
            else: 
                ai += 1
        else:
            if a[ai] == b[bi]:
                ai += 1
                bi += 1
            else:
                return 'NO'

r/programmingcontests • • Dec 05 '21

First annual Robo-Reindeer Rumble competition

1 Upvotes

The first annual Robo-Reindeer Rumble programming contest has begun! Write a script to control a robotic reindeer in a deadly (yet festive) snowball fight!

https://forums.miniscript.org/d/262-1st-annual-robo-reindeer-rumble-competition

A typical reindeer script is maybe 20 lines, so it's not a big commitment. And as this is the first year of the contest, even a weak script has a good chance of being on top for a little while. Why not give it a try?