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

Автор diskoteka, 11 месяцев назад, По-русски

Привет Codeforces (ノ◕ヮ◕)ノ*:・゚✧

Я и моя команда рады пригласить вас поучаствовать в Codeforces Round 878 (Div. 3). Раунд состоится 06.06.2023 17:35 (Московское время). В нём будет 8 задач, которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Мы постарались сделать приличные тесты — так же как и вы, мы будем расстроены, если у многих будут падать решения после окончания контеста.

Вам будет предложено 8 задач и 2 часа 15 минут на их решение. Одна из задач интерактивная. Не забудьте прочитать инструкцию по интерактивным задачам.

Штраф за неверную попытку в этом раунде будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в пяти рейтинговых раундах (и решить в каждом из них хотя бы одну задачу)
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Задачи были придуманы и написаны: diskoteka, pavlekn, playerr17, isosto.

Также хочется поблагодарить следующих людей:

  1. Aris за координацию нашей работы

  2. MikeMirzayanov за прекрасные платформы Polygon и Codeforces

  3. step_by_step за красное тестирование раунда

  4. Awesome3.14, I.Gleb, vladmart, dmkz, geospiza, phattd, fishy15 за жёлтое тестирование раунда

  5. KDZHR, D34D1NS1D3, JeffreyLC, NintsiChkhaidze, nickbelov, kamishogun, tolbi фиолетовое тестирование раунда

  6. KoT_OsKaR, Gornak40, Serik2003, Nahian9696, Rudro25, ayhan23, Lyrically за синее тестирование раунда

  7. TkachDan за бирюзовое тестирование раунда

  8. MODDI за зелёное тестирование раунда

  9. midsho за серое тестирование раунда

Желаем всем удачи и высокого рейтинга!

UPD: Разбор опубликован

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

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

As an author, I suggest reading all the problems and not missing out on free positive delta.

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

You missed a green tester :(

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

as a tester, BEST CONTEST I HAVE EVER TESTED!

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

As a blue tester,

Spoiler

Hope,

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

orz sir

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

Huge tip everyone! The problems for this contest are sorted by difficulty order! Good luck @everyone

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

It's really a seldom Div3.It starts at Tuesday.

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

As a tester, I can ensure u that the round is balanced and all the problems are interesting. Good luck in the round!

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

Can I go to specialist in that contest Div 3 :? Hope

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

As a tester, it's my first time to test a Div.3 round.

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

まどか

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

i want to become a student

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

THANKS CODEFORCES! I'd rather see more DIV 3 contests like this one!

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

Thank Aris for purple coordination!

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

As a yellow tester, I want to recommend to read all of the problems. Problems are quite varied. More think before coding. Don't go to implement the first idea which you got. Try to understand each example in problem statement before thinking on the problem. Don't waste a lot of time in solving a single problem and go to solve another problem if you get stuck.

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

    I wish I have read this before the contest. Got really stuck on B already. :(

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

delayed !!!!!

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

I miss participating in Div 3 contests.

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

There's an interactive problem in the contest?

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

Gonna be my very first Contest :-)

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

My first unrated round. All the best and positive delta to everyone participating!

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

omg madoka

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

Good Luck!

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

Good Luck!!

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

Good Luck!

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

Good Luck!!

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

Hope for positive delta.

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

The picture is so beautiful awa.

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

^^

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

Waiting for this!

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

will try to go for 8/8 this time.

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

Madoka

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

as for me:

Spoiler
»
11 месяцев назад, # |
  Проголосовать: нравится -19 Проголосовать: не нравится

Proud of MODI

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

Hopefully, the problems will be beautiful & interesting! Because authors are beautiful!

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

Hopefully, the problems will be as beautiful as Madoka! (ɔ◔‿◔)ɔ ♥ And may the math finally end here! 一期一会 diskoteka Orz.

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

hope to become Specialist in this contest.

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +14 Проголосовать: не нравится

My first unrated Div. 3 :)

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

Finally out of competition :)))

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

hello people, whats max positive delta i can get from this contest?

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

    if your rank is 200ish, you can get +200-300 imo if its 1000ish, you can get +150ish if its 2000ish, you can get +100-150 if its 3000ish, you can get +50-90

    you won't go down, as 1st 6 contests generally increases ratings. The above rating list might not apply to you as it's your 6th contest. So expect some more rating compared to above list.

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

Can I become expert today?

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

I love madoka!

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

Typo on explanation for D?

In the thir s example, the carvers can choose patterns 14...

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

Крутой раунд получился!

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

worst contest,not proper clear statements given in problem

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

    sorry for problem setters, i should have not judged by just reading problem A except problem A statement(because i couldnt understand till now,after reading almost 100 times), remaining problem statements are fine and problems are good,again sorry for my language.

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

is it Div. 2 :)

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

It is hard for being div3

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

