Agnimandur's blog

By Agnimandur, history, 7 months ago, In English

Hi Codeforces,

Many of you know about the CSES Problem Set, an online collection of over 300 competitive programming problems made by pllk! I have decided to clone all the CSES problems onto Codeforces! Each CSES category will be its own separate gym contest, listed below.

  • Introductory Problems (19 problems)
  • Sorting and Searching (35 problems)
  • Dynamic Programming (19 problems)
  • Graph Algorithms (36 problems)
  • Range Queries (19 problems)
  • Tree Algorithms (16 problems)
  • Mathematics (31 problems)
  • String Algorithms (17 problems)
  • Geometry (7 problems)
  • Advanced Techniques (24 problems)
  • Additional Problems I (38 problems)
  • Additional Problems II (39 problems)

CSES Logo

There are two main reasons why I decided to do this project.

Slow CSES Judge

The CSES Judge is very slow, often resulting in correct solutions that should get accepted instead getting the TLE verdict. This is especially a problem for programmers who use Java. However, the Codeforces judge is much faster, which solves this issue.

Codeforces API

The Codeforces API is quite powerful. By adding these problems to gym contests, these problems can now be accessed by the Codeforces API, which will aid developers and people who use Codeforces bots to suggest problems.

Note: Work in Progress!!

This is still a work in progress! There are over 300 problems on CSES, and it will likely take me months to get them all on Codeforces. Therefore, I recommend you "favorite" this blog post, and check back on the contests regularly.

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

»
7 months ago, # |
  Vote: I like it -37 Vote: I do not like it

agnimandur orz

»
7 months ago, # |
  Vote: I like it -28 Vote: I do not like it

Agnimandur to the rescue. I want to solve these problems and having them on codeforces will be so awesome.

»
7 months ago, # |
  Vote: I like it +250 Vote: I do not like it
  1. Did you ask pllk for permission to do this?
  2. While I personally dislike the tight TLs on CSES (e.g. for Java users), I think they must be intentional, not due to a slow judge. (Since clearly the author knows what judge the problems are on, and set the time limits accordingly.)
  • »
    »
    7 months ago, # ^ |
      Vote: I like it -77 Vote: I do not like it

    Hmm perhaps, but heavily optimized Java code fails on CSES, even when it works in under 200ms on Codeforces.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it +71 Vote: I do not like it

    For 1., I think the license says he just needs to give credit (which he did) and provide a link to the license?

»
7 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Thanks a lot! Will you add additional test cases to it? Or all the constraints would remain the same.

And great problems made by pllk

»
7 months ago, # |
  Vote: I like it -13 Vote: I do not like it

Also, are you using web scraping or just copy paste?

»
7 months ago, # |
  Vote: I like it -13 Vote: I do not like it

Great effort, thanks!

»
7 months ago, # |
  Vote: I like it +239 Vote: I do not like it

This seems quite pointless tbh.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it -35 Vote: I do not like it

    Are your ABC editorial blogs pointless?

    • »
      »
      »
      7 months ago, # ^ |
      Rev. 3   Vote: I like it +67 Vote: I do not like it

      Maybe so, but at least (I hope) they add something new to this website and offer explanations for people who didn't solve those problems in-contest. On the other hand, blatantly copying problems from an already existing, well-maintained resource doesn't provide anything new.

      Next time try to think for more than 2 seconds before commenting, kthx

      • »
        »
        »
        »
        7 months ago, # ^ |
          Vote: I like it -29 Vote: I do not like it

        they add something new to this website and offer explanations for people who didn't solve those problems in-contest.

        If you help someone, that's good but if someone helps someone not good.

        On the other hand, blatantly copying problems from an already existing, well-maintained resource doesn't provide anything new.

        As if he gonna make some bucks off of it. It's just educational and it's said in the license, you're free to redistribute.

        Next time try to think rational for more than 2 seconds before commenting, kthx

        • »
          »
          »
          »
          »
          7 months ago, # ^ |
            Vote: I like it +36 Vote: I do not like it

          Next time try to think rational for more than 2 seconds before commenting, kthx

          Says the guy with -50 contribution

          • »
            »
            »
            »
            »
            »
            7 months ago, # ^ |
              Vote: I like it -22 Vote: I do not like it

            Now, go tell your mom that you're proud of your contribution.

            Does that having negative contribution has to do anything with this argument or your comment really adds any value to this argument? Oof normies.

            • »
              »
              »
              »
              »
              »
              »
              7 months ago, # ^ |
                Vote: I like it +25 Vote: I do not like it

              Now, go tell your mom that you're proud of your contribution.

              LOL, I never bragged about mine.

              Does that having negative contribution has to do anything with this argument

              Yes, it means that no one wants to see your dumb comments.

              • »
                »
                »
                »
                »
                »
                »
                »
                7 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Well, ask yourself who's the dumb when they judge someone's comment by their contribution.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 months ago, # ^ |
                    Vote: I like it +10 Vote: I do not like it

                  Well, you see, I asked myself “who’s the dumb”, and I found out, after heavy thinking, that you’re the dumb.

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

                  How heavy you thought, dumbass lol?

                  You two making this argument irrelevant by dragging contribution. Well, you two certainly achieved that(milked some contribution) lol.

                  P.S. Do I have to spoonfeed that different people have different needs? Talk if you disagree that rather saying some edgy stuffs for contribution.

              • »
                »
                »
                »
                »
                »
                »
                »
                7 months ago, # ^ |
                  Vote: I like it +9 Vote: I do not like it

                Damn, speaking from experience aka -82 contribution, I thought that it was cool to have such low contribution lmao

    • »
      »
      »
      7 months ago, # ^ |
        Vote: I like it +70 Vote: I do not like it

      ABC English editorials usually come 3-4 days after the contest, so having an early though unofficial editorial is obviously handy. Having the CSES problems on codeforces seems unnecessary on the other hand given that CSES is already a stable and accessible site for most users.

      • »
        »
        »
        »
        7 months ago, # ^ |
        Rev. 3   Vote: I like it -38 Vote: I do not like it

        Well, you're mistaken if you thought I meant his editorials were pointless. My point is that different people have different needs. Besides, It's just educational and he credited the author.

