l-_-l's blog

By l-_-l, history, 14 hours ago, translation, In English

And here is the Editorial!

We hope you liked the problems. Thanks everyone!

\[^-^]/

2091A - Olympiad Date

Tutorial
Solution

2091B - Team Training

Tutorial
Solution

2091C - Combination Lock

Tutorial
Solution

2091D - Place of the Olympiad

Tutorial
Solution

2091E - Interesting Ratio

Tutorial
Solution

2091F - Igor and Mountain

Tutorial
Solution

2091G - Gleb and Boating

Tutorial
Solution
  • Vote: I like it
  • +33
  • Vote: I do not like it

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

Problem D O(1)

void solve(){

ll n,m,k;

cin>>n>>m>>k;

ll total=(n*m-k)/n;

ll kena=m-total;

cout<<(ll)ceil((float)kena/(float)(total+1))<<endl;

}

int main(){

ios::sync_with_stdio(false);

cin.tie(0);

int t=1;

cin>>t;

while (t--)

{

    solve();
}

}

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

    wcnb

»
11 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

F has a nice explanation

»
11 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

Praise the sun! Solaire posture

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

In G, I wasn't able to prove the fact where the answer will always be $$$k$$$ or $$$k - 2$$$ for $$$s \ge k^2$$$, so I am posting my solution for the same.

Main thing to note is that for each value of power $$$x$$$, we only need to consider $$$x$$$ different residues modulo $$$x$$$, and particularly for each turn around step we only need to consider the maximum $$$x$$$ values we can reach if we are travelling forwards or the minimum $$$x$$$ values if we are travelling backwards. Running complexity is $$$O(k^2)$$$ for each valid $$$k$$$ resulting in overall complexity of $$$\begin{equation} \sum_{i=1}^{k} i^2 = O\left(\frac{k(k+1)(2k+1)}{6}\right) \end{equation}$$$

Edit: My Submission — 312461704

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

What is the reason behind of making k <= 1000 and sum of k <= 2000 in G? I just didn't write the code because I have never wrote an n^3 algorithm for n <= 1000. And yes it has very nice constant factor and in practice works very fast. But why couldn't u make it like k <= 800, sum <= 800, any unintended solutions that pass under smaller constraints?

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

    When it comes to this kind of question it is safe to guess the conclusion, we are almost certain that not all $$$k$$$ will be traversed, and ultimately there must be very few valuable $$$k$$$, see my submission 312426354, where we note that the run time is very short.

    Edit: I think this problem may be related to the harmonic series, which has only about $$$\log{k}$$$ valid numbers.

»
10 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Cool contest!

In fact there are two ways to approach the problem $$$F$$$: either by counting ways to reach the current 'X' index from the neighboring 'X' indices or vice versa, counting ways to reach the neighboring 'X' indices from the current. The first approach can be implemented with prefix sums and the second via a difference array.

»
9 hours ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

In problem G I just "felt" the algorithm wouldn't run slow, then I submitted the code and got AC.

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Interesting G.

»
8 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

Using derivatives to prove the $$$\Theta$$$ of G may be more intuitive&simple (⑅˃◡˂⑅)

»
7 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for a great contest!!!

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

As per my current rating, of 1076, If I have solved questions till E, how much will the rating change ?

  • »
    »
    6 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    0 as your solutions will be skipped for copying from chat gpt lol

    • »
      »
      »
      6 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      intuition might be of your own but the implementation is completely done by gpt, solve less but when you do, fully understand and implement on your own, it's just more satisfactory, also I have nothing against you so chill ^_^

»
6 hours ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Problem D

#include <stdio.h>
int main()
{
    int t;
    scanf("%d", &t);
    int n, m, k, groups, num;
    while (t--)
    {
        scanf("%d%d%d", &n, &m, &k);
        n = (k - 1) / n + 1;        // max num per row (ceil)
        groups = m - n + 1;         // m = (group - 1) + n;
        num = (n - 1) / groups + 1; // num per group (ceil)
        printf("%d\n", num);
    }
}
»
6 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Maybe it will not be bad to expand a little bit on how k * k < s will result in either k or k — 2, l didn't realize this fact during the contest qwq.

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

