SlavicG's blog

By SlavicG, 2 years ago, In English

Hello Codeforces!

mesanu, flamestorm, MikeMirzayanov and I are glad to invite you to Codeforces Round 835 (Div. 4)! It starts on Nov/21/2022 17:35 (Moscow time).

The format of the event will be identical to Div. 3 rounds:

  • 5-8 tasks;
  • ICPC rules with a penalty of 10 minutes for an incorrect submission;
  • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)
  • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated
  • by default, only "trusted" participants are shown in the results table (but the rating will be recalculated for all with initial ratings less than 1400 or you are an unrated participant/newcomer).

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

Only trusted participants of the fourth division will be included in the official standings table. This is a forced measure for combating unsporting behavior. To qualify as a trusted participant of the fourth division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1400 or higher in the rating.

Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.

We would like to thank:

We suggest reading all of the problems and hope you will find them interesting!

Good luck!

UPD: Editorial is posted.

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

| Write comment?
»
2 years ago, # |
  Vote: I like it +28 Vote: I do not like it

As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +12 Vote: I do not like it

    As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

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

          As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it -9 Vote: I do not like it

            As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

              • »
                »
                »
                »
                »
                »
                »
                »
                2 years ago, # ^ |
                Rev. 2   Vote: I like it -13 Vote: I do not like it

                k.,

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it -28 Vote: I do not like it

                  As a participant, I am currently participaing.

                  Spoiler for upvotes:
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  114 spoilers later: where are them upvotes at?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  As a maprticipant, I am asking myself: "When will ratings change?"

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

»
2 years ago, # |
  Vote: I like it +17 Vote: I do not like it

As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

»
2 years ago, # |
  Vote: I like it +26 Vote: I do not like it

As a tester, I am happy to represent my fellow newbies. The round has good and enjoyable problems. Good luck!

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

    "As a tester, I am happy to represent my fellow newbies." don't believe him, he is a lgm in disguise.

»
2 years ago, # |
  Vote: I like it +4 Vote: I do not like it

As I tester, I'm sure you'll find the problems fun and interesting. I wish good luck and positive delta to everyone!

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Shouldn't this blog be in the main page?

»
2 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Looking forward to my first unrated round ever!

»
2 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

As a tester I did nothing like (some) other testers.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Congratulations once again for putting div.4 round on Monday.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

omg div 4 , will try to score high

»
2 years ago, # |
  Vote: I like it +22 Vote: I do not like it

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

Yayyy ! Won't miss my first unrated contest ^_^

»
2 years ago, # |
  Vote: I like it -27 Vote: I do not like it

It would be nice to finally fix language selector issue and remove excessive use of flags.

Sources with supporting arguments:

Codeforces Language Picker -- chrome extension to see how fixed codeforces language picker would look like.

Please support the initiative and stop reinforcing poor UX practices.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I just became pupil. How can I become a specialist? Should I learn new things? Please advise me. I want to reach there quickly.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hey, i reached pupil yesterday aswell, to reach specialist our goal is simple get A,B,C done as fast as possible.Try to do D,if not upsolve it

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In order to get to Specialist, I suppose you've got to solve AB(C) in Div.2 / ABC(D) in Div.3 / ABCD(E) in Div.4. () means that if your speed is fast enough, the () problem can remain unsolved.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can we really become Specialist,by just solving AB fast??? In less than 30 minutes or more fast?

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

omg cyan round

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

OMG Green Round

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm really looking forward to this game, it's going to be an interesting game

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Good luck everyone!

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The funny thing that nobody pointed out is that all the testers are at least expert level. However, it does not have to mean that the problem difficulty was poorly judged, especially because many of the testers and setters are experienced in setting/testing rounds.

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

As a Arch Linux user, how do I exit vim I am still in it since the Div. 3

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

good luck guys <3

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

aaaaaaaaaa

»
2 years ago, # |
  Vote: I like it -16 Vote: I do not like it

leetcode monthly contest fun

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -19 Vote: I do not like it

    why downvote me??????????? wuwuwuwuwuwuwuwuwuwu T_T_T_T_T_T_T

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

solved 3 problems!!!

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    if you stay focused and don't waste time on looking at comments, you can probably solve even more

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