»
7 months ago, # |
  Vote: I like it -13 Vote: I do not like it

Thanks a lot!

»
7 months ago, # |
  Vote: I like it -18 Vote: I do not like it

orz great help :D

»
7 months ago, # |
  Vote: I like it +291 Vote: I do not like it

So stealing content from other websites is now to be praised? I don’t understand.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    Technically, it's not "stealing". See here

    (I still don't think someone should copy those problems, it's quite demotivating for CSES authors)

    • »
      »
      »
      7 months ago, # ^ |
      Rev. 3   Vote: I like it +35 Vote: I do not like it

      Your link redirects us to one of the many licenses that can complement web content. That link alone is no proof that the license it is connected in any way with the website. The author has to explicitly include it somewhere. Moreover, I don’t see any mentions of a license on the website, which means it should be by default under exclusive copyright.

      For example, it seems that Codeforces doesn’t allow cloning problems.

      • »
        »
        »
        »
        7 months ago, # ^ |
          Vote: I like it +11 Vote: I do not like it

        License is mentioned here.

        • »
          »
          »
          »
          »
          7 months ago, # ^ |
            Vote: I like it +18 Vote: I do not like it

          This makes it more clear, thanks. Well then, happy cloning to the OP :).

»
7 months ago, # |
  Vote: I like it +36 Vote: I do not like it

In the problems there should be a link to the orginal source.

»
7 months ago, # |
  Vote: I like it +41 Vote: I do not like it

You can't hack here, and the tests should be very weak on CSES (very few problems have more than 10 testcases)

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

how are you going to keep track of the new test cases that are going to be added on cses from hacking?

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can't we see the solution submitted by other people in gym contests? I am not able to see the solutions

»
7 months ago, # |
  Vote: I like it +163 Vote: I do not like it

Personally, I think it's a bit demotivating for the CSES author. I mean, think about it, he has invested years behind this project and curating most of the must-solve-classic-problems in one place. It must hurt a bit. At least being a full-on pllk fan, it hurts meee :((

I get your point about the java and the api thing... I just wanted to say my opinion. Hope u don't mind :)

»
7 months ago, # |
  Vote: I like it -28 Vote: I do not like it

I am a java user. I want and would love to use $$$CSES$$$ instead of these GYM. I just want to ask one question. What will happen if pllk will set the time limit to $$$2 sec$$$? Is it possible that $$$O(n^2)$$$ solution will passed instead of $$$O(n)$$$? Because it's a fact that same solution that gives TLE for me will easily passed in $$$200-300ms$$$ on codeforces. Honestly I also want that $$$CSES$$$ problems remain there. Please pllk make the limit $$$2\,Sec$$$ and I guarantee I will never use the Gym instead of $$$CSES$$$ otherwise I am forced even if I don't feel like. Please make the change if possible.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it +87 Vote: I do not like it

    The point is to make sure you have a well optimized library, so it doesn't hurt you in the future, at least that is my take, especially since in cpp it is plenty of time already in every problem. If you have cpp that can't pass on a cses problem, it is likely it will tle in the future too on contest with a more complicated problem using the same algorithm.

    Also, it could be for showing beginners a direct reason to switch to cpp sooner, as for the most part everyone who is serious switches eventually, but people want to be stubborn at first (including me with java when I began).

    And unrelated, I completely agree with L0oSeR, even if it is within license to take the whole problem set and put them here it does not feel right.

