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

Автор Pa_sha, 3 года назад, По-английски

Hello Codeforces!

We are pleased to invite you all to participate in Codeforces Round 891 (Div. 3), which will start on Aug/07/2023 17:35 (Moscow time).

The format of the event will be like any Div. 3 rounds:

  • 6-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.

We encourage participants with a rating of 1600+ not to create new accounts but to participate unofficially.

Only trusted participants of the third 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 third 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 1900 or higher in the rating.

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

Problems have been created and written by our team: FBI, Esestree, JuicyGrape and Pa_sha.

We would like to thank

Good luck!

UPD: There was an error on problem F. We fixed the tests and rejudged solutions . We apologize for that. It only affected a few people whose solutions passes all tests now. Also some hacks were already added to the tests and broke some of solutions.

UPD2: Editorial

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

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

As a developer who happened to be the leader of the team, I would say you just these two words. Good luck!

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

I hope the contest will be good, in advance I congratulate you on becoming the authors of the contest on cf

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Keep Calm & Create Interesting Competitions For All

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

As a coordinator the guys have prepared an interesting competition for you!

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

As a tester, I hope div3 users will enjoy this contest from well-prepared problems.

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

As a first-time tester, this is the best contest I’ve tested :) I hope you’ll like the problems!!

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

We know hacks do not give additional points, they just take away points .,.

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

Hoping it will be a great round of Div.3. Best of luck to all contestants!

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

As a coach of these guys, I am delighted to see their first performance as problem setters at Codeforces, as well as to see positive feedback from the testers. I do believe that problems are well-prepared and fascinating. Also, I hope that everyone (including Grothendieck, the mathematician after whom we called our team) will enjoy the contest.

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +37 Проголосовать: не нравится

As a tester, I can assure you that the problems are of high quality, and you will definitely enjoy solving them. Please, read all the statements. Even if you find yourself stuck on a problem — try to solve the next one.

Good luck! May the skill be with you.

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

As a first-time tester, all the problems are fun and well-prepared. I hope you will enjoy the contest and earn a positive delta! Good luck!

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

First Unrated Div3 :)

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

Tomorrow : Problem A : dp on a tree ):

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

Ukranian Contest!

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

Hoping to become cyan in this round.

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

Good Luck everyone!!!

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

Wish everyone can enjoy the Div.3 round, let's gooooooooo!

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

Ukrain rocks!!!

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

I will solve at least five problems.

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

hope a good round, although i will be unrated.

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

Hope that I can get back to expert.

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

I wish good luck to the participants and no problems during the round to the developers! I am also very glad that now more and more different teams are preparing div-3 rounds! ✨

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

hope everyone rating increse after div 3 , good luck everyone !

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

Currently, There's a variety in teams who prepare DIV 3. Interesting UwU

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

Hope to become expert

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

Hope to be Specialist this round.

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

I really like it when I see the problem setters of the contest have solved thousands of problems, when their rating graphs has lots of ups and down, because they know the struggles of people who have practiced a lot and lot but still face problems during contest. And they set problem keeping these things in mind.

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

Hope to become expert!

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

A div 3 prepared by Ukrainian and Russian, I love this.

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

 Hope to become at least Specialist in this round . ;(

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

안녕, i am a (beta) tester

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

Hopefully i will be pupil again. Good Luck guys!

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

Hope to become Specialist :)

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

Wow, so the writers are all from Ukraine!

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

Good Luck!

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

Hoping it will be a great round of Div.3. Best of luck to all contestants!

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

I hope to get close to 1600 or above.

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

John Cena wishes you luck

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

Hope that the statement is clear and short

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -10 Проголосовать: не нравится

Speedforces!!

Speedcoding is a different kind of fun...

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

idk but i feel like this contest might have been a little bit hard :)

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

I see a lot of negative comments, and I don't know why, as the statements were pretty clear and problems seemed fine, just like in the last 2 contests.

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

G is absolutely beautiful!

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

