Comments

Thanks!

Please also make it easier to filter div1 problems. Maybe it could be a problem tag? It would be a really amazing feature for the problemset page.

Currently, even trying to do this manually using the API seems to require multiple API calls and non-trivial logic. I've tried those ideas at some point. Are there any better ways?

  • Fetch problemset and contest list, match each problemset problem to a contest and then parse the contest name and see if it contains Div. 1 or global round or good bye or hello or ...

    • (this gets extra confusing with some exceptions like VK Cup and Croc which may or may not be div1)
  • Fetch the rating changes of top ~30 people and assume that at least one of them has participated in every div1 contest. So the union of contest ids from their rating changes is close to a complete list of div1 contests

What made you think of decimal expansion when solving A? I OEIS'ed it :(

I brute forced when X and 2*X have a lot of digits in common, and searched the digit sequence in OEIS. Found decimal expansion of 19

It also referred me here, to try 383 after 19: magic-square-something

Then I wrote the checker to see if all multiples are present, and indeed 19 and 383 worked.

Next item on that list was 32327, which is too big. So I just guessed that maybe the first primes after 1000 would work instead. 1009 and 1013 didn't work, but 1019 worked. Proof by AC!

It's interesting how AI might have a significantly easier time competing on either codeforces or atcoder, depending on how accurate it will be.

Very inaccurate: atcoder would be easier. It might make hundreds of submissions and be the slowest participant to solve N problems. But still get full score for those N problems and be ahead of anyone solving N-1. While barely getting any points on CF due to massive wrong submission penalty.

Very accurate: codeforces would be easier. Solving N problems without any point decay might even put it ahead of people solving N+1 in addition to being the first to solve N.

Seems a few greedy/wrong solutions passed in G.

(I know the contest is long over, just adding some cases for any upsolvers.)

A few extra cases
A wrong greedy idea that currently passes

Sorry, my bad. I only argued against this part:

I think people could've made the same argument about chess.

(As in, there were many other things the AI was missing back when chess AI was interesting, but reasoning ability sorta sounds like the last missing piece.)

It generates 1000 potential solutions

Not sure if this is possible when the problems involve multiple steps (either in terms of implementation or mathematical observations). Like, maybe the problem requires 3 different observations which it can generate correctly with probabilities p1, p2, p3 on their own.

Then, if it doesn't do any form of reasoning, then it would have probability p1 * p2 * p3 to generate the full solution in one go as all 3 pieces are required for it to pass stress testing.

However, someone/something that can reason would think until they generate the first observation. Then be convinced that it's good. Then move on to the second one, and convince itself that it's good too. And then the third one, all separately.

So maybe expected time to solve would be

1 / (p1 * p2 * p3)

for something that doesn't reason at all, but only

1 / p1 + 1 / p2 + 1 / p3

for something that does reason, as all events are separated.

if p1 = p2 = p3 = 10% for example, this could be the difference between 1000 attempts and only 30 attempts.

I think that after some problem difficulty threshold it will become necessary to do this step-by-step thing, because generating the entire solution in one go would be too low probability for even 1000 attempts.

Well, there has so far always been a way to belittle the AI for what it can't do.

AI learns chess!

Well, it can't do anything else really. Also chess has such a small branching factor, you can easily look many moves ahead. Hell, even a simple brute force can beat most humans, you barely need an AI.

AI learns go!

Cool but... it can only do these simple games!

AI learns starcraft.

Ok but it can't do anything actually useful you know.

Ai generates art based on text

Okay, that's useful. But it can't do anything meaningful in STEM.

ChatGPT can actually write flawless python scripts for some of the things I've needed at work.

Holy shit. Ok, but it has dogshit reasoning. I need to tell it exactly what to do and it still makes mistakes too so I need to check everything.

AI claimed to have 1600 rating or something

Ok, it can mimic other people's reasoning for standard-ish problems and apply it. But it can't solve any actually hard problems or multistep problems... right? It doesn't actually think.

AI has 2500 rating.

... It can't take care of farm animals with love and care?

human has left the chat

I just meant that maybe we can do some branch cutting here?

case world still exists:

  • AI probably hasn't reached a very high rating yet, otherwise it has proper reasoning ability and can probably do everything else as well

case world doesn't exist any more:

  • doesn't really matter what the AI codeforces rating is

Like maybe we don't have to worry about 2500 rating AI, because by then the world has already ended?

I was just curious, if you sorta agree with this or actually think it's possible the world is just fine in general, but we have 2500 rated AI?

Do you think it's possible for AI to keep climbing this rating ladder much further without also reaching some form of humans-are-obsolete scenario in the process?

Like actually having a 2500 rated AI without it also being able to do almost all non-physical jobs better than humans and causing all kinds of chaos and bigger problems to worry about?

