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

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

We will hold パナソニックグループプログラミングコンテスト2023(AtCoder Beginner Contest 301).

The point values will be 100-200-300-400-475-500-600-625. (Since this ABC, we adjust the point values depending on problems.) We are looking forward to your participation!

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

»
12 месяцев назад, # |
  Проголосовать: нравится +46 Проголосовать: не нравится

Finally Atcoder is adjusting point values depending on their difficulties:P

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Moral of this contest: Never use alts to try to consume all the penalties for your main account. (even with unrated register) If so, both accounts will be deleted automatically.

»
12 месяцев назад, # |
Rev. 2   Проголосовать: нравится +11 Проголосовать: не нравится

Perfect, 502 Bad Gateway and 504 Gateway Time-out was all we needed!!

»
12 месяцев назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

DDOS again :(

»
12 месяцев назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

Anti-DDoS is very hard to break!

»
12 месяцев назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Imagine Naming a problem Anti-DDoS and the server suffers from DDoS problem

»
12 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D?

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится -9 Проголосовать: не нравится

    Digit DP

    • »
      »
      »
      12 месяцев назад, # ^ |
        Проголосовать: нравится +18 Проголосовать: не нравится

      it's not digit DP

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

        Can you point out the mistake in this approach? We first replace all '?' with '0' and store indices of all '?' in a vector. Then we iterate on every element x of the vector and check if setting xth bit to 1 would give a number smaller than or equal to N. If you get a valid number, change '0' to '1' at that index.

        Code
        • »
          »
          »
          »
          »
          12 месяцев назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Never mind, I got it. It should be 1LL << i instead of 1 << i.

          Got WA x 2 due to this small mistake. :(

      • »
        »
        »
        »
        12 месяцев назад, # ^ |
          Проголосовать: нравится +9 Проголосовать: не нравится

        I didn't know that there exists an easier solution, I just said how I solved it.

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

      You guys did DP?

      I did it by greedy
  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Implementation :( I unwanted memoized it with dp my submission.

    DDOS didn't get chill with me.. when I play good round gets unrated and when bad gets rated :(

  • »
    »
    12 месяцев назад, # ^ |
    Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится
    Solution of D
  • »
    »
    12 месяцев назад, # ^ |
    Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

    I've solved it with a greedy technique.

    My Algorithm is:

    1- Compute the current value of string S in decimal representation and neglect all '?' symbols in it

    2- Iterate over string S from MSB (most significant bit) and check if the current symbol is '?' and the (value of current value of S + pow (2, size(s)-idx-1)) is less than or equal to N, then I'll flip this symbol to 1 and add pow (2, size(s)-idx-1) to current value of s, else I will flip it to 0.

    My Source code

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

    I tried solving it using DP. Here is my solution (in case, you are interested).

»
12 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can I somehow download the test case? problem E, last test.

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    I also was getting WA on that test case. I had a typo in my solution. While checking the distance from the starting point to the goal, I was doing $$$<t$$$ instead of $$$<=t$$$

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    I faced the same problem,

    I thought he had to stop once he reached the Goal square (meaning he can't visit the goal square multiple times). This was giving WA.

    Maybe the wording of the question could have been better :(

»
12 месяцев назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Why does my code fail 2 out of 34 cases in problem C? Is there some edge case I am not considering?

Python: https://atcoder.jp/contests/abc301/submissions/41383662

C++: https://atcoder.jp/contests/abc301/submissions/41382728

  • »
    »
    12 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Counter:

    Input:  
    ttttac
    @@@tac
    Output:
    No
    Correct Output:
    Yes
    

    You should reduce firstone[i] by 1 when firstone[i] > secondone[i] similar for secondone[i].

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

      Oh, thank you!

      Sorry for the late reply, I am not online very much. I appreciate the assistance.

»
12 месяцев назад, # |
  Проголосовать: нравится -24 Проголосовать: не нравится

I found D much harder to solve than E. 😿

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

My solution to problem E is as follows.

  1. use bfs(two times) to find the minimum distance from S to any cell, and from G to any cell;
  2. use bfs again, to find the distance between any two cells with candies;
  3. use dp[st][last], where st is the state of bitmask whose 1s denote that these candies have been taken, and last denotes the last candy that we take, and this dp could be computed with the help of a queue.
  4. from each dp[st][last], we compute the total distance to reach G, and if it is <= T, then we could update the maximum number of candies that we can take.

Is this the intended solution or there is some simpler one.

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

    you just re-invented the traveling salesman problem. Congrats!

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

    Can't we use recursion on all the candies, because the maximum count is 18. I followed your first and second as it is but my solution got TLE.

»
12 месяцев назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

didnt get in contest but f was fun, thanks to authors

»
12 месяцев назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Something really weird happened to me in problem C today. I got WA and I lost almost the entire contest trying to find what was wrong with my code. Now I managed to get AC by changing only one line in my code:

The only difference is how I iterate the string "atcoder". I guess in my first code there is some kind of undefined behavior. Does anyone know why iterating with for(auto c:"atcoder") is wrong?

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

    Please run the following snippet in AtCoder's custom test page:

    Spoiler
  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится +2 Проголосовать: не нравится

    That's because in the first case, "atcoder" is considered as a character array and not as a string.

»
12 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

May I ask when the data for abc301 will be available? Thank you.

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve F? tutorial hard to grasp.
I reversed the string and was looking for SoDD, I can maintain capital followed by small letter So but not sure how to maintain two equal capital letters DD in the DP solution?
https://atcoder.jp/contests/abc301/tasks/abc301_f