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

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

We would like to invite you to participate in The 2024 Damascus University Collegiate Programming Contest (DCPC 2024) that was held on Jun/23/2024 12:00 (Moscow time) in Damascus, Syria.

The problems were authored and prepared by BERNARB.01 , Guess.Who , Richtofen , KactusJack , roctes7 , BallzCrasher , Harraaak , Modar_Ali , Wael_Mchantaf , Obada_Saleh , ETheHedgehog , ...._....__...___ and me.

Thanks to the testers : Rokba , Drakkon , Gamal74 , antonis.white , Mr.Pie , yahia , Rania , FetFot , MOUFLESS , stefdasca , purp4ever , The_Hallak, ALAov , ApraCadabra , Majedh , A.D. , Arturo , HeMoo , Helal_Salloum , KingOfHababeesh , AboAbdoMC , HazemDalati , Magician_Mathematician , FTS_Problem_C , Bisher_Sahloul , SUL , THE_THUNDERSTORM_BEGINS , Abo_alzeek , zain_salloum , AlI_sAiRo , 3atori , The_Weighted_MST , Amjad_Manafikhi , AMR_23 , Nawar-Georges and Micheal_13 .

Any feedback will be appreciated in the comments.

Hope you have fun participating in this contest.

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

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

it was amazing! thank you for your work <3

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

As a participant, it was an uncly contest.

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

As a tester , Kaitokid is the GOAT

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

as a tester i had fun!

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

As a participant, It was an INCREDIBLE contest, so thanks for your hard work :)

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится +33 Проголосовать: не нравится

As a tester, I see this as one of the coolest contests I have ever practiced. Don't hesitate to participate and have fun!

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

As a participant ,it was a great contest as YOU <3

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

As a tester, the problemset is my uncle.

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

As a tester,it's one of the best contests I have ever participated in. Thanks to all the authors

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

As a participant, I really enjoyed this contest. Thanks to everyone who contributed in this contest

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

How to do B?

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

    In the given segment from L to R, we can increase the value of F(a[l] .. a[r]) if there is character C1 has fewer occurrences than C2, and there is at least one occurrence of C2 before C1 in the given range.

    for example, adac, L=1 and R=4 (one index)

    cnt[c] = 1 and cnt[a] = 2

    Because c appears after a, we can swap them.

    my solution was just to find for each query, the number of occurrences of each character in the given range, this can be done using upper and lower by storing for each character the positions it appears in, and find the first and last occurrence for each character

    then just brute force, try to compare all the characters, if cnt[i] > cnt[j] and the first occurrence of i is before the last one of j, then you can increase the answer

    here i and j represent two different characters in the segment L→R

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

will you post the editorials?

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

How to solve G?

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

    I will try to find the largest possible character for each i .

    So for each i I will apply several operations,

    I will take all characters in the string with smallest possible range

    For example, the number of distinct characters between i, n is x and the number of characters between i and r is also x and r is smallest possible.

    1 — If the new character is smaller than the old character I can skip the change stage and move to the next place.

    2 — If the new character is larger than the old character here the change is clearer (all letters in the range i r are converted).

    Here are for each character from r+1 to n I can choose to change them or not if I changed all the characters before it ,then I can change the characters until I reach a character larger than the new character and here I can stop changing the characters .

    3 — If the new character is equal to the new character then here I will look at the first j that is s[i]!=s[j] and j > i and return to the first two cases.

    finally , if i change characters from i to r , then new i is r + 1 in order not to change the same index twice

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

How to solve F and A?

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

    To solve the problem F

    For every number of c characters, store for every index L the size of smallest range that contains a distinct c characters and begins in L

    in each query you have [L R] so that you want to print shortest range in it, But will the range that you will search remain between [L R]?

    No, because for example, if you search between [L R] for a range that contains 3 characters and the shortest range in the index R — 2 is equal to 4, then the index R — 2 is incorrect because it exceeds R

    So you will try to find a new right that the shortest range in new Right not exceeds R and only then find the smallest range that exists between [L R`]

    To get the smallest range that exists between [L R`]
»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E?

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

    Since the maximum element in the array can be up to 1e9 Therefore maximum number of factors of the element can be up to 30 So the GCD will change maximum of 30 times throughout the array you can calculate it whenever it changes, and keep the answe whenever it is same

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится +1 Проголосовать: не нравится
solution for K
»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C?

  • »
    »
    22 месяца назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +8 Проголосовать: не нравится
    hint 1
    hint 2
    solution

    husseainshalaby6 you can read this if you stay want to solve c

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

Thank you authors! beautiful contest

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

How to solve A?

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

i want code M please?

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

For problem G, What is the answer for s = "dddbxadxbxad"?
My code prints: "dddddddddddd" not "dddddddxdddd" and still getting AC

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

How to solve A ?