cry's blog

By cry, 3 weeks ago, In English

2037A - Twice

Problem Credits: cry
Analysis: cry

Solution

2037B - Intercepted Inputs

Problem Credits: cry
Analysis: chromate00

Are you a python user and failing test 4?
Solution

2037C - Superultra's Favorite Permutation

Problem Credits: sum
Analysis: chromate00

Solution

2037D - Sharky Surfing

Problem Credits: cry
Analysis: chromate00

Solution

2037E - Kachina's Favorite Binary String

Problem Credits: vgoofficial
Analysis: Intellegent

Solution

2037F - Ardent Flames

Problem Credits: vgoofficial
Analysis: vgoofficial

Solution

2037G - Natlan Exploring

Problem Credits: vgoofficial
Analysis: vgoofficial

Solution
  • Vote: I like it
  • +68
  • Vote: I do not like it

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

nice fast editorial

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

    hello can u help me what promblem with this hack : ~~~~~ // this is code

    include

    using namespace std; int main() { cout << 200000 << endl; for(int i = 1; i <= 200000; i++) { cout << 999983 << ' '; } cout << endl; } ~~~~~ thanks

    • »
      »
      »
      89 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Which problem is this for?

    • »
      »
      »
      85 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You cannot ends a line with extra space in the input

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

fast editorial !! thankYou

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

damn quick editorial

»
3 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Very Nice contest. :)

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

fast tutorial

»
3 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Damn! Ultra Fast editorial Great Contest. Very good problems, Thanks!

»
3 hours ago, # |
  Vote: I like it +14 Vote: I do not like it
»
2 hours ago, # |
Rev. 18   Vote: I like it 0 Vote: I do not like it

could anyone help me to figure out what is wrong here:292060911

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

    You're taking powerups you can't have.

    bad code

    Think about this test case:

    this breaks
  • »
    »
    100 minutes ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Working soln: https://codeforces.me/contest/2037/submission/292084754

    You can't take every powerup.. you always need to compare with current_hurdle

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

yotta fast edito'

Thankkyou

»
2 hours ago, # |
  Vote: I like it +19 Vote: I do not like it

Hi everyone, I apologize for the statement for D being unavailable for ~15 minutes during the round. It turns out I misspelled \textbf which caused the PDF to not generate. :(

  • »
    »
    19 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For 2037F - Ardent Flames can you please explain which intervals are we talking about here? — sorting the events of intervals starting and ending by time and how are we trying to do binary search?

    • »
      »
      »
      16 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      The intervals are possible $$$p$$$ such that $$$m-|p-x|\geq\lceil\frac{h_i}{q}\rceil$$$. You do binary search on the answer, and if such $$$p$$$ exists, you move the right bound to the mid; otherwise left bound.

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

very cool round, thank u.

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

I liked this contest, especially C exercise was interesting and pretty quirky at first :D Hope to see more div3 contests in the future

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

Can someone take a look at my implementation? (since below is my thinking for E which matches the tutorial exactly)

IMPOSSIBLE if and only if there exists no "01" substring, which is equal to querying the entire string and getting an answer of 0.

Otherwise, there is some "01", and we start querying all the prefixes [1, 2], [1, 3] ... [1, n]. Suppose the first one to give a non-zero answer is [1, i]. Let that answer be R. Then, since all prefixes before [1, i] gave 0 as an answer, the string over [0, i-1] is i-1-R 1's followed by R 0's. Also s[i] must be 1. To determine the suffix s[i+1, n], we query over the prefixes still [1, i+1], [1, i+2] ... [1, n], and, at each query, if the answer increases from the previous one, we have a 1 there, otherwise it is 0 there. In total, we take exactly 1 query for each char in s[2, n], meaning we require n-1 queries.

Implementation: https://codeforces.me/contest/2037/submission/292068546 (skip to very bottom, there is a bunch of template stuff at top)

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

    Bro you should return int in the function

    char(this should be int) interQuery(int a, int b) { std::cout << "? " << a << " " << b << endl; std::cout.flush();

    int r; cin >> r;
    return r;

    }

    Good luck Mate..!!

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

      NOOOOO WTH, I didn't solve E due to that BS!!! :(((( This is genuinely heartbreaking -- the difference between being rank ~1500 and being rank ~500

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

Thanks for the contest, I was glad to participate) Thanks for explaining task G, I was very hesitant when I sent it and got a time limit exceeded on the 5th test

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

D felt like it would be hard problem at first but once u start solving it I found it easier than C

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

I was waaay off for D. i was thinking graphs. Thanks for the learning.

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

As a Pythonist participant, thanks for covering test 4 on Problem B that gives TLE verdict with dictionaries. I too got this verdict: Submission 291964656 Then, using set for tracking a prior occurrence worked on Submission 291974200 , instead of having to rely on the suggested collections.Counter().

Will have to see if this get hacked or failed in any of the main test.

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

非常好的题目,使我大脑旋转:D

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

Help me with this please: 292083026

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

How to implement the Inclusion-Exclusion in G?

I knew about the principle and just did a bunch of for loops which at least look kinda cool :D 292061306 but I see others used other method.

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

    its essentially iterating through the masks, if the number of elements we're grabbing is even, subtract it, otherwise add it

»
106 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

i think it would be better to have G1 with lower constraint on $$$a_i <= 10^3$$$ to allow
$$$O(n*max(d(a_i)) ^ 2)$$$ solution as there are max 32 factors up to 1000, but anyways nice problems.
Thanks for the contest!

  • »
    »
    82 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It would be solvable in O(nA), where A is maximal a[i] with dp[x] = # of paths ending at element x, so it would be too easy.

»
105 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

I am unable to understand why am i getting idleness time limit exceeded. — https://codeforces.me/contest/2037/submission/292077028. Please someone help.

  • »
    »
    94 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Try with following test case, it shows "!" as answer

    2
    01
    
»
92 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone suggest some binary search problems like F (same or little higher difficulty) please.

  • »
    »
    81 minute(s) ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Q3 and Q4 of today's leetcode weekly contest. Q3 is easier (*1300 in cf) and Q4 is harder (*2000 in cf).

»
91 minute(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi I have two doubts.

First, why in problem B, using dictionaries in Python give TLE, but AC in C++?

Second, what is wrong in my code for problem E? https://codeforces.me/contest/2037/submission/292049495

I query (1, i) for i from 1 to n, find the first point where this value is non zero, and if this value increases fill in 1, else 0.

»
66 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone help me with this solution for D. 292088654

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

292093110

can someone pls see why this gives a wrong ans and what do I need to change ?

»
18 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

What's wrong with my solution for D? it gives tle(test-2). 292076200

  • »
    »
    8 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    $$$i=h[k].second$$$ and the following $$$i=h[i].second$$$ are wrong. They're coordinates, not indices.