I think cheating might become fun in some (rare) scenarios like stress testing.

By having decided to stress test, you have already committed to just give up on trying to find a counterexample on your own. The result you expect is that after you do a bit of menial work, the computer pops up with a case where your solution fails (or confirms it didn't find one).

Consider the two cases:

  • You spend a few minutes writing the test generator and the brute force. This is time not spent actually problem solving.
  • You press a button, and the AI generates a brute force solution, test generator and informs you of a case where your solution fails. You immediately resume problem solving with this new information.

I think when maximizing fun, the optimal approach would be either to never resort to stress testing OR to use AI for that. Would it ever be more fun to actually do the stress testing yourself if you knew that AI could've done it for you?

(I'm only trying to argue that it's possible for cheating to be more fun than not cheating in some scenarios. I don't think this in particular is a big deal or anything that would significantly change contest results.)

It is also worth noting that performance this way may not have log-coefficient 400 unlike usual ELO

This blog claims the win probability formula has constants 10 and 400. If I picked different constants, then I'd change the definition of win probability.

Perhaps the ratings could be iterated?

I assumed that one important property is that the perf should be tourist-invariant. That is, your perf should stay roughly the same whether or not tourist participates. That shouldn't be possible without taking ratings into account at least to some degree.

The current implementation should achieve this, because the formula mentioned above gives only ~0.3% chance to win against tourist even at 3000 rating.

(1 / (1+10^((4000-3000)/400)) = 0.00315

I am very sure an X performance in usual div1 is a much higher accomplishment than X performance here

I agree, I think top perf is higher and bottom perf is lower than it should be compared to official perf right now. Not sure why.

It's not super far off, but indeed quite a bit (e.g. from round 2006):

this calculator -> (old_rating + 4 * rating change)

4198 -> 4195
3953 -> 3890
3821 -> 3753
3728 -> 3646
3657 -> 3573
3600 -> 3522
3552 -> 3470
3511 -> 3429
3475 -> 3396
3444 -> 3366
On Octagons → ICPC Teens ?, 2 years ago
+26

This so much. So tired of seeing this growing list of people who only participate on cf/atcoder up until the end of their IOI or ICPC eligibility. And most tend to fully retire too, not even leave cp as a semi-serious hobby or anything.

Funnily enough, someone just argued in my DM's that IOI is so prestigious and well respected because it's kind of like a world championship in sports. But aren't sports world championships actually way more open and some amazing people dominate there for over a decade?

You reminded me how many times I've quit contests half way through as soon as I didn't like one of the problems. I also agree that it happens way more often in div2/3/4. Perhaps a monotone achievement aggregate would be best indeed.

Anyhow, on designing a performance calculator, I think this would be OK in theory:

  • For ratings, use the current ratings of cf users (mostly because historical ones are hard to get)
  • Throw away virtual participants from standings (except you — so it works for virtual contests too, and without the random grays on top).
  • Throw away standings after top 2000 (mostly for performance reasons, but perhaps it's more accurate too — helps get rid of contestants who quit very early and didn't actually participate for real)
  • Binary search for which rating would lead to (expected rank) == (actual rank) in the modified standings, and use that as performance.

This way, whether or not a tourist participates shouldn't affect you too much (unless you rank higher), because you'd be expected to lose anyway based on rating difference.

I made this calculator. It's annoyingly slow though, maybe that whole running in the browser without a server thing wasn't such a great idea...

I don't think such a rating would ever come close to being as important as the real rating, because it measures an entirely different skillset. Just think about competing against an LGM in a 3h div1 vs in a div4 contest. In the former case you might get stuck and feel entirely powerless to solve any of the next problems and just have them solve 3 more problems than you, but in the latter case they might just be twice as fast but you'll both likely solve all the problems during contest. (basically SOLVE vs FAST from that blog)

Also why is the point of unrated participation to "remove competition"? I mean I think the main point of rating bounds is just that you literally can't let LGM's be rated in div4 contests, because then the rating would start reflecting speed instead of problem solving ability. And all the other rating bounds similarly protect the integrity of the rating system, but are less extreme examples on the same spectrum. (Another issue is the originality and uniqueness of the problems, but which again leads to protecting the integrity of the rating system — rating should reward problem solving not having memorized something they've seen before.)

We are also talking about people who chose to unofficially participate in the contest — if they preferred to "remove competition", they could've just solved the problems a bit later out of contest instead (with distinct advantages like doing it whenever they preferred and perhaps only solving a subset of problems most interesting to them).

Is the 2000+ rated range intentional? Most other AGC seem to be 1200+, other than world finals stuff

Found a cool way to invalidate pointers without explicitly using any pointers in F:

#include<vector>
using namespace std;
struct Trie;
vector<Trie> heap;
struct Trie {
    int child_index = -1;
    void add(int depth)
    {
        if (depth == 0)
            return;
        if (child_index == -1) {
            child_index = heap.size();
            heap.push_back(Trie());
        }
        heap[child_index].add(depth-1);
    }
};
int main()
{
	Trie root;
	root.add(2);
}

(This exact code crashes in MSVC, might need a bigger example for GCC/clang.)

But the idea is that this line heap[child_index].add(depth-1); seems to work similarly to e.g.

auto child = &heap[child_index];
child->add(depth-1);

And then when push_back causes vector resize, then the child reference will be invalidated.

So, on the surface it looks like no pointers or references were used, but they be sneaky like that.

There was more discussion about this on codechef: thread

TL;DR: the description was wrong — the real generation process was more like "Make 3 moves, shuffle registers, then add all 3 registers as a triple, repeat." (yes, can be solved using 60^3 brute force per triple) rather than what pwild described.

Could somebody share their test generator for challenge? The 4-th test set is confusing me: the way it is described:

"After generating the triples, try again if any of them have equal elements."

seems to run very long for me. Even checking right after each triple seems to take forever. So instead I did some weird search:

"After generating each triple, if the triple has equal elements, try again and add +1 to count_mistakes. Start again from scratch if count_mistakes > 64."

Now it generated the test fast, but it felt like my local 4-th type tests were somehow very different still compared to the one visible test of 4th type. (sometimes very different scores)

My generator: http://ideone.com/H144pL

0

But does it still have a bug?

When I submit the code again I still reach the same results:

1) WA on HR, because "All points are not inside circles."

2) But when I run my code on those inputs and check, all points do seem to be inside circles.

Also found another much less severe bug: the constraint 1 <= r_i <= 1e6 doesn't seem to be enforced at all — my wrong solution that prints both 0 radius and huge radius circles passes all cases...

0

Help: why is my answer wrong in Minimal Cover? First test case for example:

Test case #0:
My output:
My code (last submission during contest time):

And a tester I wrote (that doesn't find the mistake):

Tester

We just thought the probability of having a solution with pragmas from someone who wouldn't just immediately recognize the usefulness of bitsets seemed low enough to leave it as it is. And turns out everyone who got 100p during the contest did actually use bitsets. Would it really have been a better contest if all the 66p solutions would have scored 100p? :p

Not sure about "without much effort". This runtime seems so random to me — if you replace memmove with swap, that solution suddenly runs in 6.5s instead of 0.3; but then if you delete the sse4 pragma, it runs in 0.4s even with swap?! Basically what I'm saying is that either you have to make a lot of random decisions correctly or actually know what you're doing :D

What if the compiler gets even smarter and starts optimizing your recursive solutions into dp in the future when you add some #pragma NobodyCaresAboutMemoryUsage flag? :D

C++ compiler is just too smart. We noticed that if you write the 66p solution in a rather clean way (from the compiler's point of view — such as not put if statements inside innermost loops etc), and then add pragmas, the result is almost as fast as the official bitset solution. This would pass for example: https://ideone.com/Xf7Ybh

On my pc,

  • this solution: 0.3s with pragmas, 1.6s without
  • An official bitset solution: 0.15s with pragmas, 0.26s without

(YMMV with the exact runtimes, but notice the tiny difference between 0.26s and 0.3s)

Rubber: The problem started to make sense after I saw this test case: test

(The point is we can't look at just a single nail at a time to make conclusions. (Also 2 nails are not enough either if we extend this test case, we need many.). The solution is folding together 3 points into 2 points whenever doing that doesn't intersect with any nails. We also add extra points to avoid cases where it get's stuck, like this one.)

Sersum: No need for interpolation, but a lot of googling and FFT. (Too hard to explain in detail, just giving hints):

  1. Use Faulhaber's formula

  2. We can speed this up for multiple k, if we use FFT (B_k together with k! and x^(p-k+1) together with (p-k+1)!)

  3. We can calculate the Bernoulli numbers in O(k^2) which takes about 1s out of given 6s.

  4. If we have multiple x, we can just add them together in the Faulhaber's formula before FFT

(Now we need to solve a different problem: given an array, calculate the sum of k-th powers of it's elements for every k in [0,K])

  1. Use Newton sums

  2. If we construct polynomial (x-a_0)*(x-a_1)*...*(x-a_{n-1}), then it's roots are our array, so it fits nicely into Newton sums. (We can calculate the coefficients of this without interpolation, just divide and conquer multiplying left half and right half with FFT).

  3. We can calculate Newton sums faster, if we do something like "sqrt"-decomposition with FFT. So calculate first 10000 S_i in the naive way, then FFT them together with the coefficients. Same with next 10000. That is all we need to fit into 6 seconds.

Anyone else used an ILP solver for this one? The linear conditions are in the form 2*z[i] >= a[x] + (1-b[y]), we are trying to maximize sum of z. (z is boolean denoting whether or not both of the conditions of some person are satisfied; a and b are booleans of whether or not a person is elected in parties a and b respectively). So if either of the conditions are not satisfied, z[i] can only be false. It actually runs almost instantly :o Python code using Gurobi solver: http://codepad.org/a0Ldgh9W (I just noticed the na_var and nb_var do nothing, nevermind those :D)

On tweety → List of IOI 2016 Participants, 10 years ago
+32
Estonian team:
On Rubanenko → NBHEXT — Know Your Rating, 11 years ago
0

Also had this error message while trying to submit a problem in today's round, URL was http://codeforces.me/contest/592/problem/D?csrf_token=c15c2c92bb3f42d2467b7131ae6e68ee. (I think refreshing didn't fix it, but now (after contest) it's working again.)

Let's start a comment chain with increasing scores for O(n^2) solutions. I'll start with 62.5 points here

+34

Also comparing (sum of 3 highest rating gains)/(sum of 3 highest rating losses) for last 3 rounds (new system) and 3 rounds before that we get 1243/775 ~ 1.60 now, but 2180/1080 ~ 2.02 before. I think that also means getting inconsistent results (some very good, some very bad) will have worse average rating than getting consistent mediocre results compared to before. Which also means safer strategies (solve AB or ABC in that order, as fast as possible) got buffed compared to not-so-safe strategies (like reading and thinking about all problems after solving A, trying harder ones looking for something you've seen before). Not sure if that's a step in the right direction. What are your opinions about that?

On PrinceOfPersia → The 1st Hunger Games, 11 years ago
+5

But why stop there? This contest is so awesome it should be extended at least until New Year! Just need a way to "resurrect" the "dead" and lots of problems.

"with something for all." Codeforces analogy of what they did is making a combined division contest with div2A,div2B,div1C,div1D,div1E (seriously, it's even worse, number of solvers = {2800,1600,13,10,0}). If they would just change the first 2 to div1 A and B it would fix 2 problems at once: 1) combined with Fear_Is_An_Illusion's idea of moving problem statements elsewhere the server would get like 10 times less requests and 2) would provide more than 0 interesting problems for most purple and yellow coders. EDIT: By interesting I mean having a reasonable chance to solve during the contests without being very easy. Solving very hard problems after contest is still interesting.

Started both programming and competitive programming in summer 2013 (age 16). That year I had participated in local olympiads in physics and chemistry and found out about the international ones. So during the summer I thought it would be interesting to set a goal like: "qualify to international olympiad in subject x next summer". Estonia is rather small so I was cocky enough to choose most interesting x regardless of prior knowledge. Chose IOI. Worked. (Started C++ as that was the obvious choice from the set{C++,C,Pascal}).

On PrinceOfPersia → The 1st Hunger Games, 11 years ago
0

But if a[i] is negative, is a[i]%n still non-negative or is it like in c++ that (-4)%3 == -1?

An alternative explanation to D: Let z[i] be the maximum size of a substring starting at i that is also a prefix. (array z is generated by z-algorithm in O(n), find it here) Let string s be the concatenation of A and B. The maximum size of s is O(n/k). For every possible size of s, we need to check if the next k blocks of size |s| are equal. This is equivalent to checking for(p = 0;;p+=|s|) if z[p]>=|s|. If so, let's look at position p = |s|*k in the string. We know that the answer is 1 for the interval [p-1,p+z[p]-1]. (We can choose the length of A arbitrarily, if |A| is 0 then p-1 works and then we can increase |A| while it still is a prefix.) Now that we have all the possible intervals, let's sort them and iterate through position i to see if it is inside any interval. Complexity: The checking can be done in O(k) for every |s|. Since maximum |s| is O(n/k) the total cost O(n/k * k) = O(n). We also need to sort the intervals.

On Dutzul → Chinese OI test-data, 12 years ago
+5

If you are simply looking to solve them, wcipeg.com has some NOI problems (most recent 2012). If you get wrong answer on a test case it will show you a small part of your output, so you could get some information like size of the input or find out if any numbers are negative etc. I couldn't find full test cases or tutorials anywhere either.

An alternative way to make the dp feasible in Div1A is to use brute force when the first jump is very large. Define very large to be 2000. Then the brute force would have maximum depth of 16, and about 3^16 (43M) operations. When less than 2000, dp[30001][2000] would fit into time and memory.