SpeedForces

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice Contest. Enjoyed solving the problems.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone please tell for which test case my code for D is failing?
https://codeforces.me/contest/1760/submission/181970514

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    19th token in second test case. Look at the 19th test case

  • »
    »
    2 years ago, # ^ |
    Rev. 3   Vote: I like it +1 Vote: I do not like it
    Test case
    Output
    Answer

    Actually, before printing "YES", you again have to check whether $$$c>0$$$ or not. And also before the last for loop, change the conditions (if(v[1]>v[0]) --> if(v1[1]>v1[0])) and (if(v[n-1]<v[n-2]) --> if(v1[n1-1]<v1[n1-2]))

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What's wrong in my submission for E? Lots of people got testcase 7 WA too

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Sample tests were really bad for E and G!

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, tests for G also seem to have sucked. Got TLE on system tests. Changed unordered_set to set and it got accepted. Welcome to cf I guess.

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

      You have exposed yourself to danger by using unordered_set. During the hacking stage in div3/div4/edu codeforces contests, such solutions are specifically targeted by hackers. See the https://codeforces.me/blog/entry/62393 blog for more details. Even if your solution wasn't hacked directly, all successful hacks become a part of the system test and still ruin your day.

      Python users are also in danger for exactly the same reason, see the https://codeforces.me/blog/entry/101817 blog. This made solutions like 182003822 vulnerable.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        So do you mean no one should use hash maps on cf because there will always be someone who can hack your solution and make the hash operations O(N) instead of O(1)?

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          You can use hash maps wherever they meet your needs. But you have to ensure that there is little to no possibility of constructing custom input data by abusing the hashing function, provided that an attacker knows it.

          Personally, I would not rely on out-of-the-box usage of unordered_map even at Div.1/Div.2 contests. Hash map hacks did happen there as well.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I'd really appreciate if someone could help me with the logic for F.

My approach
  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The answer can also be infinity : when the sum of a[i] over min(days,n) >= C

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think answer is Infinity if sum of min(n, d) greatest A[i] >= C since we still can do different tasks

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone help me with my submission for 1760G - SlavicG's Favorite Problem : 182028374.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

can someone share the idea and intuition behind G?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    One important property of XOR is that a^a = 0. So if you do two BFS, one rooted at A and one rooted at B, you can find nodes in the A BFS and B BFS where the XOR value is equal, so you can teleport from one path to another and reach B with XOR of 0. If this exists (there are some edge cases to consider), then it is possible.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      oh thanks alot. sorry i have another question is applying dfs with the same concept you mentioned should fail? because i tried to do this using two dfs but it failled in test2 or its just an implementation issue?

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I think you forgot this case: You should not consider the vertices in A's DFS/BFS where B coincides with the (unique) simple path starting from A.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        Try this testcase (It's possible to teleport from node 1 to node 2. And then go '2 -> 3 -> 4', so the answer is YES):
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

solved all problems in div4 for the 2nd time. feels amazing.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What's the 53rd case of second test case in G?

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

    It's about the fact that we can teleport from a too. That means if there exist any (prefix xor starting from b) == 0 then also answer is True.

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

can one explain why in D

10 10 8 10 10 4

output NO ?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    because it has more than 1 valley. one at value 8 and another at value 4.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Did any1 else mess up F for the infinity case?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yup

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Lmao. I just checked if biggest element was enough instead of the biggest d-elements, or just all if d is big.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

My solution (as following) gives wrong answer 2653rd numbers differ - expected: '4', found: '3' for 1760E — Binary Inversions.

Can anyone help me with testcases that gives wrong answer on test 2.

public void solve() {
	int n = in.nextInt();
	int[] a = new int[n];
	int tcount_0 = 0;
	for (int i = 0; i < n; i++) {
		a[i] = in.nextInt();
		if (a[i] == 0)
			tcount_0++;
	}
	long inversions = 0, count_0 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0)
			count_0++;
		else
			inversions += tcount_0 - count_0;
	}
	long ans = Long.MIN_VALUE;
	long count_1 = count_0 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0) {
			count_0++;
			ans = Math.max(ans, tcount_0 - count_0 - count_1);
		} else {
			ans = Math.max(ans, count_1 - tcount_0 + count_0);
			count_1++;
		}
	}
	out.println(inversions + ans);
}
  • »
    »
    2 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    check once with input "10". I think you need to initialize with ans=0.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

My rating is 1400 and my standings show that this contest is rated for me. So, I am a little bit confused that will my rating will change or not ...

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

