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

Автор awoo, история, 4 года назад, По-русски

1766A - Extremely Round

Идея: BledDest

Разбор
Решение (BledDest)

1766B - Notepad#

Идея: BledDest

Разбор
Решение (awoo)

1766C - Hamiltonian Wall

Идея: BledDest

Разбор
Решение (awoo)

1766D - Lucky Chains

Идея: BledDest

Разбор
Решение (adedalic)

1766E - Decomposition

Идея: BledDest

Разбор
Решение (BledDest)

1766F - MCF

Идея: BledDest

Разбор
Решение (BledDest)
  • Проголосовать: нравится
  • +77
  • Проголосовать: не нравится

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

ratttttttttttttttttttttttttttttttttttttttttttttttttttttting plz

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

When will the ratings update? :(

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

It is the first time that I will have a oringe name. I really want it could update rating as quickly as possible.plz

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

I didn't read B properly and thought that $$$n$$$ could take on values other than the length of the input. I thought I needed to implement a complicated LCP+Suffix Array method than ran in $$$O(n*log(n)^2)$$$ to greedily compute the minimum number of operations needed to produce the resulting string, which I wasn't able to do during the contest.

Here's my solution which actually computes the minimum number of operations: 185016918

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

In A why 184918763 got TLE?

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

    That's why you are grey.

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

    Because you are iterating from 1 to n in each case. So the time complexity would be O(t*n) which would give TLE. You have already calculated if each i is extremely round or not. Just construct a prefix sum array which would tell how many extremely round numbers are less than i. Then you can answer each case in O(1).

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

    Your algorothm takes n (n = the given integer) iterations of the loop for each test case. At worst, your algorithm will have to do $$$999 \ 999$$$ iterations of the loop for each test case. A test set can contain up to $$$10^4 = 10 \ 000$$$ test cases. Your algorithm might need to do $$$10 \ 000 \cdot 999 \ 999 = 9 \ 999 \ 990 \ 000 \approx 10 \ 000 \ 000 \ 000 = 10^{10}$$$ iterations of your loop. C++ can do around $$$10^8$$$ operations on average in one second. Each iteration of your loop contains 4 fast operations: i<=n, f[i]==1, ans++ and i++. Even though these are simple and fast operations, c++ can't execute that many of them in under 3 seconds.

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

For D, we can consider only prime divisors of $$$y-x$$$ because to minimize the answer, if it's possible to get $$$\gcd(x,y) \neq 1$$$ for a certain composite $$$d$$$ s.t. $$$d|(y-x)$$$, it's definitely possible for some prime $$$p \lt d$$$ and we can reach multiples of $$$p$$$ at least as soon as we reach a multiple of $$$d$$$.

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

state transition graph for 1766E([i] represent for a sequence end with i)

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

Nice round. I think D and E are the best problems I've ever seen.

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

Video Editorial of Problem C : Hamiltonian Wall Link : https://youtu.be/p4-bUeGfs48

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

E is simply brilliant.

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

The complexity given for B is wrong. It is O(1). There are 26^2 possible unique 2-letter strings. Any string longer than 26^2+1 will have at least one repetition due to the Pigeonhole Principle.

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

I still don't understand why we need all the prime divisors of each number in C. Don't we only need the smallest prime divisor to know the earliest point when the chain will stop?

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

Решение задачи А за O(1): https://codeforces.me/contest/1766/submission/184938938

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

if anyone wants the O(1) solution for A, here it is :)

184929564

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

What will be the expected rating of the first 3 questions?

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

when will the rating be updated???

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

Why this submission passed problem 2? Surely it's complexity is O(n^2) Your text to link here...

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

The contest which made me master! 139 is a happy number.

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

Problem- E:- Can anyone tell, which case they where missing while they where getting WA at test case 16.

expected: '1476747', found: '996573'

How to correct it.

Thanks in advance :)

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

The B solution is wrong: Try this testcase: - t=1 - string='abcdabef' - n=6, - the answer is yes according to solution but it's wrong becuase: - 4 operations for 'abcd', - then 5th operation for copying and appending 'ab' string, - then 6th and 7th operation for 'ef', - so number of operations exceed n.

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

Is the concept "smallest prime factor" (minD) a well-known thing?

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

the pair contribution dp thing is something i've really only seen in digit dp problems, interesting to see it works with subarrays as well :)

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

.

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

hey I find sol for A in O(1) ~~~~~

include<bits/stdc++.h>

using namespace std;

int main(){ int t;cin>>t;while(t--){ int n;cin>>n; int cnt=0; int x=1; while(x*10<=n){ cnt++; x*=10; } int ans=cnt*9; ans+=n/x; cout<<ans<<endl; } } ~~~~~