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

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

2065A - Skibidus and Amog'u

Problem Credits: chromate00
Analysis: macaquedev

Solution
Code
Rate The Problem!

2065B - Skibidus and Ohio

Problem Credits: cry
Analysis: macaquedev

Solution
Code
Rate The Problem!

2065C1 - Skibidus and Fanum Tax (easy version) and 2065C2 - Skibidus and Fanum Tax (hard version)

Problem Credits: larush
Analysis: macaquedev

Solution
Code
Rate The Problem! (C1)
Rate The Problem! (C2)

2065D - Skibidus and Sigma

Problem Credits: cry
Analysis: macaquedev

Solution
Code
Rate The Problem!

2065E - Skibidus and Rizz

Problem Credits: Proof_by_QED
Analysis: macaquedev

Solution
Code
Rate The Problem!

2065F - Skibidus and Slay

Problem Credits: chromate00
Analysis: chromate00

Solution 1
Solution 2 (Skibidi)
Code (Solution 1)
Code (Solution 2)
Rate The Problem!

2065G - Skibidus and Capping

Problem Credits: larush
Analysis: Proof_by_QED

Solution
Code
Rate The Problem!

2065H - Bro Thinks He's Him

Problem Credits: Proof_by_QED
Analysis: efishel

Solution
Code
Rate The Problem!
Разбор задач Codeforces Round 1003 (Div. 4)
  • Проголосовать: нравится
  • +31
  • Проголосовать: не нравится

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

First time I tried competing in Rust. Hopefully next time will go better. Thanks for the round!

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

    ++

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

      thats great

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

    Do you recommend it?

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

Auto comment: topic has been updated by Proof_by_QED (previous revision, new revision, compare).

»
31 час назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

That was not Div4......

»
31 час назад, # |
  Проголосовать: нравится +64 Проголосовать: не нравится

I'm sure exactly zero people used the Auxillary Tree method to solve F.

  • »
    »
    31 час назад, # ^ |
      Проголосовать: нравится +19 Проголосовать: не нравится

    Even after reading the tutorial, I have no idea what an Auxiliary Tree is.

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

    It was originally in the statement :) (notes to be precise)

    It doesnt make much sense in the editorial indeed.

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

    It'll be fun to research though lol

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

    well maybe, but: I immediately thought about auxillary tree after reading F. Then I thought there must be some better/simpler solution. Then I thought of solution 1 from the editorial

»
31 час назад, # |
  Проголосовать: нравится -11 Проголосовать: не нравится

Problems really weren't newbie-friendly. The problems are excellent, but not for Div.4 contest. More like Div.3 — Div.2

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

    This was my first ever competition other than the one i gave previously. First Div 4 competition. And the first and second problem were i mean pretty easy. The third problem was tough though i was able to solve it.

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

Hope there are no more GPT or any AI during future contests.

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

I've been struggling for more than an hour to optimize Problem G, but I haven't been able to succeed.

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

pls tell me i'm not the only one that used LCA to AC F.

»
30 часов назад, # |
Rev. 5   Проголосовать: нравится +19 Проголосовать: не нравится

Alternative solution for H:

Make a segment tree, and in each node, place the following things:

  • The length of the segment (call it $$$l$$$);

  • The number of subsequences with each start and end (call it $$$C_{i,j}$$$);

  • And the number of non-equal adjacent elements across all subsequences (call it $$$ans$$$).

We can find $$$ans$$$ in the following way: either the adjacent elements are both in the left, both in the right, or one's in the left and the other is on the right. So it's gonna be

$$$left_{ans} \cdot 2^{right_{len}} + right_{ans} \cdot 2^{left_{len}} + \sum_{0 \le i,j,k,l \le 1, j \neq k} left_{C_{i,j}} \cdot right_{C_{k,l}}$$$

.

This is what the code looks like: 305334877

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

Can someone please explain why two pointer does not work in Problem C2 after sorting array b?

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

    Because a is not sorted, so while you move the first pointer forward the second pointer may move backward, then forward, then backward and so on. The solution's time complexity will be no better than O(n^2).

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