t seemed like mimemamomu warmuping

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve F?

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone help in problem G? I'm getting MLE. My Solution

Approach: Starting bfs from 'a' and calculating zor as i move and checking if zor becomes equal to any edge weight that is adjacent to 'b'(so that i will teleport from here).

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There are too many statements during bfs. You can save the weight of not only the adjacent edge but from any point to "b", so that the amount of statement will be small.

»
2 years ago, # |
  Vote: I like it +7 Vote: I do not like it

Apologies if this isn't the correct place to raise suspicions, I'm new here and couldn't figure out how to report users.

There is something weird I noticed about this user — https://codeforces.me/submissions/9999999999/contest/1760

You can see him making multiple submissions specifically designed to be hacked if there is a single testcase (on the first and trivial problem). He does it by hardcoding wrong input when there is only 1 test case like so:

if(t==1) cout<<"500949585450"<<endl;

(example submission https://codeforces.me/contest/1760/submission/182047190 )

I'm not sure what the purpose is. Maybe it's a multi-account of the hacker — https://codeforces.me/profile/Adel_Mahmoud and he's just farming points? Can you think of any other explanation?

»
2 years ago, # |
  Vote: I like it -17 Vote: I do not like it

gimme downvotes pls

»
2 years ago, # |
  Vote: I like it +30 Vote: I do not like it

So, I promise that as soon as I become pupil, I will try to give my perspective of how I make my solutions, I don't think that my code is worth but maybe my perspective can give you help in the future.

A
B
C
D
E

I hope that was helpful this in some way, sorry if was not as good as you expect, when I became a better, I will make up for these bad tutorials.

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

    It's not a bad tutorial. For some formatting tips I would recommend enclosing variables in dollar signs to get the mathematical look of $$$x$$$. You can use a_{x}for $$$a_x$$$ and a^{x} for $$$a^{x}$$$. This is called latex and its quite commonly used in math. You should also use links for your codes instead of pasting them.

    For the solution themselves, you can use some advanced implementation tricks to make the code really simple and bug proof.

    For problem D for example, we see 2 phases. decreasing, then increasing.

    So we can define a phase function like


    vector<int> a(n); ... auto walk_while_decreasing = [&](int start){ while(start + 1 < n && a[start] >= a[start + 1]) ++start; return start; //Similarly for increasing }; int reach = walk_while_increasing(walk_while_decreasing(0)); if(reach == n - 1) //the array consists of these 2 phases else // it doesn't

    You could also get the exact values of $$$l$$$ and $$$r$$$ using the intermediate values of this calculation.

    For problem E you need to only consider the change of inversion. This is the same as number of pairs $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i = 1$$$ and $$$a_j = 0$$$. If we consider what happens when we change a $$$0$$$ at index $$$x$$$ to a $$$1$$$ for example, we get more inversions from the $$$0$$$s to the right of $$$x$$$, and less inversions from the $$$1$$$s to the left of $$$x$$$. Therefore the best $$$0$$$ to flip would be on the left. But this also allows you to calculate the change in inversions from changing any index $$$x$$$.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Am I the only weirdo who used segment tree to solve C?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How did you do it?

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How do we easily calculate the maximum of all array elements excluding the i-th element? It's possible to just do two range queries in a segment tree (the array part before the i-th element and the array part after the i-th element) and use the largest of these two results. In submission 181925712 I have only written the "main" function. Everything else is a copy of the segment tree implementation from the atcoder library.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Nice idea lol

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Well, I just wanted to save time instead of inventing some original solution for this particular problem (and then proving that it correctly handles all corner cases). I'm not a particularly fast problem solver and taking care of A+B+C took me 13 minutes. Without segment tree this time could be even worse.

          Your solution uses sort and you have beaten me by solving A+B+C in only 5 minutes. But now imagine not having sort function in the standard library. In this case you would need to find some decent bug free $$$O(N log N)$$$ sort implementation and copy/paste it as a part of your solution. Implementing your own sort from scratch during the contest would be a fool's errand and waste of time. Segment tree is pretty much the same and the only difference is that it is typically not provided in standard libraries of programming languages, so I need to copy/paste the atcoder's implementation.

          My $$$O(N log N)$$$ segment tree solution implemented in D language can be even tweaked to remove all loops and branches 182184534 (except for the main loop iterating over testcases) and this reduces cyclomatic complexity. For comparison, a faster Wanderkind's $$$O(N)$$$ solution 182072909 also implemented in D language is more complicated. But both are fast enough and coding speed/convenience is IMHO more important during a contest.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I agree with you on that. But most programming languages already have sort function. I personally read the problem quickly and the sample explanations and coded it. I know that I can't solve a lot of problems so I depend on speed instead. The problem doesn't really need proving but if you're looking for special cases and a full proven solution then yes Segment Tree was much better

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Is there a reason you didn't use the sort function in std.algorithm?

            I didn't because I am new to this language and I am not yet familiar with handling arrays.

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Because segment tree just happened to be my first idea after reading the problem statement. But I used sort for solving problems A and F.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I imagine not having sort and finding first and second maximums

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              This was exactly the point of my comment. Both sort and segment tree are not necessary for solving this problem. They both actually degrade time complexity. But they both are also easy to use and save time (tourist used sort 181903982 and the editorial suggests sort too). Sort is included in the standard library, while segment tree has to be copy/pasted.

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

For E, missed test case 7, just changed int to long after the contest, it got passed.

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

    Rule 1 : No matter what, always use long int

    Rule 2 : Always follow Rule 1.

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

      Or long long

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Rule 3: sometimes memory limit might be tight and you'll need to use int

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

        Yet to encounter such problems. Thanks in advance, will remember this.

»
2 years ago, # |
  Vote: I like it +22 Vote: I do not like it

My solutions (video):

A. Medium Number

Solution

B. Atilla's Favorite Problem

Solution

C. Advantage

Solution

D. Challenging Valleys

Solution

E. Binary Inversions

Solution

F. Quests

Solution

G. SlavicG's Favorite Problem

Solution
»
2 years ago, # |
  Vote: I like it +2 Vote: I do not like it

problem G: Your task is to go from vertex a to vertex b, but you are allowed to enter node b if and only if after traveling to it, the value of x will become 0.

Why use "enter" instead of "arrive at" explaining the statement? I misunderstood when solving this problem and wasted 1 hour!

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What does ios::sync_with_stdio(0); cin.tie(0); these 2 lines mean?

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

is there any source apart from codeforces so that people from India and China communicate?

»
2 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Can someone give a test case for which my code for D is failing?
https://codeforces.me/contest/1760/submission/182044338

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    Check this out:

    1
    6
    2 2 3 3 2 2
    

    The answer is obviously NO, whereas your algorithm prints YES. Seems like an issue with dealing with consecutive equal elements.

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

History repeats itself. Four hacking attempts (all are of the same submission) are now stuck either in "Waiting" or "In queue" state. MikeMirzayanov, can we do something about this?

UPD: still in queue after the final testing. Déjà vu...

  • »
    »
    2 years ago, # ^ |
    Rev. 3   Vote: I like it -13 Vote: I do not like it

    Ok cool

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

      Bro, why have you decided to use unordered_set, which has $$$O(N)$$$ worst case time complexity? It's like you made a special effort to be hacked.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -8 Vote: I do not like it

        Ohh.. is that why my solution got hacked? Damn, I thought they have O(1) in all cases. Well, according to the approach I have used what would have been a more preferred data structure ?

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          set would perfectly do it. Or even simpler: we may just sort all hashes and binary search over them.

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

            I would argue that sort and binary search isn't simpler. This requires a bit more code to be written and there is a bit higher chance to mess it up.

»
2 years ago, # |
  Vote: I like it +8 Vote: I do not like it

BTW what's a counterexample for binary inversions if I only flip either the first 0 bit, last 1 bit, or none?

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi everybody! How can i register for the competition?

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

why the rating is not increasing? I wanna see myself cyan

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

What is the difficulty of problems in this contest ??? I don't see any tag.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

@Down Though my rating less than 1400 in whole codeforces rating history and I have given more than 5 contests still my rating has not been increased after securing 2000 rank.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For the G Question it is giving me wrong answer on test case 2 . Whats wrong in this code . I am first storing the xor of path till all the node from a and b as root respectively , Then checking for common elements . https://codeforces.me/contest/1760/submission/182136945

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

    When starting from a, the dfs cannot cross b. Either arrive at b directly, or block at b because of the nonzero xor.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thank you so much . Now i got what i was doing wrong . ;)

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Have the ratings updated ?

»
2 years ago, # |
  Vote: I like it +4 Vote: I do not like it

qwexd I have given 7 contest in which I have solve more than 1 problems in almost all..Can you please check why my rating is not increasing.I am grey rated which means I have rating less than 1400.

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

    Assuming you have no competitive programming exp prior to coming to codeforces. Solving 1 problem in div 2 rounds places u somewhere between 9k-12k in rank, for getting a better rating, you need to have a better rank, for getting better rank you have to solve around 3-4 problems depending on round difficulty, A and B are generally ad-hoc/implementation type. However, from C you need to practice problems of specific tags.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      bro I am asking him why has my rating not changed from the last Div 4 round.In simple words I am asking him to check why under my contest section , it is not showing the rating change from last contest..

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It's been shown under unrated contest list for all users maybe...it could be under the unrated list until cf figures lut ratings for all users...maybe, not an official answer

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I solved the same problems with another account because the other one made a lot of stupid mistakes, but the rating didn't increased.

can you please accept it from this account and ignore the other

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Please Codeforces send Me a message said that "Your solution 181995500 for the problem 1760F significantly coincides with solutions Morad/181995500, Hussam-alwan/182013671, Rakhimov_Ans/182023461 If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. " and skipped all My Solutions And I Have not Any conclusive evidence But Only i submitted My Solution on 18:58 and anthor Person submitted on 19:26 So I Haven't an account on Idone and didn't Use it and I should Be a Specialist in this Contest !!!! please Help Me! Thanks For Your Time

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In the last div 4, my solution for the problem E Binary Inversions link to problemgot skipped due to the similarity of code from the user merahijalwa/181973274. first of all I don't know him and the similarity in code is due to code available in the geeks for geeks platform for counting the number of inversions in the array link to code from geeks for geeks website .
please consider this as this is a legit case and this is fist time i am going to reach pupil rank. please MikeMirzayanov consider this case as my case is completely legit and nor i have use any online ides. If anyone know how to contact codeforces team..please comment.

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

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Ah screw my luck. I'm 1399 now

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You will be specialist by next contest hopefully!

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

    Well, maybe you get added by one after the rating is rolled back =)

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

