chokudai's blog

By chokudai, history, 6 months ago, In English

We will hold AtCoder Beginner Contest 166.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

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

»
6 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Thank you atcoder for the wonderful weekend !!

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

I wish it will be a good round!

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

Why so easy A,B,C,D,E?

  • »
    »
    6 months ago, # ^ |
    Rev. 2   Vote: I like it -53 Vote: I do not like it

    Atcoder beginner contests are just a joke. Only 1-2 good problems (probably E and F) and others are just fillers. Atcoder beginner contests should be of Div-2 difficulty or atleast in-between Div-2 and Div-3.

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

      I think it's actually for Division 2. That's why it is called as Beginner's Contest

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

        I think it's Div.3, because there are three kinds of regular contests: ABC, ARC, and AGC.

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

      Still, ABCs are good enough for a guy with 0 ratings.

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

        Anyone give me a counter test case where my logic fails for F. I have done a greedy approach , where for each string , I will increase the one with min value and decrease the one with maximum in b/w those two variables and storing the values accordingly and then printing.

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

    I think F is easier than E. (I'm trying to solve F)

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

    D was very interesting.

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

      what's the solution for D??

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

        If answer exist(for given x there always exist a pair (A,B)). It will be -1000<=A<=1000 and -1000<=B<=1000. use two loop

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

          why -1000 to 1000?

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

            Actually I took -1000 to 1000 for safety. but u can see (100)^5>1e9. U can take -120 to 120 too. It will also pass

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

              Thank you so much

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

              May be not I tried

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

              say if the difference given to us comes at (1000)^5- (999)^5

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

                the number (1000)^5 — (999)^5 is greater than the possible range of values for x

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

    "B" in "ABC" stands for beginner.

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

      Even Div-3 contests in codeforces are also for beginners but they don't ask you to print the circumference of the circle with a given radius or swap 3 numbers.

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

        or just print what is said! AGC AND ARC are good by the way

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

Why so much hate in this world cry

Get AC on A, B, C, D, E and WA only on the last of the 60 tests of the F...

»
6 months ago, # |
  Vote: I like it +21 Vote: I do not like it

![ ]()

»
6 months ago, # |
  Vote: I like it +26 Vote: I do not like it

How to solve F!

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

    Keep alive this round, try to alive next round(Be careful when there are two 1, and one 0).

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

    Always increase a smaller variable and decrease a greater one in a pair, except for the one case: when two variables you need to change are $$$1, 1$$$ and the third one is $$$0$$$, in this situation you have to choose what variable to increase depending on the next request in order to avoid a case like where you have $$$2, 0, 0$$$ and the next request is $$$BC$$$.

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

    Here's my solution.

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

How to solve problem E?

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

    You need to use the frequency map, In first loop perform f[ i — a[i] ]++, and in second loop perform count += f[ a[i] + i ]. that's it

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

    For two attendees to pair i-j = hi + hj (Assume i>j) should hold where i and j are indices of the attendees. Move both the i terms on i side and j terms on the other then it reduces to i-hi = hj + j. Which is equivalent to finding number of comment elements in two arrays by making arrays for both i-hi and the other as hj+j.

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

    E is pretty easy if you make the observation that for any j > i following condition has to holds, j — A[j] = A[i] + i. so keep a map to count the occurrence of A[i] + i observed till now. add the count of j — A[j] into the answer.

    solution

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

    You need to find number of pair of indices such that |j-i| = A[i] + A[j] . Assume j > i, then, you need to check which (i,j) satisfy j — A[j] = i + A[i].

    You can start iterating from left, keep a count of i+A[i] and for every new index j, do, ans+=count[j-A[j]]

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

    Store somewhere $$$(index_{i}+height_{i})$$$ and any index ask how many $$$(index_{curr}-height_{curr})$$$ already exist. add this to final $$$ans$$$. finally return the $$$ans.$$$

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

    We are considering j > i so we need to find all i and j such that

    j - i = a[j] + a[i] which is a[j] - j = - a[i] - i

    so for each j we need find count all of those whose value - a[i] - i is equal to a[j] -j. We can use a map to store values of - a[i] - i and add it to our answer in each step for value a[j] - j.

    Code

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

    Just use the fact that A[i]+A[j]=abs(i-j) expands to i-A[i]=A[j]+j (atleast in positive value of abs sign). For the other one it'll cover cases by symmetry. No compute the two arrays with entries i-A[i] and j+A[j], store the counts of elements in a frequency map and return the answer.

    A simple solution is here

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

    An easy code to understand

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

why greedy for F fails? anyone Please?

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

    What do you do when both A and B are equal and next event is AB?

    For example: A = 1, B = 1 and C = 0 and event is AB.

    You need to check if next event is BC or AC and work accordingly. Can't just make anyone of it +1 and other -1.

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

      Yeah for this I did offline thing. At every stage I checked if both are equal then which is having more query remaining. So the one with higher no of query remaining I add to it(give it priority)

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

        You should give priority to the next closest move, not to the most frequent among remaining. For example A = 1, B = 1, C = 0, and the sequence of moves is AB, AC, BC, BC, BC. On move AB you should add 1 to A, to make move AC possible, not to B, even though BC is more frequent.

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

this F is not very hard,i think,but has a number of details to deal with.

i finally got accepted after 5 tries with a loooooooooooooong code.

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

Got 457 lines of code in F)

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