F is a very interesting question. It could've been set in a Div 2 or 3.

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

Could someone please explain why my submission for C1 is wrong?

https://codeforces.net/contest/2065/submission/305319973 (ignore "printDiffs" and "brute" functions, I used those for debugging)

I tried figuring it out but couldn't find what I did incorrectly...

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

    Think about what you should do if a[i — 1] > a[i] is not true (i.e.: a[i — 1] <= a[i]). Are there any cases where it would be beneficial to perform the operation in that case?

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

could C1 also be solved using masks? 305285624 if yes, why doesn't this work ?

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

I liked problem D. never used prefix sums like that before. Very interesting contest overall :D (A little too much brainrot for me tho). Also I was curious if using DFS/BFS is a good idea in problem F. It might be redundant, but if anyone solved with bfs/dfs, please share your solution.

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

Problems were defo not sorted according to difficulty, D was much easier than C1C2 combined! I had to do a very weird sorting pref sum thing just to solve it bcz i thought sorting according to sum was too easy,AC is AC lhamdoullah but still D shouldve been put before C

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

Can anyone tell me where this solution for problem G might be going wrong
I believe, I did it similar to the approach given in editorial

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

    Seems that your code give WA in large cases only. When $$$n \ge 460$$$ your code print a lower answer that the expected. Like, your output is for example 4098 and the correct answer is 108219. Maybe you aren't counting some semi-primes or primes.

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

Can someone pls help with F problem. I have maintained a neighboring frequency map and just checking if frequency > 1 for some element.

https://codeforces.net/contest/2065/submission/305373353

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

2065D - Skibidus and Sigma Editorial

Sort each array in decreasing order. Sort the arrays themselves in terms of their sum, from largest sum to smallest Put together the final array Take the score This score is guaranteed to be maximal.

Bolded part is a mistake?

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

Can someone please help on what mistake I'm making for Problem G,

My submission

Thank you so so much!!

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

    Maybe your code is getting TLE because of this line:

    vector<ll> freq(2e5+5, 0);
    

    You are allocating $$$2 \cdot 10^5$$$ for each test case $$$t$$$ ($$$t \le 10^4$$$), this is like $$$2 \cdot 10^9$$$ causing the TLE. The statement says that: It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.

    If you replace 2e5+5 to n+5 you'll get an AC. 305391811

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

Problem G https://codeforces.net/contest/2065/submission/305402634 Can someone please tell me what i am doing wrong I am wrong answer on 4th case

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

Brainrot Question names

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

Why my O(16 * n * logn) solution on H got tle :(

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

why this contest (DIV-4) rating is not updated...

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

    Due to large number of participation + long hacking phase + A lot of cheaters

    It takes time to asses and declare the final leaderboard, Its better to wait and get honest rating than to see cheaters getting +400 above you.

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

can somebody tell me at what test case my code might be failing 305361698

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

    PLZ Somebody help me with this

    • »
      »
      »
      16 часов назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      Nevermind sorry, the advice I gave earlier is for C2.

      I looked through your code. I would try to make sure of two things:

      1. It seems like when you shift the one in front (d[i + 1] = 1), you then set the next one to always enter the first part of the for loop. In other words, in your code, I think once you flip one in front, it always flips the one in front regardless of whether or not it should. Always check, in your code, that every flip you do decreases or increases the number if it is expected to do that. It is a bit hard to tell what the d array is used for, it seems to be telling whether or not a bit is able to be flipped but is interacting with the ones in front, which haven't been checked yet?

      2. Make sure your code is not O(n^2) time complexity. I think your funci() and funi() functions are O(N), and if these run on every index, you might get a time limit problem because doing this on every index is O(n^2). I am not 100% sure of this.

      Sorry for the initial wrong example/

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

Question H's tutorial has faulty LaTeX in the "Solution" section near the bottom. In the last math's pseudocode, there's some oplus1 thing. I think it's just supposed to be s[j] XOR 1.

»
16 часов назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

CAN ANYONE EXPLAIN WHY THIS APPROACH TO c WAS WRONG?

https://codeforces.net/contest/2065/submission/305299896

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

    we need something greater than prev( i.e, a[i-1]) in the ith position. two options: a[i] and someB-a[i].

    how do we find someB such that someB — a[i] >= a[i-1]? binary search for someB >= a[i-1] + a[i].

    However, your binary search looks for the incorrect equation.

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

Does anyone tell me why my O(16 * n * logn) solution on H was TLE ? I read William Lin's solution and it may the same with mine

Here is my solution https://codeforces.net/contest/2065/submission/305249433

Here is William Lin's solution https://codeforces.net/contest/2065/submission/305272835

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

Lol I didn't solved B. after 1st wrong submission big mistake

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

I’m working on problem C2 and I’m unsure where my code is going wrong. Could anyone help me figure it out?

void solve () {
    int n,m;
    cin>>n>>m;
    vector<int>a(n),b(m);
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<m;i++) cin>>b[i];
    sort(b.begin(),b.end());
    a[0] = (b[0]- a[0]) < a[0] ? b[0]- a[0] : a[0];
    for (int i=1;i<n;i++) {
        int ind = lower_bound(b.begin(),b.end(),a[i-1]+a[i]) - b.begin();
        if (ind < m && b[ind] - a[i] <= a[i] && b[ind] - a[i]>= a[i-1]) {
            a[i] = b[ind] - a[i];
        }
        if (!(a[i] >= a[i-1])) {
            cout<<"NO"<<"\n";return;
        }
    }
    cout<<"yes"<<"\n";
    return;
}