Why am I not rated for div4

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

    You have to participate in atleast n contest and solving atleast x problems in them to be eligible for being a rated participant, I don't remember n and x values, but you can find it in this post's description itself

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      That's the prerequisite of being a trusted participant. You will be rated regardless of being trusted, if your rating is <1400.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice Contest, Quality problemset and Good tutorial!! Kudos to the CF team & contest team

»
2 years ago, # |
  Vote: I like it -9 Vote: I do not like it

I didn't share my code to ANYONE!!!!!!! What will happen if someone locked and try to hack me,and share my code to other? YOU HAVE WRONGED ME

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Maybe try to share your code and prove that you've not plagiarized rather than screaming from next time on.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Blue coder is already out of competition for Div 4. Why bother?

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Because i did't do such thing.i dont care the rating but i do care credict.

»
2 years ago, # |
  Vote: I like it +15 Vote: I do not like it

:sadge:

»
2 years ago, # |
Rev. 2   Vote: I like it -27 Vote: I do not like it

This is a BAD round. Problems aren't FUN at all. They are too STANDARD and ROUTINIZED. PLEASE refrain from setting such rounds from now on.

UPD: PLEASE don't downvote me! I am just saying my opinion.

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

    For Div 4 these problems are very good

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

    No, I find Div4 problems better than Div2. Of course first ones are pretty standard because they are very easy, but EFGH and sometimes D are really good

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -26 Vote: I do not like it

      Nah, Div.2 problems are really BETTER than Div.4. You are JUST A PUPIL and why do you have the right to speak?

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

        No, many Div2s have really bad problems and Div4 and Div3 are always made by the same people so they always have the same good quality. And yes I'm a pupil and I will speak as much as I want

»
2 years ago, # |
  Vote: I like it -8 Vote: I do not like it

Why my rating is not updated . yesterday i saw it was there but now its gone :(

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

What means "If k can be arbitrarily large, output Infinity" in the problem F?

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

    idk if this answer your question but: If for every $$$k$$$ that i choose that is a solution, i can choose a bigger number $$$l$$$ that also is a solution, that means that $$$k$$$ is arbitrarily large.

    For example, see this input:

    2 20 10

    100 10

    The output is infinity, because it doesn't matter how big i take $$$k$$$ to be, because in the first day i can just take the first quest, gains 100 coins, and have more that 20 coins.