G2 is almost the same as 2022 ICPC Asia Hangzhou Regional Programming Contest problem I. The only difference is the constraints and input/output format. https://mirror.codeforces.com/gym/104090/problem/I

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

Hint Of Some Problems :p

A: Divide some no overlapping subarray like x***x. add all * char to the answer.

soln

B: Main tricks is k>=30 cross 1e9 so have to consider onely k=0 to min(k-1,29). if(k>=30) ans=n+1. else ans= min(n+1,2^k).

soln

C: Took every subarray maintain given condition and find all way of that subarray[x= (cnt-k+1) & way= (x*(x+1)/2], here cnt is thw continuous subbarray ne which maintain given condition.answer is summation all such subarray.

soln

D: Use Binary Search.

soln

E: maintain the block in a vector with pos and end time. delete when time arrived. and other swap/check operation can be handled easily.

soln

G1: Find the 1st 1000 number manually using k= +1. Then find every +1000 position difference gap and see which number repeat. its need <=20000 queries.

soln

G2 is a Nice Problem. But can't solve :|

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

    please explain the solution for D...

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

      I fixed the answer as mid. Then 1st person cover the 2m distance from first. Last person cover last 2m distance. Then just check other gap <= 2m or not , which covered by 2nd person. 2m caused, m distance from left and m distance from right.

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

    Hello , I seem to have had the right idea for G1,however i recieved "Wrong answer on test 50" as a verdict. Could you please take a look at my code and see if you can spot my mistake ?

    my code
    • »
      »
      »
      11 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится
      1. did you memset poz[NMAX] to zeroes ???

      local variables might not be initialised to all zeroes ( still depends on the c++ version you are using ) .

      only global variables are assigned to zeroes. try initialising all zeroes and see if it works.

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

    Hey Bro! thank you for your hints man! one question in B prob how can we but how can we prove ans = n+1? it would be awesome if you could pls explain or give any reference.

    Thank you for the help.

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

      My thought was like, as we can only use (2^i). so every number can be represented by only one 1 way, which is easy to prove which binary representation maintains.. so if we just ignore k (k>=30) then for any n we can make 0,1,2,3,4,5,.....,n and ans is n+1

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

My randomized solution 208802508 worked for G1 but I don't know why!!!

Can someone please explain?

Maybe it's hackable.

»
11 месяцев назад, # |
  Проголосовать: нравится +49 Проголосовать: не нравится
»
11 месяцев назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Looks more like Div1 / Div2 contest

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

My randomized solution 208802508 for G1 worked but I don't know why !!

Can someone please explain?

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

    Randomized would work , mine got WA on test case 16 don't know why :(

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

F: We denotes dp[t][i][j]=1 if we can arrive position (i, j) at time t, 0 otherwise. The initial status is dp[0][0][0]=1, and transition is dp[t][i][j]=dp[t-1][i-1][j] || dp[t-1][i][j-1] || dp[t-1][i][j]. And in each second we need to clear positions shot by railguns. We repeat this process until dp[t][n][m]=1 or for all (i, j) we have dp[t][i][j]=0. The complexity is O(n*m*(n*m+r)).

G1: We can solve the problem by sqrt decomposition: First, we use 1000 queries to get a[1], a[2], ..., a[1000]. If there are any value occurs more than once, we have n<1000 and get the answer. Otherwise, we have n>=1000. Now we can use another 1000 queries to get a[2000], a[3000], ..., a[1001000], we must return to some position in [1, 1000] at some time.

G2: The constraint n<=10^6 is too large for 1000 queries, but how can we solve this problem if we've known that M<=n<M+62500 (=M+250^2)? Well, we can use similar strategy: First use 250 queries to get a[1], ..., a[250], if n<250 we can get the answer. Otherwise, first we assume M<=n<M+250, and we query for a[M+250]. If M<=n<M+250, then 1<=M+250-n<=250, that means we will return back to [1, 250] and we can get the answer. Otherwise, we can assume M+250<=n<M+500 and query for a[M+500], then assume M+500<=n<M+750 and query for a[M+750], and so on. Finally we will solve the problem within 500 queries. So how can we use other 500 queries for finding M? Well, we only need to make 500 random queries and take the maximum value of answers. The probability that maximum value is not greater than n-62500 is ((n-62500)/n)^500, when n<=10^6 this probability is no more than 10^-14, therefore this method will pass 1000 testcases for probability >=(1-10^-11), so it's safe enough.

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

    What's M in solution of G2 ?

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

    What was the intuition to use a randomised approach for G2? Or rather what pointed to the idea of using a randomised algorithm?

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

      The number of a[i] is fixed initially, so if we make random queries, we will get random numbers uniformly distributed in [1, n], and if we take the maximum value we get, it will be pretty close to n, so we can reduce the number of candidates of answers.

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

    I'm not able to calculate probability that n exceeds M + 62500 ... How to do it ??

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

      We make 500 random querise and let M = the maximum answer returned. Since a[i] is fixed initially, n>=M + 62500 means that for all 500 random queries (which will return a random integer in [1, n]) return a value <= n-62500, so the probability is ((n-62500)/n)^500 = (1-(62500/n))^500, when n<=10^6 we have 1-(62500/n) <= 0.9375, so (1-(62500/n))^500 <= 9.67e-15.

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

Nice contest! I had a lot of fun and am curious about how to solve G1

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

Can someone verify my sketch to G2? I couldn't implement it due to school.

For 100 times, RNG a number x between 1 and 9E8 and move -x +(x+300) (call this a "turn"), which basically advances by 300 and also gives a random position using 2 moves

if we get nothing above 90000, we know $$$n<160000$$$ and we can use the G1 solution for the remaining 800 moves else, do 200 more turns and then the max number we visited is probably within $$$90000$$$ of $$$n$$$, so we can advance by that many spots and then increase by 1 for the next 300 moves, which guarantees that we reach something we know the position of and we can determine $$$n$$$

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

My approach for G1 and G2 involved randomization, but infortunately it failed on test case 16, can't figure out why so ? Can someone please explain, will be a great help... Also is there anything wrong with the approach?

Approach :

Store all those sectors you have visited till now, also keep track of how much you have to add i.e. +k or -k. Then if we encounter same sector again then our answer will be distance traveled to reach that sector until now — distance traveled to reach that sector earlier. It would be multiple of some number, we would just find for what multiple the answer exists.

My code

#include <bits/stdc++.h>
#define int long long int

const int N = 1e6 + 1;

int query(char sign, int k){
    std::cout << sign << " " << k << std::endl;
    int ans;
    std::cin >> ans;
    return ans;
}

void print_ans(int res){
    std::cout << "! " << res << std::endl;
}

void solve() {

    int n;
    std::cin >> n;

    int sum = 0;
    std::map <int, int> mp;
    mp[n] = sum;

    int r = rand() % N;
    sum += r;
    int q = query('+', r);

    while(mp.find(q) == mp.end()) {
        mp[q] = sum;
        r = rand() % N;
        sum += r;
        q = query('+', r);
    }

    int d = sum - mp[q];
    int p = q;

    std::set <int> ans;
    
    for(int i = 1; i * i <= d; i++) {
        q = query('+', d / i);
        if(p == q) {
            ans.insert(d / i);
        }
        q = query('-', d / i);
        q = query('+', i);
        if(p == q) {
            ans.insert(i);
        }
        q = query('-', i);
    }

    print_ans(*ans.begin());
    
}

signed main() {

    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE

    solve();
}
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone explain Binary Search solution for D? I got the intuition but couldn't do it

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

    Binary search on the best max time

    let the current check is for number x to see if the max time can be $$$<= x$$$

    x will work if the 3 carvers took the max allowed capacity and the max difference for each caraver items is <= x

    first you will sort the array

    A carver can take items from l to r if $$$⌈(v[r] - v[l]) / 2⌉ <= x$$$

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

      It is still not clear, can you please explain little bit more with detail?

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

        Let's see why binary search works

        let A > B

        if the best max difference for all carvers is less than B then for sure, it is less than A

        Then we can represent all possible answers like this

        1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...
        0 0 0 0 0 0 0 0 0 0  1  1  1  1  1  1  1  1  1  1  1  ...
        

        which zero means the 3 carvers cannot serve all people wen the max distance is x

        we need to find the smallest max possible distance so, we need to find the first 1, here comes the binary search

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

    You may want to have a look at Binary Search videos in the Edu section. They present Binary Search on Answer with superb clarity and problems.

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

How answer to B is k > 30 ? n + 1 : Math.Min(n + 1, 1 << k), basically how number of ways is being counted?

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

    It is nothing but the maximum quantity of numbers less than or equal to n which can be represented using k bits.

  • »
    »
    11 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
    long long a, b;
    cin >> a >> b;
    long long int ans = pow(2, b); // calculates the different ways of bought deserts

    // log2(a) calculates how many deserts he can buy.

    if(log2(a)>=b){
    
        cout << ans;
    
    }
    
    else{
    
        cout << a+1;
    
    }
    • »
      »
      »
      11 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I think he was not asking for the code. He wanted to know the reason for doing this.

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

      why log2 can you explain ?

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

        to calculate the number of bits required to store 'a' in binary form

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

        it's given that price of ith bit is 2^i so from 0 to k if you calculate the total price required to cover every index it would be 2^0+2^1+___2^(k-1)=2^k -1 and it's evident that if 2^k-1 is less than or equal to n the answer has to be n+1.

        2^k -1 <=n print => n+1

        Simplifying it further:- 2^k=n+1 taking log both sides k=log2(n+1) i.e why log2 come into play i hope now it's clear why log2 is taken

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

When will Editorals come out...? Hoping it!

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

could land into double digit rank for the first time, if not hacked

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

G2: The (de)merit of asking randomization algorithm under the ICPC rules: resubmit makes no damage

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

    wow! If you submit two times the same code in ICPC and both get WA you only get 1 WA?

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

      The penalty is #submission $$$-$$$ $$$1$$$ of your first AC (after systest).
      Before systest: WA TLE AC AC WA TLE AC TLE AC -> +2 If systest rejects 3rd and 4th submissions but accept 7th and 9th submissions,
      After systest: WA TLE NG NG WA TLE AC TLE AC -> +6

      If this is usual round, only the last Pretest Passed is used for systest, but ECR, Div3, or Div4, all of your AC can be used for the systest.

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

can anyone please explain what the statement of Problem A is trying to say?Thanks in advance.

  • »
    »
    11 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

    What you basically have to do is to find a pair of the identical characters that sandwich others. In the first example, where S = "abacabac", starting with S[0] = 'a', you proceed until you find another 'a' with both of which you can sandwich others (this time just "b"), and you find S[2] = 'a'. So now the first letter of the plaintext is 'a'. Next, you see S[3] = 'c', and again proceed until you find another 'c', which is S[5]. You add 'c' to the answer. Now you've performed the operations on all the characters, so the final answer is "ac". The second example is even simpler, because it is a pair of 'q's that sandwich the rest. Third example is such a case that nothing is sandwiched by a pair of characters. Hope that makes sense (I strongly agree the statement was not crystal-clear).

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

      again Thanks but you are explaining me how to get answer but not the problem statement

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

    Given the encrypted string 'a', you must output the original one (let's call it 's'). It says that for every letter 'c' in 's', 'a' has it in the form c------c where '-' is a random letter. For example if s = "pepe", examples of 'a' could be: "ppeeppee" (there are no middle-letters), "papexepfpede" (it has a, x, f and d), "pkkkpekepooopemzzme"

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Can someone check why my binary search solution to D times out? It's supposed to run in O(n log n), but I can't figure out what's going wrong.

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

    a

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

    It is advised to avoid using floating point arithmetic whenever possible, with that in mind I changed your code so that it uses an integer ceiling function (line 16), after that change the code got WA on test 3, which was the result of lowballing your hi variable, after changing it to 10**9 it got AC.

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

In problem C, let's say in range i to j, we have all the valid days. Could anyone tell me how to add no. of valid intervals to the ans?

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

    if( j-i+1>=k) { ans++; ans+=(j-i+1)-k;}

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

      how did you arrive to this conclusion?

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

        this was kind similar to total number subarray with sum<=k (2 pointer) there total subarray will be j-i+1 but here our subarray will be strictly when len(subarray) >=k we will increase the ans(becoz this subarray is valid) and by how much can ith pointer can move so that this len[i..j] >=k we can binarysearch or using above formula.

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

    let m=number of elements in this valid interval, int d = m-k+1(if m>k), ans+=d*(d+1)/2

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

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

Can anyone explain E and how to solve it?

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

re: F's english statement, in "coord is the size of the penetrated coordinate", the use of 'size' is what caused my catastrophic misread (but made the problem look more interesting). With hindsight I'm guessing you meant "location" or "which row or column" rather than something suggesting a widebeam railgun (weird, right?). Also, TL hacks inbound...

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

My first contest, solved 4 problems :) Can anyone tell how we can hack anyone's solutions or how to come up with any corner testcase which can be used for hacking? Thanks in advance

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

Can anyone explain E and how to solve it ??

  • »
    »
    11 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

    I solved it with string hashing. If you know what is string hashing the problem is very easy.

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

    I upsolved it with set(but couldn't solve it during the contest).

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

    You can use polynomial rolling hash function to hash the given strings. Modifying the hash values for query 1&2 is trivial

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

      when u removed the particular hash of tht character in block or unblock wont the further character be affected by this how u tackled this?

  • »
    »
    11 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

    we can use a set to store the indices of characters that are not equals, on every query of type 2 we update these sets, on every query of type 3, we check to see if any of the indices that are in the set are not equal

    alternatively, we can just check if the number of blocked elements are equal to the number of indices that are not equal (i seen some do this)

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

      Yeah you don't even need the set. Just get a count of the number of different chars between s1 and s2. Every time some modification happens, increment or decrement the diff depending on if the modification made it so more/less chars are now similar. If the diff == 0, it means the strings are identical

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

      why the downvotes lol? this clearly works

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

    Just maintain a multiset of the differences between s1[i] and s2[i] for each i, and a queue for the the current blocked indices.

    If type of the query is 1: insert the index into the queue of the blocked with the time when it will be unblocked. remove s1[p] — s2[p] from the multiset.

    If type of the query is 2: Just case work, remove the old differences of pos1 and pos2 from the multiset then update the string then insert the difference again.

    If type of the query is 3: The answer is YES if all differences between s1[i] and s2[i] == 0, it's easy to check that from the multiset.

    And don't forget to remove the unblocked indices at each iteration and insert the difference to the multiset again.

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

    Thanks everyone

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

    I have much simpler approach to solve E .

    Just maintain all the mismatching index in set. Whenever you block the mismatching index, remove it from set and add it into blocking cells( u will release this lock right before 'i' + t query).

    have look at my code for better understanding I have written comments as well.

    my solution : https://mirror.codeforces.com/contest/1840/submission/208829151

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

NumberOfWaysForces :))

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