How to solve F?

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

    Hint: for each pair of x and y, there is only one set of numbers which satisfies a + b = x and a * b = y

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

    If ai is part of a pair then ai+(y/ai)=x, which gives a quadratic equation. Solve it and you get the values of ai and aj. The rest is simple combinatorics. Be careful of the case when the quadratic equation has zero or one solutions.

  • »
    »
    3 года назад, скрыть # ^ |
    ← Rev. 5  
    Проголосовать: нравится +1 Проголосовать: не нравится

    For every $$$(x,y)$$$ the is at most one unordered pair of integers $$$(a,b)$$$ such that $$$a+b = x$$$ and $$$ab = y$$$. You can find $$$a$$$ and $$$b$$$ via quadratic quation.

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

    You can store the frequency distribution of a_i in a map and then just try to solve the quadratic. If roots are equal, answer is n choose 2 where n is frequency of the root otherwise, it is n1*n2

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

    Solved it 5 minutes after contest sadge. The answer is pretty simple, just notice that you can rewrite your two equations as two quadratic equations and then apply the quadratic formula.

    a_i + a_j = x means that a_i = x — a_j. And if you insert this in a_i * a_j = y you get a_j*(x-a_j) = y which can be written as a_j ² — a_j x + y. And the same for a_i.

    Then quadratic equation gives you two possible solutions x — sqrt(x*x — 4*y) and x + sqrt(x*x — 4*y). So you just see how many of these elements are in your array to make an answer out of and you get your answer :)

    https://codeforces.me/contest/1857/submission/217739412

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

      Bro i saw your code what is (x+thing)%2 in that can you please explain

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

        Sorry for the non-descriptive name, but thing is just the square root of the discriminant. You can see that in the quadratic formula the answer is (-b +/- thing)/2a. Which is (x +/- thing)/2 (which you see in the code)

        The reason we have (x + thing)%2 in our code, is just because we are working with integers and not floating point numbers. If (x+thing) was an odd number, then the quadratic formula would've given us a non-integer as an answer, which we know we can't have, so we exclude those cases.

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

How to solve G ?

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

B was a little unclear for me. also hard.

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

Thanks for the round. I solved until problem E. Problems up to E were fine for me, except for problem B.

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

Missed F by 30 seconds. F

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

I feel like Problem B was too hard for D3B.

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

What's the test 24 on pG:(

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

very easy with problem F, but i wasted time for B, and D, E , F is more easy than D or E.

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

B = C >> F for me, solved in in 7 minutes but for the next hour couldn't solve and implement B and C correctly. Feels so bad ;(

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

Problem statement of B is the ultimate example of "How not to write a problem statement".

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I solved C using this. Can it be optimized further? 217736885

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

What does "Unexpected verdict" mean in hacking?

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

guys when does results will come

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

Appreciate it :) I really enjoyed the round.
I wish I could notice earlier the fact that
the description of problem B was actually describing normal round operation, but still I had lessons learned.

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

B was an unclear statement take me a lot of time to understand!

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

Good contest. Enjoyed. But F, it was just like: "Hey! do you know quadratic equations?"

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

rename this contest to Div.2 ):

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

What the hell was B? very bad problem statement!

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

solved E, F but unable to solve D :v. Wasting time for thinking about graph and reverse graph :v

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

Why does this code give WA in problem G? Can you help me please to find a mistake in the code? https://codeforces.me/contest/1857/submission/217742367

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Solutions for problems A, B, C, D and E were on youtube during the contest again. Can't codeforces contact Youtuble to delay codeforces related videos when there is a contest? + Why do people even cheat? Why are they getting from cheating?

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

FBI Why where is no such test in F that $$$x^2 - 4y$$$ is not a full square?

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

I think the problem statement in C is kind of easy to be misunderstood.

It's quite sad that I couldn't solve C despite solving (preliminarily) D E F.

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

Mathforces

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

How can we solve problem C? what's the intuition behind and are there any similar problems?

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

I really enjoyed the contest, and in my opinion B wasn't that bad like other comments say, but the implementation was tricky

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

Can somebody look into my solution for C: https://codeforces.me/contest/1857/submission/217718886 I am not able to find the mistake. Thanks.

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