Problem D O(1)

void solve(){
    int n , m , k;
    cin >> n >> m >> k;
    int ans = m / (( n * m - k) / n + 1);
    cout << ans <<endl;
}
»
5 hours ago, # |
Rev. 5   Vote: I like it +3 Vote: I do not like it

Can G problem be solved in $$$O(K^2)$$$
My Solution: Submission

Consider that $$$s < k*k$$$

  • It can be observed that the visitable points form continuous ranges. I try to maintain the visited points as ranges $$$[lx , rx]$$$.
  • My claim: number of continuous visited ranges (segments) are <= k, after every turn.
  • Reason: Say power was $$$x$$$ , so adjacent visitable ranges have atmost x gap. So for the next turn with power $$$x-1$$$ the adjacent ranges would definitely merge, new ranges are created only at the boundary points.
  • Propagating the intervals to any multiple of x can be done using sliding window.
  • I am bad at explanation, Correct me if i am wrong anywhere.
»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can any one explain another approach for problem f ?

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

in d part for the binary search suose you wrote while(l<=r) you get TLE error ,can someone tell me the calculation why ?

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you are not changing the l to mid+1 or changing r to mid-1, that is the issue. you are just writing l and r = mid.

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

can anyone please explain me in problem-G; when s=10 and k=4 how is the answer 2

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    • $$$power=4$$$, move to $$$x=8$$$
    • $$$power=3$$$, move to $$$x=8-6=2$$$
    • $$$power=2$$$, move to $$$x=2+8=10$$$
  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    go forward twice with power 4 go backward twice with power 3 then, you can go forward to x=10 with power 2

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

Guys I can see my rank on friends standing but not on common standings page, will my submissions be skipped?

I didn't copy from anyone else. I copied SieveOfEratosthenes which was available before contest on gfg page which doesn't violate cf rules. So why can't I see myself on final standings page?

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

Some how I find C is the most difficult one among A-F, I have read the editorial, but can not I find a way to come up with solution, why people can relate to the fact that even length can not be constructed in the first place then gradually come up with the solution?

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Great Contest!

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

What's the approx limit of operations in 1 sec on CF ? In prob E, what's the final tc of the whole code. imo its [1o^3 * (n / ln(n))] which is still 7 * 10e8. Wouldn't it give tle given 2 secs?

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

How easy is problem c,but it still trouble me a long time

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

Don't forget to praise the moon!

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

There is an O(1) solution for D. It is as follows (Python 3):

for _ in range(int(input())):
    n, m, k = map(int, input().split())
    distribute = -(-k // n)
    groups = m - distribute + 1
    ans = -(-distribute // groups)
    print(ans)
»
100 minutes ago, # |
  Vote: I like it +1 Vote: I do not like it
F using DP+prefixSum + difference array
  • »
    »
    46 minutes ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    very easy to understand (for me at least), thank you

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

O(k^2logk) solution for G.

For convenience, we will only consider the round of jumping to the right here. The turn that jumps to the left is symmetrical. If the current jump distance is k0, then for each modulo result of k0, we only need to record the smallest position. Because smaller positions can always jump to larger positions. Next, consider turning at each position. These positions, such as d, d+k0, and d+2k0, must form a cyclic interval in the form of k0-1. What we need to do is to take the maximum value of the cyclic interval for the arithmetic sequence. It can be achieved using a suitable data structure.

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

Problem D O(1)

int minimumLongestBench(int n, int elements) {
    int numOfSeparators = n - elements;
    return n / (numOfSeparators + 1);
}

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    int elementsInMostCrowdedRow = (k % n == 0) ? k / n : k / n + 1; // after deviding on all rows
    cout << minimumLongestBench(m, elementsInMostCrowdedRow) << endl;
}