How did D get so many solutions? It was extremely difficult.

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

Can someone pls give me any hints for problem F?

»
11 месяцев назад, # |
Rev. 6   Проголосовать: нравится +9 Проголосовать: не нравится

Solved problem 1840E - Character Blocking in $$$O(q\times n$$$). Submission. It works because comparison of two strings in C++ works in $$$O\left(\dfrac{n}{16}\right)$$$ (it is possible to compare $$$16$$$ bytes ($$$256$$$-bit registers) per single operation by activating GCC pragmas).

UPD. Hacked!

UPD 2. Wrote new solution which is still alive.

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

Can some1 please kindly point out what is so terribly wrong with my solution of E: 208819873.

I tried looking at the tests (my solution fails exactly on second pretest token number 5352, test case number appears to be 1665) but it doesn't make much sense to me because the strings appear to be in uppercase (unless I'm missing some silly mistake with my input).

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

    nvm i got wrong.. t didn't change

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

      But aren't the queries coming only at integer moments in time (like t1 = 1, t2 = 2 and so on)? Also since we can block only one position at a time and the interval t is constant, doesn't that imply that we can only "unblock" one character at a time, the queue is going to be sorted by itself (unless I understood the problem statement wrong).

      My solution using a good old map<char, int> didn't pass as well, so the issue is most likely not in the lower/uppercase inputs.

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

    electric_boogaloo Did you find any tc? I'm also failing idk y

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