Guys please give some hints to D, I's stuck there

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

None of the CF extensions are working. Not even CF Get Rating or CF Analytics. It shows codeforces API error. I just wanted to know my predicted delta. Anybody else with the same error?

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I dont know what this line mean after the TC "It is guaranteed that the sum of n over all tests does not exceed 10^3"

Most of the prb I notice but not able to understand what they say I need to sum n values of every TC, or the array sum of n not exceed 10^3 or what they mean

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

    Each test has some number of test CASES. I believe you're referring to problem C here.

    There are some (unknown) number of tests, but that doesn't matter since your code is run once for each test. The time limit is also per test.

    For this problem, there can be up to 200 test cases per test. Each test case can have n up to 1000, but the sum of all test cases in one test cannot exceed 1000.

    So if there is a test case with n = 1000, there is only one test case. Or there could be 10 test cases with n = 100 each. Or 2 test cases with n = 700 and n = 300.

    Usually, the worst-case scenario test is one TEST CASE with the maximum n and this is the important takeaway.

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I my opinion hardness of Problem G sharply increased.

»
3 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +61 Проголосовать: не нравится

Good contest overall problems was fun! However I noticed there is a bad test case on problem F. In the constraints, it stated that x and y had to have at least an absolute value of 1 or greater. However, test case 7 had queries where x = 0, causing my code to fail. :(((((((( I've noticed a lot of other people failed this case too, so ig i have the power to make this unrated :p

Submission: https://codeforces.me/contest/1857/submission/217663720

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

problem D hadn't pretest like:

1 
2
-1000000000 -1000000000
1000000000 1000000000

is it good?

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +38 Проголосовать: не нравится

Problem statement of F mentions $$$1 \lt =|x|$$$ but testcase 7 has $$$ x = 0$$$ and $$$ y = -9$$$ as one of the queries.

This should not fail in my opinion if $$$x \neq 0$$$ was ensured.

Edit: incorrect link

»
3 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +4 Проголосовать: не нравится

F's pretests were really weak i forgot to check the most important condition whether the (-b + sqrt(D)) is divisibly by 2 or not :O. A lot of hacks incoming

  • »
    »
    3 года назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +12 Проголосовать: не нравится

    I don't think it's possible for (x + sqrt(x^2 - 4y))to be odd. 4y is always even. If x is odd, x^2 must be odd. Then odd - even is odd. So sqrt must be odd. So, x + D is even.

    Similarly you can argue for the case where x is even.

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Just wanted to get some clarification, for the problem D of today's contest. I got this weird error in the following submissions (using java):

When I submitted equivalent code using long, it worked (using java): - https://codeforces.me/contest/1857/submission/217686813

Using int, cpp code worked though: - https://codeforces.me/contest/1857/submission/217741962

Anyone has any idea what might have happened? I would really appreciate the help. Thanks in advance.

»
3 года назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

Task C is complete constructive shit. I liked all the other tasks very much.

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

Can anyone suggest me some better approach in E? MY submission https://codeforces.me/contest/1857/submission/217726880

  • »
    »
    3 года назад, скрыть # ^ |
    ← Rev. 3  
    Проголосовать: нравится 0 Проголосовать: не нравится

    i think, the only optimization here can be not finding lower_bound(vb.begin(), vb.end(), va[i]), but using just i instead, because anyway you get 1 from segments like [a, a] and lower_bound adds logN to your complexity. The idea seems ok.

    Edit. I'm sorry for not noticing that, but this way you should use vb for iterating through the indices, not va. So, you don't actually need va except for reading the input :)

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

well i got RE for 7 times in D 217669362 (exit with 11:java.lang.IllegalArgumentException: Comparison method violates its general contract!) and solved in this version 217692889 ...never got exception like this before,can anyone tell me why?

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

Why were all problems except G math-y?

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

look at this guy's submission Stark663

I think he is a cheater

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

Why am I getting MLE at test case 4 in F? MY submission https://codeforces.me/contest/1857/submission/217743843 How can I optimize it?

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

made video explaining A&B&C&D:

https://youtu.be/elQ4jmUfYqM

thought would be usefull for community

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

It was contest with the most creative (also good) problems I have ever participated.

Although B may be difficult for many people, it can be in best problems for last contests. Also E and G were pretty good. But I think F was too mathematical, perhaps you could add another problem which more greedy or more algorithmic.

Thanks for the great contest, I love it :D

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

TY for the contest <3

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

Please check this blog , Problem F constrains has (1 $$$\le$$$ $$$|x|$$$ $$$\le$$$ 10^9).

Meanwhile in test 7 many test cases have x = 0.

I don't know what should happen in this case, but please do something about it.

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

I get it nvm

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

open upsolving please

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

If I hacked someone, but it was unsuccessful. Do I lose points?

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

I don't know why my solution is failing for F: https://codeforces.me/contest/1857/submission/217724931 Can somebody help me?

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

I managed to solve up to E during the contest and F afterward. The problems were nice, they were from various topics and I enjoyed solving them.

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

What was the approach for E?

I got TLE here : https://codeforces.me/contest/1857/submission/217725866

»
3 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +4 Проголосовать: не нравится

Math tag for problems ×

Math tag for contest ✓

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

The round was made unrated?

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

G is beautiful

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

Had sys test finished?

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

It is writtent that tis contest is rated for everyone having rating less than 1900. But my rating haven't updated current rating :-806

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

My F was hacked. Can someone tell what's the issue?

My Submission : 217815371

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

Can anyone help me find out why this submission for F is getting tle? 217653085

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

WHY did code give TLE in system testing (PROBLEM -F)

#include <bits/stdc++.h>
        using namespace std;
        #define int  long long 
        const int N = 200000;
        int p=1e9+7;

    void solve()
        {
            int n;
            cin>>n;
             unordered_map<int,int>mp;
             for(int i=0;i<n;i++)
             {
                int a;
                cin>>a;
                mp[a]++;
             }
             int q;
             cin>>q;
             while(q--)
             {
                  int a,b;
                  cin>>a>>b;
                  int val=sqrtl(a*a-4*b);
                  int count=0;
                  if(val*val==a*a-4*b)
                  {
                    if((a+val)%2==0)
                    {
                     int num1=(a+val)/2;
                      int num2=a-num1;
                      if(num1==num2 )
                      {

                        count+=(mp[num1]*(mp[num1]-1))/2;
                      }
                      else 
                      count+=mp[num1]*mp[num2];
                    }
                    else if((a-val)%2==0)
                    {
                         int num1=(a-val)/2;
                      int num2=a-num1;
                      if(num1==num2)
                      {
                        count+=(mp[num1]*(mp[num1]-1))/2;
                      }
                      else 
                      count+=mp[num1]*mp[num2];
                    }
                  }
                  cout<<count<<" ";

             }
             cout<<endl;


        }

        signed main()
        {
            int t=1;
            cin>>t;    
            while(t--){
                solve();
            }
        }
»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why F using unordered_map will TLE?

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

what is causing TLE in problem E?

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

I see the system testing has stopped at 100% for a while xD.

Hmm, it's 20:00 in my timezone and I haven't eaten yet T.T

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

Rating changes???

»
3 года назад, скрыть # |
← Rev. 7  
Проголосовать: нравится +13 Проголосовать: не нравится

Why is the contest frozen for so long MikeMirzayanov FBI

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

Never expected such good performance by me in such div 3 contest

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

Problem C is much much easier than problem B

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

Problem B was good, but the test cases weren't exhaustive during contest, it didn't help with the fact that codeforces was down so had to use m1 lite version which didn't show my submission time and solution was accepted, although i should have written efficient code in the first place, but this kind of gave false positive until solutions were hacked :(

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

Nice!!!Through this round of Div3, I became Pupil for the first time!

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

I never understand the pointing system... I mean although i just solved one question how could i lose points for that??

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

I got a TLE because of umap on F QwQ

I was so close to AK :(

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

Fun round for sure! Really enjoyed D, E and F, even though had to re-solve them after the round. Good tasks for a begginer, since they did indeed give me some new approaches!