»
7 months ago, # |
Rev. 2   Vote: I like it +151 Vote: I do not like it

So basically, you took the CSES Problem Set and removed the Code Submission Evaluation System part. Nice.

Imagine that you would write 300 page book about most known CP problems/algorithms/data structures. Then created 300 problems based on it AND developed an environment to solve them, which can also be used for your country's olympiad selection process and then some stubborn dude, who is stuck in 2000's, because he still did not switch from Java, clones your problems on a "faster" judge.

»
7 months ago, # |
Rev. 2   Vote: I like it -17 Vote: I do not like it

.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it -21 Vote: I do not like it

    Memory limit on Codeforces is 256 MB while on CSES its 512 MB.

»
7 months ago, # |
  Vote: I like it -40 Vote: I do not like it

It looks like I'm late to the party. I'd like to use this chance to comment on the stupid TL again.

If this were any normal judge, I wouldn't complain. I can see why people think it's fine to have a uniform TL, since you can think of languages as tools, and you choose the one you like as a key which unlocks the problem's door. The problem here is that CSES isn't simply a normal judge. It's a judge which "contains a collection of problems which can be used to practice the techniques explained in the books" (source). It's hard to "practice the techniques explained in the books" when the judge is so ridiculously slow that even the most obvious, intended solutions TLE.

With this mission statement in mind, suddenly porting to a faster judge so people using all languages can solve the problems without worrying becomes justified and understandable.

pllk? Just wondering if you have any additional thoughts on changing the TL.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    when the judge is so ridiculously slow that even the most obvious, intended solutions TLE.

    Which?

    • »
      »
      »
      7 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      • »
        »
        »
        »
        7 months ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        What about all the accepted solutions?

        • »
          »
          »
          »
          »
          7 months ago, # ^ |
            Vote: I like it +32 Vote: I do not like it

          Rather than using TreeSet, which is the technique taught in the book, you're forced to process queries backwards and maintain a left/right[i] which is the closest index to the left/right of i which isn't removed yet with a path compression like thing.

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

            It is incredibly slow for java. In the sorting and searching section, I utilized the same implementation, Java got TLE but C++ can easily get accepted. The difference is quite huge. If this is the case, why not only allow C++ Solution?

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

    Honestly, "please increase TL since my solution is getting TLE verdict" is one of the most stupid request you can ask on competitive programming.

    • »
      »
      »
      7 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Clearly you didn't read the post. It's "please increase TL because intended solutions can't get accepted and it's a clear violation of your judge's mission statement"

»
7 months ago, # |
  Vote: I like it -28 Vote: I do not like it

It would be great to add Tutorial Section as well in those problems as we have in codeforces__.

»
7 months ago, # |
  Vote: I like it -29 Vote: I do not like it

Awesome!

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is the sample input given for Problem-X (Sum of Three Values) correctly written???

It says:

"The first input line has two integers n and x: the array size and the target sum. The second line has n integers a1,a2,…,an: the array values."

But it doesn't match with the input values.

»
7 months ago, # |
  Vote: I like it +44 Vote: I do not like it

The CSES Judge is very slow, often resulting in correct solutions that should get accepted instead getting the TLE verdict. This is especially a problem for programmers who use Java. However, the Codeforces judge is much faster, which solves this issue.

Did you reach pllk to discuss possible improvements that could be made to CSES itself so that this wouldn't be a problem? I feel that could have been a sensible first step.

Personal Opinion
»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey Agnimandur, pllk

For Problem-X (Sum of Three Values), my submission on CF https://codeforces.com/gym/102961/submission/109356942 got TLE on Test-10 but the same code got AC on CSES after passing all 23 tests there, when the TL was 1 second there (whereas the TL on CF for this problem is 2 seconds).

Can you please explain why this happened??

»
6 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

will you add remaining problems? I guess it's actually helpful, for those who want's to submit, for example, in kotlin

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

There are over 300 problems on CSES, and it will likely take me months to get them all on Codeforces.

3 months passed, When will you add remaining problems ? Please do it.

»
3 months ago, # |
  Vote: I like it -6 Vote: I do not like it

Are you adding the remaining question or due to any reason this project is scrapped and idk about it?

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

Why aren't the links other than searching and sorting not working?

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

only sorting and searching exist.

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

you just uploaded only sorting and searching part. pls upload rest of it