I try to hack the solution of problem F using the following generated test cases, and it just give me "unexpected verdict", what is happening, can problem author fix this?

import sys
sys.stdout.write("10000\n")
for _ in range(10000):
    sys.stdout.write("1 1\n")
    sys.stdout.write("100\n")
    for i in range(100):
        sys.stdout.write(str(i+1)+" "+str(1)+" "+str(1)+"\n")
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How did i miss this TT

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится -9 Проголосовать: не нравится
Smash me
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

As always problem B is perfect for eliminating newbies.Problem F should have more understandable description or should have diagram or atleast the question testcases should be described clearer. overall a stupid contest where stupid are eliminated at first question

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

Can someone tell me why when i try to hack i have message : Validator 'validator.exe' returns exit code 3 [FAIL Expected integer, but "��1" found (stdin, line 1)]

Also whole test on codeforces has a lot of this random "�" question marks.

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

    Are you trying to hack using a text file or genenerator (code to generate the input)? Can you paste the hack test / generator code in a comment? It's very difficult to say what is happening without more information.

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

      I'm generating test like this : ~~~~~ int32_t main() { string a = ""; int n = 26033, q = 26033; for (int i = 0; i < n; i ++) a += 'a'; cout << 1 << '\n'; cout << a << '\n'; cout << a << '\n'; cout << 2 << ' ' << q << '\n'; for (int i = 1; i <= q; i ++) { cout << 3 << (i == q ? '\n' : ' '); } return 0; } ~~~~~

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

        First of all, queries should all be on separate lines (not space-separated), but that isn't what the validator is complaining about.

        I tried to hack a solution using your generator in hack -> generated input, and the only thing the validator was complaining about was what I mentioned above.

        Did you generate the code like this and copy-paste the output into the hack? That might be the reason the input seems invalid.

        P.S: Please format your code by placing "~~~~~" (without quotes) on a line before and a line after your code.

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

          I was generating to the txt file and it seems like there are for some reason invisible "�" marks. I can see them when I open file in visual studio.

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

          Copy pasting works, before i was sending file.

          Do you know btw why 256kb is max size of test for hacking? It's impossible to create max test ;d

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

            You can send a code file that generates the test case on the server by selecting "generated input" instead of "manual input" on the top of the hacking interface. If you do this, there is no limit on the size of the test case.

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

