When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

chokudai's blog

By chokudai, history, 4 years ago, In English

We will hold AtCoder Beginner Contest 170.

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

We are looking forward to your participation!

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

| Write comment?
»
4 years ago, # |
  Vote: I like it -67 Vote: I do not like it

how to explain the first example of problem D?

thanks a lot.

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

    ya same here , someone plz!!

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

      Not during the contest. Definitely not here. You can request a clarification, maybe the Jury decides to give some further explanation, maybe they don't, but this is the only fair way to get explanation during a contest.

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

omg, My code won't even give an o/p locally but when I submit, it got accepted in Q D. xD

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

How can i see judge test cases after a contest in atcoder ?

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

Problem F is the same as this

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

Editorial:

A
B
C
D
E
F
  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thank you for editorials!

    i quite didn't get the heuristics you used in problem F: can you please write what happens when you move from dp[x][y] to dp[x + 1][y], how are your sets changing? how can your sets be defined? thanks.

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

      When moving from dp[x][y] to dp[x + 1][y] only if dp[x+1][y] hasn't been updated yet,you can use sets to find it.

      Then the cell->[x+1][y] is deleted from the set which represents column y as well as the one represent row x+1.Because [x+1][y] has been updated now!

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

    In problem E multiset can be used instead of segment tree, because u need to know min over all array and can keep all top values in multiset.

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

    In problem F, I don't understand how are you updating all possible [m][n] for state [i][j] which satisfies all three conditions, I tried it using loop from 1 to K resulting in complexity of O(H*W*K) :(

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

      I just use set to store all of the states that are not updated yet.

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

For the D problem- Let us sort the array first. Now, let's iterate through the array from the beginning. After that, the idea is to maintain a map that will store all the values that have a)appeared in the array itself b)or are multiples of those elements that have originally appeared so far, that are less than 1e6. Time Complexity-0(N*(log(1e6))), which is equivalent to an O(N) complexity Here's my submission- https://atcoder.jp/contests/abc170/submissions/14321810 Also, for the E problem, do we have to maintain a vector of priority queues?

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

    Priority queue won't be sufficient because we need to delete too from kindergarten. So I used multiset.

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

      You don't need to delete an element from priority_queue any time some child leaves it. Instead each time you want to find maximum pick the largest element from priority_queue, check if the infant in question has leaved our kindergarden and if so erase it from queue and keep going. This still is amortised $$$O(n log n)$$$ since there are $$$n$$$ insertions and each element will be deleted at most once.

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

    we can also solve E by multiset(vector of multiset). link: Your text to link here...

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

How to solve F?

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

    It's shortest path with the following optimizations:

    1) You never want to go backwards

    2) You never want to try something in the same direction, you could have just computed that before.

    My submission for F

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

Are heuristics expected to pass for F?

submission

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

Was F bfs but I think time complexity will be more with BFS solution

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

In problem D , i tried to solve by marking all multiples of numbers in array . But it gave TLE . I guess it is O(nlogn) (because it corresponds to harmonic series). submission

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

    O(n*sqrt(n)) will also work

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

    Yeah a similar concept to Seive

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

    It is not O(nlogn) because a[i] may be not unique.

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

    Why not avoid using the same number to mark others?

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

      yeah i should have done that . Later i solved by factorising the numbers.

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

    Even I got WA and TLE , I think I misinterpreted the problem statement. Can you explain how output is 5 in test case 3.

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

      Because 33,45,19,89,2 are not divisible by any other numbers other than themselves in the array.

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

    I did the same You only have to take care that you do not do working for same number again

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

I have solved all problems in a contest for the first time. Hurray!!! Here's my idea for F:

Spoiler

My submission: link

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

    Interesting idea. The reason this greedy modification works better than normal bfs is that every cell gets visited at max 4 times in your solution

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

E was a heavy implementation problem?

Upd : WA/RE teaches a lot.

Learned, why should we refactor our code. Make separate functions for the repeated tasks.