E anyone?

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

I had a lot of TLEs with my solutions for this contest. For example, here is my code for problem E (C++):

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
		int N, count=0;
		cin>>N;
		int att[N];
		
		for(int i=0; i<N; i++){
			cin>>att[i];
		}
		
		for(int i=0; i<N-1; i++){
			
			for(int j=i+1; j<N; j++){

				if(abs((i+1)-(j+1))==(att[i]+att[j])){
					count++;
				}
			}
		}
		
		cout<<count;
	}
	

I got AC for half of the test cases, and TLE for the other half. Can anyone tell me why?

Also, if someone can tell me what might generally be the case when AtCoder grading returns a TLE, please let me know. Thanks in advance!

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

    Your code has a complexity of O(N^2) and N is 1e5. So that is why you are getting TLE.

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

      I see. Thank you! I'll review my other solutions that got a TLE to see if they have the same problem.

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

    This is clear O(n^2). See the constraints. n<= 2*10^5. simplify the expression |id1-id2|=a[id1]+a[id2] ==> id1-id2= -(a[id1]+a[id2]) maintain LHS and RHS in different arrays and just count how many times element from LHS array occurs in RHS array. My Submission

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

    TLE = Time limit exceeded.

    Checking every possible pair (complexity O(N^2)) is not efficient enough for such a big value of n as 2*10^5.

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

    try an O(n) solution

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

What is the approach for F?