CAN SOMEONE PLEASE EXPLAIN THE INTIUTION BEHIND G1/G2???

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

PLEASE TELL ME THE INTUITION BEHIND THE G1/G2 PROBLEM???

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

    If you look carefully at the limit of number n and limit of queries, it gives the vibe of divide and conquer, since most commonly used division is by ✓n.

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

B problem was :(((( ,, has not think about not taking any of the element

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

Reads problem statement for D, sees that time limit is 3s => neuron activation => immediately starts coding out binary search.

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +21 Проголосовать: не нравится

F: Holy, the TL is magically changed 3s instead of 1s, and my 100+ successful hacks are disappeared and left -85...

My hacking case is here, this isn't exist in the pretest:

1
10000 1
100
10000 1 10000
10000 1 10000
...
  • »
    »
    11 месяцев назад, # ^ |
      Проголосовать: нравится +13 Проголосовать: не нравится

    Look up for xuhao95's post.

    Looks like that case makes the input really big. I guess std got TLE on reading the data.(I would also guess most solutions got TLE on reading the data.)

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

      No, this testcase satisfies the constraint and it's only about 100 lines.
      This testcase kills unnecessary $$$\log$$$ or something with $$$O(nm(n+m+r))$$$ and should be included as a pretest. (sorry, the testcase of my first post contains unnnecessary 1)

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

        I was talking about why they magically changed the TL from 1s to 3s.

        I know your case is good and strong and killed many solutions, but it's accidentally affected by the incident of that case.

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

          I see. The problem is $$$\Sigma r$$$ isn't bounded and the input can be $$$10^6$$$ lines then, for safe io, the TL was raised to 3s and it affects my usual hack. sad...

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

AC A,B,C,D. It's so good!!! Thanks diskoteka,pavlekn,playerr12,isosto and their friends for this great contest.

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

A very good div3 has increased my rating

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

mind blowing contest.thanks for creating such contest._

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

I am not a trusted participant (I had given only 2 contests before this), will my rating get increased on the basis of this contest?

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

    Your question would have been answered if you had read the blog once...

    It's even in bold!
    • »
      »
      »
      11 месяцев назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

      I did read that and thought it would be rated, but it doesn't show in my profile as rated. It shows in all contests. Hence why I asked the question.

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

Sees D -> Sees "Best" Waiting time -> Gets a Déjà vu -> Speedruns BS at the last f minute -> Gets Satisfaction

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

My solution for problem D was hacked. I used binary search and the complexity is O(nlog(n)). I don't know how it is hacked. this is the submission 208804659

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

    Same happened to me. I noticed that this guy hacked only pypy3-64 solutions, so i guess it's a pypy3-64 problem

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

when will be rating updated?

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

    Bro, for query type 2, after swapping, They might get equal, If they become equal. Why you are not removing that index from set.... Try This.. I hope it might work....

    if(s1[xp]==s2[xp]){
            if(mp.count(xp)) mp.erase(xp);
          }
    
          if(s1[yp]==s2[yp]){
            if(mp.count(yp)) mp.erase(yp);
          }
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My rating is way lower then 1600, why was this contest unrated for me? I was only able to solve A(I'm new to cp), so i should receive some rating +ive or -ive?

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

A good game!

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

Why rating updated without system testing?

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

Why does my code run incorrectly!!!!

'op' represent operate number, and 'ti' represent time now.

if(que.front().time==ti) represent block time have be done.

when the 'op'= 2,have two cases are a==c or a!=c

when a==c, have two cases are a==c = 1 and a==c = 2.

First case is a==c and a==1, when the s1[b]==s2[d] and s1[d]!=s2[d],the b position add a different char, and s1[b]!=s2[b] and s1[d]==s2[b] the b postion reduce a different char.

Second case is a==c and a==2 as described above.

Third case is a!=c, then swap(a,c) if a==2.

Add a different char if s1[b]==s2[b] but s2[b]!=s2[d], and s1[d]==s2[d] but s1[b]!=s1[d]. Reduce a different char if s1[b]!=s2[b] but s2[b]==s2[d], and s1[d]!=s2[d] but s1[b]==s1[d].

#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
#define MAX_N 200010
using namespace std;
int T;
int t, q, n, op, x;
int a, b, c, d;
string s1, s2;
int tree[MAX_N];
inline void add(int idx, int x) {
  for (int i = idx; i <= n; i += lowbit(i)) tree[i] += x;
}
inline int query() {
  int res = 0;
  for (int i = n; i; i -= lowbit(i)) res += tree[i];
  return res;
}
struct dat {
  int time, idx;
  dat() {}
  dat(int t, int i) : time(t), idx(i) {}
};

inline void solve() {
  memset(tree, 0, sizeof(tree));
  queue<dat> que;
  cin >> s1 >> s2;
  n = s1.size();
  for (int i = 0; i < n; ++i)
    if (s1[i] != s2[i]) add(i + 1, 1);
  cin >> t >> q;
  for (int ti = 1; ti <= q; ++ti) {
    if (!que.empty() && que.front().time == ti) {
      dat d = que.front();
      que.pop();
      add(d.idx, 1);
    }
    cin >> op;
    if (op == 3) {
      int x = query();
      if (x == 0)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    } else if (op == 1) {
      cin >> x;
      que.emplace(ti + t, x);
      if (s1[x - 1] != s2[x - 1]) add(x, -1);
    } else if (op == 2) {
      cin >> a >> b >> c >> d;
      if (a == c) {
        if (a == 2) {
          if (s1[b - 1] == s2[b - 1] && s1[b - 1] != s2[d - 1]) add(b, 1);
          if (s1[d - 1] == s2[d - 1] && s1[d - 1] != s2[b - 1]) add(d, 1);
          if (s1[b - 1] != s2[b - 1] && s1[b - 1] == s2[d - 1]) add(b, -1);
          if (s1[d - 1] != s2[d - 1] && s1[d - 1] == s2[b - 1]) add(d, -1);
          swap(s2[b - 1], s2[d - 1]);
        } else {
          if (s1[b - 1] == s2[b - 1] && s1[d - 1] != s2[b - 1]) add(b, 1);
          if (s1[d - 1] == s2[d - 1] && s1[b - 1] != s2[d - 1]) add(d, 1);
          if (s1[b - 1] != s2[b - 1] && s1[d - 1] == s2[b - 1]) add(b, -1);
          if (s1[d - 1] != s2[d - 1] && s1[b - 1] == s2[d - 1]) add(d, -1);
          swap(s1[b - 1], s1[d - 1]);
        }
      } else {
        if (a == 2) {
          swap(a, c);
          swap(b, d);
        }
        if (s1[b - 1] == s2[b - 1] && s2[b - 1] != s2[d - 1]) add(b, 1);
        if (s1[d - 1] == s2[d - 1] && s1[b - 1] != s1[d - 1]) add(d, 1);
        if (s1[b - 1] != s2[b - 1] && s2[b - 1] == s2[d - 1]) add(b, -1);
        if (s1[d - 1] != s2[d - 1] && s1[b - 1] == s1[d - 1]) add(d, -1);
        swap(s1[b - 1], s2[d - 1]);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cin >> T;
  while (T--) solve();
  return 0;
}
»
11 месяцев назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Why does my code run incorrectly!!!!

'op' represent operate number, and 'ti' represent time now.

if(que.front().time==ti) represent block time have be done.

when the 'op'= 2,have two cases are a==c or a!=c

when a==c, have two cases are a==c = 1 and a==c = 2.

First case is a==c and a==1, when the s1[b]==s2[d] and s1[d]!=s2[d],the b position add a different char, and s1[b]!=s2[b] and s1[d]==s2[b] the b postion reduce a different char.

Second case is a==c and a==2 as described above.

Third case is a!=c, then swap(a,c) if a==2.

Add a different char if s1[b]==s2[b] but s2[b]!=s2[d], and s1[d]==s2[d] but s1[b]!=s1[d]. Reduce a different char if s1[b]!=s2[b] but s2[b]==s2[d], and s1[d]!=s2[d] but s1[b]==s1[d].

#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
#define MAX_N 200010
using namespace std;
int T;
int t, q, n, op, x;
int a, b, c, d;
string s1, s2;
int tree[MAX_N];
inline void add(int idx, int x) {
  for (int i = idx; i <= n; i += lowbit(i)) tree[i] += x;
}
inline int query() {
  int res = 0;
  for (int i = n; i; i -= lowbit(i)) res += tree[i];
  return res;
}
struct dat {
  int time, idx;
  dat() {}
  dat(int t, int i) : time(t), idx(i) {}
};

inline void solve() {
  memset(tree, 0, sizeof(tree));
  queue<dat> que;
  cin >> s1 >> s2;
  n = s1.size();
  for (int i = 0; i < n; ++i)
    if (s1[i] != s2[i]) add(i + 1, 1);
  cin >> t >> q;
  for (int ti = 1; ti <= q; ++ti) {
    if (!que.empty() && que.front().time == ti) {
      dat d = que.front();
      que.pop();
      add(d.idx, 1);
    }
    cin >> op;
    if (op == 3) {
      int x = query();
      if (x == 0)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    } else if (op == 1) {
      cin >> x;
      que.emplace(ti + t, x);
      if (s1[x - 1] != s2[x - 1]) add(x, -1);
    } else if (op == 2) {
      cin >> a >> b >> c >> d;
      if (a == c) {
        if (a == 2) {
          if (s1[b - 1] == s2[b - 1] && s1[b - 1] != s2[d - 1]) add(b, 1);
          if (s1[d - 1] == s2[d - 1] && s1[d - 1] != s2[b - 1]) add(d, 1);
          if (s1[b - 1] != s2[b - 1] && s1[b - 1] == s2[d - 1]) add(b, -1);
          if (s1[d - 1] != s2[d - 1] && s1[d - 1] == s2[b - 1]) add(d, -1);
          swap(s2[b - 1], s2[d - 1]);
        } else {
          if (s1[b - 1] == s2[b - 1] && s1[d - 1] != s2[b - 1]) add(b, 1);
          if (s1[d - 1] == s2[d - 1] && s1[b - 1] != s2[d - 1]) add(d, 1);
          if (s1[b - 1] != s2[b - 1] && s1[d - 1] == s2[b - 1]) add(b, -1);
          if (s1[d - 1] != s2[d - 1] && s1[b - 1] == s2[d - 1]) add(d, -1);
          swap(s1[b - 1], s1[d - 1]);
        }
      } else {
        if (a == 2) {
          swap(a, c);
          swap(b, d);
        }
        if (s1[b - 1] == s2[b - 1] && s2[b - 1] != s2[d - 1]) add(b, 1);
        if (s1[d - 1] == s2[d - 1] && s1[b - 1] != s1[d - 1]) add(d, 1);
        if (s1[b - 1] != s2[b - 1] && s2[b - 1] == s2[d - 1]) add(b, -1);
        if (s1[d - 1] != s2[d - 1] && s1[b - 1] == s1[d - 1]) add(d, -1);
        swap(s1[b - 1], s2[d - 1]);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cin >> T;
  while (T--) solve();
  return 0;
}
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

哟西

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

Is System Testing over?

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

I got +100 something but it disappeared , Past two contests are not showing on graph :(. Any idea what could be the issue????

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

Why are the ratings rolled back?

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

    apparently one of the organizers rolled out the ratings without completes system testing

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

can anyone run my code? It prints correctly in my computer.

https://mirror.codeforces.com/contest/1840/submission/208770610

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

Div 3 = 1 easy question + div2

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

Can someone help me to take a look at my Code for Problem E? I have been reviewing it for more than 1 hour and asked people around me, but I couldn't identify the issue.208953748

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

I got a message from the codeforces team that my code for problem 1840C (submission 208741874) is matching with DEAD_TCT's submission, I swear I didn't share my code with anyone else, it's a coincidence. The python code was very short and the problem is easy so everyone familiar with Python ended up with more or less similar code, And my submission time is far before his submission time. I have recently started giving contests regularly but this kind of thing will demotivate me. I request team to kindly look into this issue.

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

    I looked at both submissions and I must say that it does seem pretty believable, at least to me, that this is a coincidence (I just chanced upon this comment while idling around recent actions).

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

I write to you first time because this time I really not break any rule , you send me notification like that "Your solution 208761272 for the problem 1840B significantly coincides with solutions satyam9696/208761272, _souhardya/208772620", first of all I really don't know him who is he , first time i visit his profile after your notification. I also not used or neither upload any code on ideone( I don't know what is this). one thing i want to say ,the question for which you give me notification it really have small code ,I think in too many people two-to three people can have same code for a 6-7 line answer of code. it is just like for summation of two number everyone write a+b. once again i want to say i not copy any one code you can also see my wrong submission of that question, i was making really small mistake again and again than i write fresh code and it pass that's it. please see into it.

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

    I just check solution of many other people of that question all have almost same code as of mine only difference is that they are using different different template . i not use any big or different template, i simply use that is necessary for the code. i can also give some solution id if needed. please look into it. i really not do any cheating. MikeMirzayanov sir please look into it.

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

      Same problem, Im-caesarr (don't know who it is, but he participated, as I see it, only once in this contest and has exactly the same code as mine). But the code length is only 5 lines and 3 of them are in my template, so maybe it's a coincidance. In my tries everyone can see steps of improving my code before it actually worked and also his code was sent more than 1 hour later. I didn't publish my code anywhere.

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

Few days ago there was a problem with my laptop. So I used one of my friends laptop to participate in some contests.I forgot to logout from my account from his laptop. Now that guy logged into my account and copied my solution during the contest. I had no idea about the incident until I got a message from codeforces. I Don't know what kind of proof would be accepted or how can I prove what I'm saying. But I'm doing contests and upsolving for years in codeforces without any violation of rules. I would be grateful if you consider the situation and avoid giving me any penalties.

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

emmm so how can i become a tester:)

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

I got a notification that my submission of 1840B 208789335 is copied. I just modified my previous submissions 208747728 and 208761375 This is clear proof that I didn't copy. after getting the wrong answer for my first submission to 1840B, I switched to the next question. Then again I checked my previous submission, and what was wrong with it and I modified and submitted it again. You can check my submissions. There is not much difference from my previous submissions.

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

I hope that the contest will be easy.Of course ,it is of Div.3!

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

Keep learning because life never stop teaching.

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

Why are the ratings for this contest rolled back?

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

I am newbie Can anyone suggest me how to approach these contests to gain good cp skills and rating too

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

In problem D you need to minimize the the maximum waiting time . an array would be given as input and you need to select three integers (pos) such that the maximum difference which would be obtained by subtracting any of these from each element of the array , is minimized .

so lets take an input 6 5 4 2 1 30 60 if we would take three integers as 3 30 and 60 then |3-3|=0 |3-4|=1 |3-2|=1 |3-1|=2 |30-30|=0 |60-60|=0 note: we can subtract any number from any element. maximum from above differences is 2 which is minimum obtained if we would take different sets of integers {a, b, c} __

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

oniichan

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

Why is problem G1 showing denial of judgement? https://mirror.codeforces.com/contest/1840/problem/G1 MikeMirzayanov

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

Cool round, I finally made it to blue)

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

deleted