int main()
{
    int ct ;cin>>ct;
    while(ct--)
    {
        solve();
    }
    return 0;
}

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

    You're only applying the operation when you get a shorter element compared to current one. But this is not always true.

    Consider the case:

    a = [6, 4] b = [1000]

    You won't apply the operation on 4, because it would be substituted to > 4(1000 -4), but if you've used that you should've got a non-decreasing array.

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

Hello, could someone please tell me when Codeforces typically runs the plagiarism check? For example, how many days after a contest does it occur? Also, for round 1002 div 2 , have the plagiarism checks (and the process of skipping certain solutions) been completed, or are they still pending?

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

Thanks for the round )

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

Hey, Proof_by_QED can you please add the implementations of the problems? Thank you for your attention.

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

in B initially my code got accepted now shows wrong on testcase 3 wow :<

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

Proof_by_QED 2065D - Skibidus and Sigma Problem D: In the editorial, it is mentioned to sort each array in descending order (last paragraph) but it is not allowed to do so in the problem. We only have to sort the arrays in descending order according to their sum.

If it was allowed to rearrange the array, then definitely sorting each array would give the maximum score!

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

I started from the end in C2 problem, and maximize the element but less then its next element, but i get wrong answer.

can anyone tell why this approach is different from the given approach

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

    May be you have not considered the case for less than or equal to. Or maybe some implementation issue!

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

ARE RATINGS UPDATED?

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

forgive

»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
void solve() {
  ll n,m;
  cin>>n>>m;
  vi a(n),b(m);
  get(a,n);get(b,m);
  if(n==1){yes;return;}
  vi c(n);
  f(i,0,n){c[i]=b[0]-a[i];}
  vector<vi>dp(n,vi(2,0));
  dp[0][0]=1,dp[0][1]=1;
  f(i,1,n){
    if(a[i]>=a[i-1] && dp[i-1][0]){
      dp[i][0]=1;
    }
    if(a[i]>=c[i-1] && dp[i-1][1]){
      dp[i][0]=1;
    }
    if(c[i]>=a[i-1] && dp[i-1][0]){
      dp[i][1]=1;
    }
    if(c[i]>=c[i-1] && dp[i-1][1]){
      dp[i][1]=1;
    }
  }
  if(dp[n-1][0] or dp[n-1][1]){yes;return;}
  no;
  
}[problem:2065C1][contest:1003div4](Alternative approach for C1 using dp)
»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

hi everyone ! Could anyone please help me? Got some troubles on C2, it falls on a 2nd test, but ~7000th token. Cant figure out what the problem is:( 305525156