I tried defining each of the 8 choice possibilities (For AB choose A first or B if both remain, similary for AC and BC) at the start and check if it works. Do you have to do something like this at each step and maintain an 8 * n DP or something like that?

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

    My solution was to choose such an option that I will survive current and also next round. If both choices are survivable then go greedy.

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

    You could just run a DFS and check if you can reach a path of length n. Start with state a,b,c and then at each point proceed to a 2 posibble state given by choice[i].

    Here is my submission: https://atcoder.jp/contests/abc166/submissions/12776155

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

    I tried with 27*n dp but it failed

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

      Any one passed using dp?

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

      i did a 64*n dp which got AC.

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

        can you share your approach. Also explain your dp states

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

          I have similar (maybe even the same approach) — you can notice that we don't care what a value is if it's bigger than 3, so we can have states (position, a, b, c), and after each step a = min(a, 3) and so on. You have 64 * n states and two transitions from each state. Here's my code

          https://atcoder.jp/contests/abc166/submissions/12752950

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

            we don't care what a value is if it's bigger than 3. I think we can make a=min(a,2), with 27*n states is also acceptable. my submission

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

            Can you share your intuition behind why don't we care for values that are greater than 3 (or 2)?

            Why just taking 3 would do? I understand by looking at examples but am not able to wrap my head around it. It would help if you could share your intuition perhaps.

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

              This whole idea came to me when I noticed that configuration "1 1 1" is always correct if we choose greedy approach (add 1 to smaller of two). That led me to conclusion, that if sum is bigger or equal to 3 (unless it's 3 0 0 and operation is BC) is always correct as well. Connect this with pretty natural DP solution and you get my solution. If you have more questions feel free to ask

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

    Greedy approach can get AC, You only need to check a couple of things first :

    • If one of them is 0 you have to add it +1.
    • If both of them 1, you need to check which one comes next first, for example if the order is AB then BC ( A = 1, B = 1, C = 0 ) you have to add +1 to B otherwise you add it to the other.
    • If you're not in any of the other cases you can just add +1 to the minimum of them.
    • Keep checking if one of them is less than 0 return No

    Solution : https://atcoder.jp/contests/abc166/submissions/12771073

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

      why does this work

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

        It can be easily shown if one value is greater than the other, it's safe to increase the min value. Our only concern is when both values are equal to 1, that way one of them will become a zero, we need to know which one to increase. The choice is based on which value will be used again first. Same example as the last comments : A = 1, B = 1 and C = 0 it will depend on the order.

        • Suppose the order is : AB then BC, if we increase A our solution will fail.

        • And if the order is : AB then AC then if we increase B our solution will fail too.

        It is clear that we need to increment the value that comes next first in that case.

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

      UPD : Deleted

»
6 months ago, # |
  Vote: I like it +24 Vote: I do not like it

For F I did complete search using recursion and it passed. Can anybody explain why?

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

    Maybe Highly optimized,choose the right answer first, so it succeed when first get into end state.

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

    Can you share your code?

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

    It all comes to when is the answer No : The only possibility it fails is if there are 3 zeros or 2 and a certain ordering to make it fail. That being said, The answer can be found fast enough for both cases.

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

can someone help me in problem D ?

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

    D is quite easy. You just need to use brute force and compute all fifth powers of numbers from -1000 to 1000, and then you can use an O(n^2) algorithm to see if x is equal to the difference of any two. Code

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

      pff i feel so stupid !! thanks bro

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

      In my first atempt i used 100 instead of 1000, and it failed. But the 1000 was only a lucky guess.

      How would we find the correct minimum number?

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

        Find the smallest number x for which (x^5-(x-1)^5) > 1e9.

        I think it comes around 120.

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

        I guess look at $$$b=a-1$$$ for boundary condition because that minimise $$$x$$$ for given $$$a$$$. I tried $$$100$$$ because I misread number of digits in $$$100^5-99^5$$$. Then I used $$$200$$$ and it passed.

      • »
        »
        »
        »
        6 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        • for (i in range 0 -120 )
        • for (j in range -64 i-1)
        • if (i^5 -j^5==x) — done You can find detail here
  • »
    »
    6 months ago, # ^ |
    Rev. 2   Vote: I like it -6 Vote: I do not like it

    I don't have a strong proof as to why will there always be a pair less than |a| , |b| <= 10^3 but had some intuitive feeling and it ACed

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

      x^5 — (x-1)^5 is an increasing function for postive integers. The first time its value crosses 10^9 is when x is around 10^12.

»
6 months ago, # |
  Vote: I like it +16 Vote: I do not like it

English Editorail of F

Three Variables Game • When A + B + C = 0, N is 1 or more, so the answer is No. • When A + B + C = 1, at least one of the two variables is zero at any time, so the action on each turn is uniquely determined. • When A + B + C> = 2, the answer is No if the variables added and subtracted in the first turn are both zero, otherwise the answer is Yes. In the latter case, you can keep one of the variables being added positive by taking the following strategy each turn. {When one of the variables to add and subtract is zero and the other is positive, add one to the one that is zero and subtract one from the other. (A + B + C = 2, the variables to add and subtract are both 1, and when the character string of the next turn and the character string of the current turn are different, not the last turn, the character addition and subtraction of the next turn is performed. Add 1 to the variable you plan to do and subtract 1 from the other. {Otherwise, select appropriately

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

What wrong in my code for the problem D

x=int(input())
value=0
index=0
hashmap=dict()
while value<int(1e9)+1:
    value=pow(index,5)
    hashmap[value]=index
    index+=1
#print(hashmap)    

for i in range(1,64):
    b1=x+int(pow(i,5))
    b2=x+int(pow(-i,5))
    if hashmap.get(b1)!=None:
        print(hashmap[b1],i)
        break
    if hashmap.get(abs(b2))!=None:
        print(hashmap[abs(b2)],-i)
        break     
»
6 months ago, # |
  Vote: I like it +3 Vote: I do not like it

the language of D and E was so clear still couldn't solve it, got WA on last test case of E and TLE on D. I like atcoder's format easy language difficult task .makes these problems more approachable. Thanks Atcoder

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

Please help me with problem E and F

»
6 months ago, # |
  Vote: I like it +17 Vote: I do not like it

Yay I full solved all 6 problems with 0 incorrect attempts!

Timing was slow though :(

»
6 months ago, # |
  Vote: I like it +1 Vote: I do not like it

I thought the problem statement on B was not clearly defined. Otherwise, it was such a great contest! got WA on both D and E because I did not take long. Feel like killing myself :( Gonna upsolve F now.

»
6 months ago, # |
  Vote: I like it +12 Vote: I do not like it

I solved D by expressing A^5 — B^5 as (a − b)(a^4 + a^3*b + a^2*b^2 + a*b^3 + b^4).

At this point, I iterated over all possible divisors. Since a-b < (the term consisting of all positives), I only had to check the divisors less than sqrt(X). Then, once a-b was set, I binary searched to find the value of b (if any) to satisfy the expression.

My final runtime: optimized O(sqrt(X)*log(X))

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

    You can also check if A^5-B^5 equals to x for all a and b from -200 to 200. It's faster.

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

    Wow so there exists a good way to do this thanks.

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

    can you share your code

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

      This code is easier
      Code
      just check from -1000 to +1000
      because if a = 1001 the minimum positive result is b = -1000 and the result is 1.0004901e+20 and it's bigger than x

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

        It can be -120 to 120, 120^5-119^5=1,019,663,401, it's bigger than 1e9.

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

    Yeah I also did first part of your method, but I think it was overkill when I looked at $$$100^5-99^5$$$. So I wrote the easy brute force.

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

    what do you mean by term consisting of all positives ?

    I didn't get this part:

    Your Code:
»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone explain D solution?

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

    A and B values lie between -1000 and 1000. So you can brute forces using two loops and find if A-B==X. you can print that A and B value.

»
6 months ago, # |
  Vote: I like it +1 Vote: I do not like it

In codeforces https://codeforces.com/contest/1345/problems we get list of all problems, how to do the same in atcoder, like all the task they appear in the same page. If anyone knows please comment the link of that page where all task appear on one page.

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

I overkilled F with dp, followed by 14-15 RTE's :(

PS: Atcoder could really work to differentiate between MLE and RTE.

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

Solution in simple words:

A. Just check the input string.

B. Compute the food each person has. One can use a frequency array to do this.

C. Iterate through all paths. Each path makes one observatory non-peak (or two, if they have same height).

D. Since $$$a^5 - b^5 = X > 0$$$, we have $$$a > b$$$, that is $$$b \leq a - 1$$$. So $$$a^5 - (a - 1)^5 \geq a^5 - b^5 = X$$$. Obviously $$$f(x) = x^5 - (x - 1)^5$$$ is increasing when $$$x > 1$$$ and decreasing when $$$x < 0$$$, so we can find the upper and lower bound of $$$a$$$ from $$$X$$$. Simply enumerate all possible $$$a$$$'s and check if $$$a^5 - X$$$ is the fifth power of some integer. This can be done with precomputing all fifth powers in the potential range. In practice we can use a looser bound to estimate the range of $$$a$$$.

E. Consider the number of pairs $$$(i, j)$$$ satisfying $$$i < j$$$ and $$$A_i + A_j = j - i$$$. Fix $$$j$$$, the number of $$$i$$$'s pairing with $$$j$$$ satisfying $$$A_i + i = j - A_j$$$. Just iterate from left to right and keep the frequencies of all $$$A_i + i$$$.

F. In each operation we can greedily take $$$1$$$ from the greater number and add $$$1$$$ to the smaller one. The only exception is there being two $$$1$$$'s and one $$$0$$$ and we are going to operate on the $$$1$$$'s. We have to create another $$$0$$$ in this operation, so we need to consider the next operation in order to make it doable. The answer is No if any operation creates a negative number.

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

what is said in problem B !! did not get it guys!

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

    There are N snukes and K kinds of snacks. From the second line to the last line, in every two lines it gives how many and which snuke does the i snack have.You just need to find the number of the snacks which have no snuke.

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

I used normal bruteforce approach for problem D. It worked fine for 31,32,33 but for any other input value it gave no output. I used codechef ide,hackerearth ide,ideone,gfg ide but in all it gave no output. Then I took an AC code and try getting ans for random input between 1 to 1e9 but it also gave no output.And when I submitted my same code it got AC on atcoder. Pls can anybody tell what may be the reasons?

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

My python solution12793022

I am getting WA for one test case (killer_05.txt). Can somebody please tell me what am I missing? Thank you.

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

I would appreciate it if someone provide me the English editorial.QwQ

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

https://atcoder.jp/contests/abc166/submissions/12803726 i am getting wrong ans on killer test 5 Can somebody help me out. It is for problem F atcoder 166

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

    I read it a bit fast but I think your mistake is in this case: "if(a[id1]==a[id2] && a[id1]==1 && a[id3]==0)".

    You are not taking into consideration the other special case where a[id2]=1 and a[id3]=0. Also the way you are searching for the future cases is wrong because you assign a char variable to a string one.

    Generally, I think that you only need to check for equality and increase the a[id], which is the one that will participate in a future choice sooner than the other.

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

can someone tell what's wrong in my solution for problem C https://atcoder.jp/contests/abc166/submissions/12819281

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

For D — detail explanation and reduced range of searching with code Here