Sanae's blog

By Sanae, 7 days ago, In English

Thank you for helping Marisa, Reimu, Cirno, Sanae, Amanojaku and Momoyo!

Leave a comment!

2228A - Marisa Steals Reimu's Takeout

Author: Sanae

Solution: Sanae

Step 1
Step 2
Step 3

2228B - Remilia Plays Soku

Author: Sanae

Solution: Sanae

Solution

2228C1 - Cirno and Number (Easy Version) and 2228C2 - Cirno and Number (Hard Version)

Author: Sanae, Sugar_fan

Solution: Sanae, Sugar_fan

Solution

2228D - Sanae, Cross and Color

Author: Sanae

Solution: Sanae, fanhuaxingyu

Solution 1
Solution 2

2228E1 - Amanojaku and Sequence (Easy Version) and 2228E2 - Amanojaku and Sequence (Hard Version)

Author: Sanae

Solution: Sanae

Tutorial: CirnoNine, fanhuaxingyu

Sanae's Solution
CirnoNine's Solution
fanhuaxingyu's Solution

2228F - Momoyo and the Network

Author: Sanae

Solution: Sanae, juan_123

Sanae's Solution
juan_123's Solution
  • Vote: I like it
  • -90
  • Vote: I do not like it

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

i feel bad that i missed n=3 case in B :(

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

    I also missed that case n <= 3 I looked for all the options but didn't find a solution.

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

    me also ;( i didn't notice this case even though i found the answer

»
117 minutes ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

today is more cheaters in this contest than expected cf should take strict action on this

»
117 minutes ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

how did people use fenwick trees for D? I tried this but got 6-7 TLEs / MLEs, despite trying to optimize constant factors, use lighter trees, rewrite in C++, etc

eventually I had to use a prefix/suffix approach to pass

  • »
    »
    108 minutes ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

    That wasn't even enough for me. I ended up passing with O(n) inner loop and pragma AVX. I'm going to run some benchmarks once practice opens up and will report back

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

    I passed easily with $$$O(n)$$$(without optimizations) and got TLE in Pretest #19 with $$$O(n \log n)$$$. I guess that's normal.

»
110 minutes ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

let d be the number of digits of a,can any tell if we generate all possible numbers with the 2 given digits of length=d and check for min difference (2^18, recurrsion), i dont know digit dp, and check for the largest number with (d-1) digits and smallest number with (d+1) digits , will it work??

  • »
    »
    101 minute(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    No because there are up to 10,000 test cases, and you might be doing 2^18 operations for each one

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

I wasted too much time on D because it doesn't allow $$$O(n \log n)$$$ algorithms to pass, so i didn't finish calculating E1's equation :(

Feeling bad because I succeeded to pass the example of E1 ten minutes ago, which is just 25 minutes after the contest :(

Hope that my rating won't decrease for that..

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

Maybe the problem F is so much similar to 2222G - Statistics on Tree?

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

In Problem D, What is the idea behind forcing the constraints that some (N log N) solutions pass and others not ??

If the author think that this kind of forcing constraints will make the problem anti AI, I think he made it harder for humans than AI.

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

    Initially, I only intended for the $$$O(n)$$$ solution to pass...

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

      I feel like a more explicit decision should have been made. As of now, it seems the n log n editorial solution works only when written very tightly and in C, and java/python/etc users also get screwed.

      Also visually n log n with 2 million * 21 looks like it should run fine. Even when I sped up the inner loop to O(n) (but still had std::sort and std::set to do coordinates), I still got TLE.

»
100 minutes ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

Make your complaint.

»
92 minutes ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

I am a fan of wdoi, but this contest is not good enough.

E is too complex and meaningless as Div2 E. I don't think any problem with difficulty <=3000 should use so looong calculation.
And F has a very classic and simple solution: just use binary search, then use simple dp and sorting to check. You can just pass with $$$\Theta(n\log n\log V)$$$ complexity, or sort before binary search and use two-pointer to get $$$\Theta(n(\log n+\log V))$$$.

Plz bring better problems to participants at next contest of wdoi, and accept suggestions about problem. Thx.

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

    Addition: I expect E2 worth >=2600 difficulty, but 100+ participants pass this problem, and F is easier with less pass. How many cheaters in Div2??? That is insane.
    If an(/a) expert/specialist pass this E2 in 1 hour is common, I think people can still challenge AI :)

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

my submission:- https://mirror.codeforces.com/contest/2228/submission/374854997

can anybody tell me what's wrong with this

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

    plz mention what approach you are using for anyone to read your code easily.

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

    so first of all we get the string of a and remove first charecter until it is not in D

    then we make two cases

    b > a

    in this case pick sallest number > d if no then don't compute this case and make all other numbers smallest possible

    compute both numbers

    and take abs difference

    same is done with the second case

    now when b has less digit then a just get x = number of digits in a and take maximum digit in d x — 1 time to get this value and again update answer

    the case with more digits is handled this way

    if(d[0] || d[0]==0&&n>1) {
                    ll tr=0;
                    for (int i = 0; i < sz+1;i++) {
                            tr=tr*10+(d[0]==0?d[1]:d[0]);
                    }
                    ans=min(ans,abs(tr-a));
            }
            if(d[0]==0&&n>1){
              
              ll tr = d[1];
              for (int i = 0; i < sz; i++) {
                tr *= 10; 
              }
              ans=min(ans,abs(a-tr));
            
            }
    
    

    here sz is number of digits in a

    • »
      »
      »
      46 minutes ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      605 4 2 5 6 9

      Correct answer: 6

      Use this test case to debug. It is incorrect to remove all the numbers in the beginning that match. There are cases where it is optimal to not match all the beginning digits.

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

Misunderstood B :(

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

    If Remilia does not move at turn 1, k is still 1, so Remilia can move at turn 2. Not "can move before turn k", true is "can move most k turns".

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

    if initially the distance of both sides are the same, The first player stops at its place for 1 round. And then the second player would decrease the distance by moving in either direction. After the 1st round, they start chasing each other in the same direction. So it's still min_dist + k.

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

      Yep! Misunderstood this one, as k is the time going on, Thanks for making it clear!!

    • »
      »
      »
      47 minutes ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      But, somehow I had to add $$$1$$$ to the answer if the $$$\operatorname{abs}(dist1-dist2)\leq1$$$, because $$$\text{Remilia}$$$ would choose not to move in this case, so $$$k$$$ remains the same but the initial $$$min\_dist$$$ decreases by $$$1$$$.

»
85 minutes ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

I didn't like this one :(

A was fine B wasted a lot of time because I thought k was the total number of Remilia moves (it's total number of moves Remilia makes where she doesn't stay in place). It's my fault for misreading but still feels bad. C isn't that bad conceptually but it got REALLY bad once I started implementing. idk I find these kinds of questions where there isn't an insight just caseworking super boring. D looks interesting but I didn't get to it because of ABC :(

»
84 minutes ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

What was the intended solution for C1? Is it the same as C2? If so, why did you split C into two subtasks? The editorial's solution doesn't seem like it would be more complex to implement for 10 digits instead of 2. I started writing a brute-force solution for C1 (checking all 2^18 possibilities), but then realized that there are 10^4 tests per case and abandoned it.

»
79 minutes ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

I used binary search for C1 and C2. I don't really know how to explain it look at my submission: 374842701, if you struggled with implementation I would look at it because it's a lot simpler than greedy

would say L contest but I got paid off with expert performance

Also, are hacks disabled for any problems?

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

CaseForces

»
77 minutes ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

C has many cornercase without effective examples.What a "wonderful" problem.

»
72 minutes ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

B was super obvious but unfortunately I spent a lot of time trying to find the n=3 edge case. C1 and C2 are the same solution basically and problems like this are super boring, not creative just implementation hell.

»
52 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
»
36 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

E1 we can solve for sum of cubes or higher powers right?

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

didn't C need some heavier formalism to really define if b = 0 is always a possible solution or not? For me, at least, that wasn't clear at all; but I might be bugging.

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

what is the point of asking n=2 soln for c1