AC

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

    :( ,I think it's more like a basic data structure problem.

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

      I used sorted maps i.e (TreeMap in java ) for everything, maintained sorted lists for everything. But its just failing for 1 tc i.e random_case

      Submission

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

        I must have done many unnecessary things, cause it took me a hell lot of time code this.

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

        Here are 2 small cases where your submission fails:

        Test 1
        Test 2
»
4 years ago, # |
Rev. 3   Vote: I like it -30 Vote: I do not like it

.

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

    This is not a way to ask doubt you should not spam discussion with full code just post link of your code and try to explain your logic a little bit.

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

I created lot of treemaps and hashmaps in E and I was shocked that my code worked on the 1st go, the code got unbelievably complex though. In F, the naive BFS solution gave TLE on 2 test cases only. How to solve it efficiently?

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

    Naive bfs complexity will be O(h*w*K), which will TLE. I have explained my O(h*w*4) solution in this comment.

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

      You did not take sorting into account. It is O(hwlog(hw))

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

    Keep sets for unvisited cells (for each row and for each column), and remove cells when you add them to the queue. Then you would only look at every cell once. This introduces a logarithmic factor, but also removes the dreadful factor of $$$k$$$ in the naive solution.

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

      I solved F using a parent array which marks from where the element came into the bfs queue. Now when processing a nodes child if the node and it's child came from same parents then break the loop. This helps to solve it without the log factor and avoids moving in the same direction again and again. Solution link: https://atcoder.jp/contests/abc170/submissions/14351675

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

How to Solve F ?

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

I learnt after wasting 40 minutes in problem E that, multiset.erase() removes all occurrences of a given value from the multiset. To erase a single element, use this:

multiset<int> s;
s.erase(s.lower_bound(value));
//Make sure value is stored in the multiset!!
  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it +4 Vote: I do not like it

    This is why I use map to store number of occurrences and erase the key once no. of occurrences becomes 0.

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

    An alternative, if you don't want to worry about whether or not the value is present in the multiset:

    multiset<int> s;
    auto it = s.find(value);
    if(it!=s.end())
       s.erase(it);
    
  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yea I also learned this today in problem D

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

    or s.erase(s.find(value));

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

-->For d solution i came up with this solution

-->Created a map for count of given integers,for any number check whether its divisors present in map (or) when its count is >1 function returns false else increment count

-->solution :link

-->it passed 27 test cases and wa for 22 can any one tell what i have missed??? or corner test cases i have missed??

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

    Try this test case

    Test case

    the answer should be 0 but your code's output will be 1

    another test case where your code will fail

    Test case

    the answer should be 0 but your code's output will be 1

    Accepted code link

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

https://atcoder.jp/contests/abc170/submissions/14329950 https://atcoder.jp/contests/abc170/submissions/14331317

The first submission for problem D gives me TLE, but when I replaced at line 172, MAXN = 10^6 with the real maximum of the input, second submission got accepted and actually the difference in time is huge. Why is that? It seems really strange to me. I spent too much time on that and I was kinda lucky to come up with that replacement because I was sure that the complexity is sufficient.

Thank you !

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

How to solve problem E of todays contest ?

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

    Maintain a multiset for each kindergarden and one multiset for the maximums of the kindergardens. Now at every query you just need to insert/erase only from three multisets.

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

In problem d I thought checking all the factors will give TLE. but when 10 min was left I thought maybe I should submit the solution with TLE but rather it got accepted.

lesson learned : analysis of time complexity should be done carefully.

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

    O(nlogn) so why tle?

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

      osthir_brogrammer it's O(n*sqrt(n))

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

        I was thinking the same but it's not correct, I think ??

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

      can you explain how ??

      here is my approach: I took the frequency array, when the element was greater than 1 I ignored the element and when it was equal to one I checked all it's factors and checked if any of them were present or not.

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

        iabhishek15 Your approach is correct

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

        you can preprocess divisors of numbers from $$$1$$$ to $$$Max$$$ using this way in $$$O(MaxlogMax)$$$

        vector<int>Div[MAX+2]
        for(int i = 1 ; i < MAX ; ++i)
           for(int j = i ; j < MAX ; j += i)
               Div[j].push_back(i) ;
        

        Div[x] stores divisors of x.

        `

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

          I think now I understand the time complexity :) and this is a nice way to preprocess all the factors.

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

Did anyone solve D in O(n * sqrt(n))?

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

    I did

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

      can you give the link to the code/submission?

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

        Link

        Useful Code in case if you find hard to read my JAVA template,

        int n=ni();
        HashMap<Integer,Integer> hm = new HashMap<>();
        int[] arr = new int[n];
        for(int i=0;i<n;++i){
            arr[i] = ni();
            //hs.add(arr[i]);
            if(hm.containsKey(arr[i])){
                hm.put(arr[i],hm.get(arr[i])+1);
            }
            else{
                hm.put(arr[i],1);
            }
        }
        int ans = 0;
        for(int i=0;i<n;++i){
            if(hm.get(arr[i])==1){
                boolean pos = false ;
            for(int j=1;j*j<=arr[i];++j){
                if(arr[i]%j==0){
                    if(j*j==arr[i]){
                        if(j==arr[i]) continue ;
                        else{
                            if(hm.containsKey(j)){
                                pos =true ;
                                break ;
                            }
                        }
                    }
                    else{
                        if(j != arr[i]){
                            if(hm.containsKey(j)){
                                pos = true ;
                                break ;
                            }
                        }
                        if(arr[i]/j != arr[i]){
                            if(hm.containsKey(arr[i]/j)){
                                pos = true ;
                                break ;
                            }
                        }
                         
                    }
                }
            }
            if(!pos) ans++;
            }
        }
        pn(ans);
        
      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You can check out the C++ implementation of the same here! Submission for D

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

Lesson learned from D:

std::unique does not change vector size! must change it by myself.

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

is memory limit exceeded will show as RE at atcoder ? PS. I am getting RE for the only 1tc in problem E i.e random_10, can someone give me some corner cases? But I feel as setter must have added those corner cases in test files,this RE must be because of Memory Limit.

Submission

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

Messed up big tym n now, messing up on atcoder has become a habit :-(

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

Approach for Problem D — create frequency array for all elements and then check for each element whether any of its divisor is present in the array or not

Gives tle in one case and few wrong test cases

Link : https://atcoder.jp/contests/abc170/submissions/14362767

Any Suggestions ?

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

    I did the opposite, I marked every multiple of each element till $$$ 10^6 $$$ and stored it in an array. Complexity would be like $$$ O(n\ log\ log (10^6) ) $$$

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

    For the TLE part:- Just change your map to array.

    Accepted code link

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

In Problem F, I understand the solution where one can keep a set for every row and column, to prevent visiting a single cell multiple times.

But, after looking at some codes, I realised some solutions broke their loop if dist[cr][cc] + 1 > dist[r][c] where (cr, cc) is the current cell and (r, c) is the cell to be visited, from the current cell.

For, instance checkout this submission.

I understand the correctness of the solution, but I do not understand how this solution will pass the time limits.

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

when will they release the English editorial?

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

    In 1-2 days, in the same editorial pdf, there will be an English version in the end.

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

    It's there now

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

Can someone explain how the complexity of D is O(N*logN) (or O(N*sqrt(N)) from what I saw in other questions)? Shouldn't it be even bigger than N^2 (e.g. when I check for multiples of 1)?

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

    For the O(NlogN) solution for outer loop you are going from 1 to n,for each i from 1 to n, you are marking it's multiples, we run inner loop on all numbers N/1 + N/2 + N/3 + N/4 + ..... + N/N times which equals O(NlogN)

    you can find here proof for why N/1 + N/2 + N/3 + ... + N/N is O(NlogN) https://stackoverflow.com/questions/53240625/formula-for-the-sum-of-nn-2n-3-n-n

    For the N*sqrt(N) soln you calculate all divisors of a number in O(sqrt(N))time ,you can refer this Primality tests and you do this for all N numbers Hence it is O(N*sqrt(N))

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

    I think that the easier way to look at this is:

    N/1+N/2+N/3+N/4+N/5+N/6+N/7+... < N + N/2+N/2 + N/4+N/4+N/4+N/4 +.. = N + 2*N/2 + 4*N/4 + .. + N*N/N = NlgN

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

Can Anyone explain me D Part pls?

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

    First try to solve it for distinct elements.Traverse the multiples of every element and check whether this multiple is present in your array or not. If it is present then mark in your visited array that this element will not contribute in my answer. Your answer will be the n — sum(visited, visited + 1e6)

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

Is it possible to find english editorials for ‌AtCoder contests? I want the editorial for E and F.

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

    Just copy the Japanese text, and google translate it! I did the same, I think it's manageable

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

    check the editorial now, they have added english editorial too

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

Can someone provide some test cases for problem F?

Here is my submission (though i don't think it will help), I've used a dijkstra-based approach here.

My solution passes all TCs except 3, so i suspect that it may be failing on a corner case.

Any Help is appreciated.

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

    A small test case where your solution fails:

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

Where can I get editorials for the contest in English?? Specially for problems E and F!

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

Problem F is the same as 877D - Olya and Energy Drinks!

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

For Problem D:

It could be done so easily using dp and sieve method. Couldn’t realise on contest time :') Though dp is really <3 . Submission

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

Test cases of the contest are not seen on dropbox. It shows that the file extension is not correct. Please fix it chokudai.

I had faced a similar problem to open test case file on other contests too.

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

Here is my submission for problem E. I used the approach of having vector of multisets and erasing the maximum and inserting again for every kindergarden using the approach mentioned in the tutorial, but i am getting TLE. Can someone help me why i am getting TLE.

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

Why my solution is wrong for problem D?

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

What's wrong in my F submission?

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

    A small test for which your solution fails:

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

Can someone provide me the link to that AC code for problem E in today's beginner contest which has used ordered multiset ( i.e. they should have used policy based data structures ) ?

It would be of great help.

I have solved the question using STL's multiset....but it's just that I'm curious about using them.

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

My accepted solution for Olya and Energy Drinks gives wrong answer on 2 testcases of problem F while the one using std::set approach passes. Why? :/

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

    A small test where your solution fails:

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

    MikeMirzayanov It seems like the problem 877D - Olya and Energy Drinks has weak test cases.

    My AC submission on codeforces also gave WA on AtCoder. An example of a failed test case is the following one provided to me by dush1729:

    Input
    Expected Output

    The following submission of mine outputs 5: 47925337, but it still gets AC on codeforces. I request you to add the above test case to 877D - Olya and Energy Drinks

    EDIT: Here's another test case which ShafinKhadem has mentioned in the comment just above mine:

    Input
    Expected Output

    My AC code 47925337 outputs 11 on this.

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

Why my submission for F works corectly locally, but CE on atcoder ?

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

    Which compiler are you using to compile locally? Your code gives me compile error locally, when I use GCC 9.3.0.

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

      gcc 5.1.0, is my version too old ?

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

        I won't say too old, but I think it's better to use updated version.

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

          Thanks, I'll update it.

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

        Hi, I just tried compiling your code using GCC 5.1.0 too in godbolt. It gives compile error there. But in codeforces custom test, it compiles successfully. Which operating system are you using? Maybe your code gives CE only in linux.

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

          I think you're right, my operating system is win7.

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

          I found the reason! There is a header file called mathcalls.h in Linux and it has a function declared as double y1(double), so we cannot use #include<bits/stdc++.h> and declare y1 as a global variable at the same time in Linux!

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

            A solution to this: add #define y1 yyyy1 in your template

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

          Thanks a lot!

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

Can someone please tell what is wrong in my code for problem F? Link to my submission-->Link Any help will be highly appreciated.

Thanks!

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

Hey ! Please provide copy button (for sample test case in Tasks for printing).

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

    It's already provided. (Actually, twice each)

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

      I was talking about tasks for printing section

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

        I see. Perhaps it's no use writing here, and there's no official place to make suggestions, so maybe you have to write a UserScript or something...

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

If anyone need Problem D explanation with complexity analysis Here

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

Can someone help me with the code of problem F?

first second

I dont konw why the second code will get wrong answer.The only difference between them is the transfers about direction.I think it just needs more time to run but not to mislead the answer. Can someone help me plzzz?Thanks a lot.