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

Автор chokudai, история, 6 лет назад, По-английски

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!

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

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

how to explain the first example of problem D?

thanks a lot.

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

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

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

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

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

Problem F is the same as this

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

Editorial:

A
B
C
D
E
F
»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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?

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

How to solve F?

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

Are heuristics expected to pass for F?

submission

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

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

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

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

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

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

Spoiler

My submission: link

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

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

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

.

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

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?

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

How to Solve F ?

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

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!!
»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

-->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??

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

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 !

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

How to solve problem E of todays contest ?

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

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.

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

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

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

Lesson learned from D:

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

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

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

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

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

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

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 ?

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

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.

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

when will they release the English editorial?

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

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)?

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

Can Anyone explain me D Part pls?

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

    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)

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

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

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

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.

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

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

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

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

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

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

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

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.

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

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.

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

Why my solution is wrong for problem D?

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

What's wrong in my F submission?

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

    A small test for which your solution fails:

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

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.

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

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? :/

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

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

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

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!

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

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

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

If anyone need Problem D explanation with complexity analysis Here

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

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.