Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×
Автор awoo, история, 3 года назад, По-русски

Привет, Codeforces!

В 12.06.2023 17:35 (Московское время) состоится Educational Codeforces Round 150 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов, Максим Neon Мещеряков и Дмитрий TheWayISteppedOutTheCar Пискалов. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Отдельное спасибо тестерам раунда ashmelev, shnirelman и Fanarill за ценные советы и предложения!

Удачи в раунде! Успешных решений!

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

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

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

I hope +ve delta for me

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

Excited for the 150th edition of Edu round.

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

Good luck to everyone participating

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

Keep learning because life never stop teaching.

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

A contest after so long! There are two div 2 contests on 18th. Can one of them be shifted to another date?

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

hello, this will be my first contest on codeforces, any tips??

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

    may your "sheer luck" support you :)

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

    You may try any previous educational round as virtual round or simply solve.

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

    I am not an expert to advice you. But, anyways these are general advices that everyone recommends.

    1- You must stay calm (even if you stuck, even if you got WA) it's ok just try your best and keep a bottle of water with you.

    2- don't rush in reading the problem take your time in reading & thinking (use paper and pencil) investing ~15 minutes reading & thinking carefully may prevents you from getting a WA with penalty 10 minutes + frustration.

    3 — Before submitting try corner cases like when input is small, big, even, odd, prime , string ends with space, what if the last number in array doesn't break some condition ..etc. Think in some cases that you didn't handle.

    4 — Have a confidence in yourself (don't go with mindset oh this hard so I can't solve it) you will the fight before you even started (don't give up without a fight).

    5 — Fight for the last minute of the contest trust me you don't how many times you can submit a solution in the last few minutes.

    6 — After the contest ends try up-solve by solving the problem that you stuck at. If you stuck after the contest too you can see it's tags maybe it's on a topic that you don't know, go study it for a little bit and come back. Stuck again then go for the editorial.

    Good luck & I hope you have a +ve delta bro <3.

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

do you like yuanshen?

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

if i have a wrong submission without any correct submission then will i get panelty for that wrong submission?

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

Fun thought experiment for problem setters: Write problem D without using $$$l$$$ and $$$r$$$.

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

after so many defeats, this is what i call a great comeback

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

bruh c was kinda... interesting

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

    I agree, although the main observation was easy to find, it took me too long to implement.

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

    yeah, it isn't hard but actually implementing all that is hell, I wasn't fast enough to start it and implement a solution.

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

      Yeah, it was hard to implement if you use greedy approach. but you can also solve it with DP and implementation wasn't that hard.

      #include <bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define mod 1000000007
       
      const int N2 = 1e2 + 5;
      const int N3 = 1e3 + 5;
      const int N5 = 1e5 + 5;
      const int N6 = 1e6 + 5;
      const int INF = 2e9 + 5;
       
      vector<pair<int, int> > directions_8 {{-1, -1}, {1, 1}, {1, -1}, {-1, 1}, {0, 1}, {0, -1}, {-1, 0}, {1, 0}};
      vector<pair<int, int> >directions_4 {{0, 1}, {0, -1}, {-1, 0}, {1, 0}};
       
       
      int getMax(vector<vector<vector<int>>>& dp, string& str, int currIdx = 0, int currMax = 0, int rem = 1) {
          if(currIdx == str.length()) return 0;
       
          if(dp[currIdx][currMax][rem] != -INF) return dp[currIdx][currMax][rem];
       
          int charIdx = str[currIdx] - 'A' + 1;
       
          int possibleAnswer = - INF;
       
          if(rem == 1) {
              for(int i = 1; i <= 5; i ++) {
                  int temp = pow(10, i - 1);
                  if(i >= currMax) possibleAnswer = max(possibleAnswer, temp + getMax(dp, str, currIdx + 1, i, 0));
                  else possibleAnswer = max(possibleAnswer, -temp + getMax(dp, str, currIdx + 1, currMax, 0));
              }
          }
          
          int temp = pow(10, charIdx - 1);
          if(charIdx >= currMax) possibleAnswer = max(possibleAnswer, temp + getMax(dp, str, currIdx + 1, charIdx, rem));
          else possibleAnswer = max(possibleAnswer, - temp + getMax(dp, str, currIdx + 1, currMax, rem));
          
          dp[currIdx][currMax][rem] =  possibleAnswer;
          return dp[currIdx][currMax][rem];
      }
       
      int main() {
          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
       
          int t;
          cin >> t;
       
          while(t --) {
              string s;
              cin >> s;
       
              reverse(s.begin(), s.end());
       
              int n = s.length();
       
              vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(6, vector<int>(2, -INF)));
       
              int answer = getMax(dp, s);
       
              cout << answer << endl;
       
          }
      
»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Very good round, enjoyed it a lot

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

C was logically clear but was unable to code till the end of contest.

anyone explain the code process for the c question

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

What is problem C Wrong answer on test 9 ?

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

I reduced F to this problem: given a set $$$A$$$ of integer coordinates of the form $$$(x, y)$$$, find $$$\displaystyle\max_{S \subseteq A} [(\sum_{(x, y) \in S}x)^2 + (\sum_{(x, y) \in S}y)^2]$$$. Is this something well-known?

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

D was way easier than C and E is almost equal to C. Anyways, good contest.

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

    Can you Explain C and D.Plz.

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

      D: Sort the intervals by their left endpoint. Let $$$dp[i]$$$ be the maximum number of intervals in the range $$$[i, n-1]$$$ that we can keep (so the answer is $$$n - dp[0]$$$).

      We have two transitions: if we decide to skip interval $$$i$$$, then we let $$$dp[i] = dp[i+1]$$$. On the other hand, if we decided to keep interval $$$i$$$, we must find another interval $$$j \gt i$$$ to pair it up with. Now, we might as well pick $$$j$$$ to be the interval with the smallest right endpoint that intersects $$$i$$$, to minimize intersections with other intervals. Note that we have to skip over all other intervals that intersect $$$i$$$ and $$$j$$$, so let $$$dp[i] = 2 + dp[k]$$$, where $$$k$$$ is the leftmost interval that does not intersect intervals $$$i$$$ and $$$j$$$.

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

        I did it slightly differently but the implementation might be cleaner for some.

        Basically, realize that you can reduce the problem to

        1. make a new list of intervals that consists of pairs of intervals in the original array that have nonempty intersection, merged. You can do this in O(n^2).

        2. solve the maximum # of disjoint interval problem on this new list.

        3. your answer is n — 2 * # of disjoint intervals you found in step 2.

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

Test case 9 or problem C ruined my contest.

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

I like to see a magic trick where I lose 100 points at a time

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

Problem F almost = This Problem

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

Problem F almost = This Problem

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

My solution for C was to count the number of "positive" numbers before a letter, ie numbers that weren't guaranteed to be negative by an earlier number. Then calculate the "gain" you get by changing letter s[i] to k, by looking at whether s[i] was guaranteed to be negative by looking at the biggest letter strictly above it, and summing over the number of letters before it that would become negative by changing it to that value. Is this correct? I got wrong answer on testcase 10.

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

Final EDIT: The solution can be negative. Never assume initializing best = 0 will work...

Problem C WA on test 10. Does anyone know what this test is?

Even implemented a brute force solution during the contest and tested on all strings up to length 10 and gives the same result as my solution. What am I missing?

Brute force solution:

def value(s):
    s = [ord(c)-ord('A') for c in s]
    res = 0
    md = 0
    for i in range(len(s)-1, -1, -1):
        if s[i] < md:
            res -= (10 ** s[i])
        else:
            res += (10 ** s[i])
        md = max(md, s[i])
    return res

def generate_replacements(s):
    yield s
    for i in range(len(s)):
        for d in range(5):
            if d == ord(s[i]) - ord('A'):
                continue
            yield s[:i] + chr(ord('A') + d) + s[i+1:]

def brute_force(s):
    return max(value(r) for r in generate_replacements(s))

EDIT: Up to length 10 may not be the best test since 10*D = E, etc. but my code doesn't seem to have issues with things like 100 * 'D' + 'E'.

EDIT2: It does have issues with 100 * 'D' + 'EE' of course...

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

I use prefix sum concept in problem c and change one by one charcter in string and every time i take maximum of all but got wr0ng answer on test case 9. Lmao what is the test case that missed my code anyone?

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

Кажется, что задача С — упрощенная версия задачи "Московские числа" (вроде такое название) с какого-то прошлого всероса

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

SO problem D can be solved by Monotonic stack?

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

have no testers in educational rounds makes trouble again this time in problem F?

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

I tried doing a greedy graphy solution to D but didn't work :D.

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

https://mirror.codeforces.com/contest/1841/submission/209467430

What test case for problem B was this solution failing?

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

    I used 2 variables, a prev and current pointer, but my solution failed like 50 times cuz i forgot to check if i added the element prev is at, also try checking if the current number is smaller than first element if you got to the beauty something part (i hope u understood)

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

I think E is easier than D, didn't feel like it belongs there though...

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

C is hard a little but it's very interesting

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

What's test 10 for C?

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

Why am i getting Wa 9 at Problem C?? I changed every char from A to E and adjusted the change accordingly?? What am I missing?

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

A: If n>=5, Alice can combine n-2 ones to make the array {1, 1, n-2}, and Bob can only make it into {2, n-2} then Alice wins. If n<=4, Bob always wins.

B: A beautiful array need to be increasing, or there's an index i where a[1, i] and a[i+1, n] are increasing and a[n]<=a[1]. Therefore, we first need to check whether the queried x[i] is not smaller than the last appended element. When the first time we meet such x[i] doesn't satisfy the condition and x[i]<=x[1], we need to accept it, but we can't accept numbers where x[i]>x[1] from now on.

C: To solve this problem we need to pre-calculate 5 arrays sum[t][i]: the contribution of s[1, i] if s[i+1]==t and s[i+2, n] doesn't exist. We calculate it by the following process: First let cnt[u]=0 where 'A'<=u<='E'. When we see s[i]<t, we let sum[t][i]=sum[t][i-1]-10^(s[i]-'A') directly, since the contribution of s[i] will always be negative. Otherwise, we need to check for u where t<=u<s[i]: We let sum[t][i]-=2*cnt[u]*10^(u-'A') and cnt[u]=0, which means contribution of occurences of u changed from positive to negative. Finally we let cnt[s[i]]+=1. After we calculate the arrays, the problem can be solved by trying every possible change of s[i].

D: We sort ranges by r[i] increasingly and run dp: dp[i]=the maximum number of valid pairs for first i ranges after sorted. The transition is dp[i]=max(dp[i-1], dp[left(i,j)]+1) where j<i, r[j]>=l[i] and left(i,j) = the maximum index k where r[k]<min(l[i],l[j]).

E: Each row is divided into several segments by black cells. By greedy method we want to fill numbers in longer segments (since a consecutive segment of white cells with length k can contribute k-1 to the answer), so we need to calculate for each k, how many segments of length k in the matrix. If we scan the matrix from up to down (from n-th row to 1st row), we can see if a[j]=i, then there's a white segment being cut at position j when we scan to the i-th row. So we can let cnt[n]=n and cnt[t]=0 (1<=t<=n-1) at the beginning, when we scan to the i-th row, we cut segments at position j for all a[j]=i. When we remove a segment of length k, we let cnt[k]-=i, and when we add a segment of length k, we let cnt[k]+=i. We can store these segments by an ordered map. Finally we check segments from length n to length 2, and fill them to get the answer.

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

    In D, how do you deal with cases where l[i]<l[j]? Thanks in advance!

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

    There's a much easier to implement solution for C. If we change a character with another character having value greater than it, it's always best to change the first occurrence of the original character. And, if we change a character with another character having value less than it, it's always best to change the last occurrence of the original character. So we just have to check values of at most 31 strings, and print the maximum of those.

    UPD: at most 21*

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

    I did it slightly differently but the implementation might be cleaner for some.

    Basically, realize that you can reduce the problem to

    1. make a new list of intervals that consists of pairs of intervals in the original array that have nonempty intersection, merged. You can do this in O(n^2), and multiple versions of the same array do not matter (e.g. the new list can have duplicates).

    2. solve the "maximum # of disjoint interval problem" on this new list of intervals

    3. your answer is n — 2 * # of disjoint intervals you found in step 2.

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

    sum[t][i]=contribution of s[1...i] if s[i+1]==t and s[i+2....n] doesn't exist.

    lets calculate sum[t][i];

    intialise cnt['A']=0,cnt['B']=0,cnt['C']=0,cnt['D']=0,cnt['E']=0;

    sum[t][i]=sum[t][i-1] here sum[t][i-1] is the contribution of s[1....i-1] if s[i]==t.

    if(s[i]<t) sum[t][i]-=value(s[i])

    but if (t at (i+1)th position < s[i]) means that bec u added sum[t][i-1] at there but at the ith place bigger element was there hence therefore for all 'A'<=u<= 'E' and u>=t && u<s[i] which were accounted as positive in sum[t][i-1] now need to be subtracted and make cnt[all need to be subtracted for whom s[i] is the greater just next greater element]=0 now ..

    recurse

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

That feeling when you solve a problem right after the contest is the worst.

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

I managed to bruteforce C by checking every possibility at every position and efficiently calculating the updated string value, did anyone else do the same?

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

Can anyone tell me why my code fails for problem B... 209470922

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

Can hacks affect penalty time?

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

Amazing set of problems.

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

Does anybody know what is testcase 10 for C?

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

Amazing contest! If you guys feel stuck on any of these problems (Problem A, Problem B, Problem C, Problem D), Please checkout this video editorial on Youtube here

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

Hi can anyone help me to find a counter testcase where my code gives runtime error. Got runtime error on test 3 and couldn't find the fix till now. Link:- https://mirror.codeforces.com/contest/1841/submission/209481108

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

What's the technology used in F? I figured out the goal is to maximize $$$(\sum a - \sum b)^2 + (\sum c - \sum d)^2$$$ but i don't know how and seems LGMs' solutions all involved in vector and convex hull things.

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

Can you guys tell where my code is wrong for B[submission:https://mirror.codeforces.com/contest/1841/submission/209450341]

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

    Looks like you might get wrong answer if the first element to break the increasing order is larger than the first element of the array.

    Input:

    1
    1 9
    3 7 7 9 4 4 6 3 4
    

    Correct output:

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

Problem F (same solution): Link

where xi = b - a, yi = d - c

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

Can't you do D in O(nlogn) using RMQs? Should've switched C and D or make n = 2*10^5 in D. Then again it's edu so it doesn't matter as much.

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

for this submission, my pc and ideone.com shows right output, but in cf, a completely different output is shown. can someone pls point out the problem?

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

I am getting TLE in the test case 5 for this solution of the problem c. I have tried a DP solution.

I am not able to get why this solution is giving TLE. I think the time complexity of this solution is O(2e5* 10) or O(N*10). Since here the state is of order: O(N*10) and the transition is of order O(1).

Similarly I am also getting Segmentation Fault when I have run this solution on some random test consisting of string having length nearer to 1e5 on my local system.

The approach, I have used is something like this: For the dp the states were: ind , pos

The first state(ind) is for the index and the another state(pos) is finding two things at any index.

The first thing(last) is the last character occurred till now from the ind+1 to index n-1 and, The second thing(st) is to tell whether we have placed 'E' character or not in some higher index then this index earlier or not.

So over all, I can say: dp[ind][pos] => this will tell me the largest sum I am able to make from the index 0.. to till index ind when the last occurrence maximum alphabet is:'A' + a%5; This last occurrence is from the index ind+1 to index n-1.

So in the recursive function I just try to check If i am able to assign the character 'E' to my current index or not. If I can assign to current character then I will try to get the solution for both the cases when I have assigned to current index and when I have not. and taking maximum of them will be my answer.

If I can not assign then I will just find the value of current character value and try similarly for other lower indexes.

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

    You call the recursive function is called to calculate the dp state dp[ind][pos], but the return line is

    return dp[ind][st] = ans;
    

    This means that the state you're trying to calculate doesn't get stored at dp[int][pos], meaning that successive recursive calls to the same state will not utilize the already calculated dp values, which leads to TLE.

    Fixing this gave me WA9. Here is a case where your code fails:

    Input:
    1
    DDDDDDDDDDDDDDDDDDDDDDDDE
    
    Expected Output:
    25000
    
    Your Output:
    -3000
    
    

    Explanation: Change last E into D.

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

There could be a fun twist to Problem (A):

In every turn the players choose exactly 2 equal numbers and replace them with their sum. They start with $$$n$$$ $$$1(s)$$$ and Alice goes first. The player with all numbers different in their turn wins.
Figure out who will win.

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

In problem C, is it possible to have an answer < 0?

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

One of my friend, I_love_thu_ha, has copied Problem C in recent contest, these codes look the same:

209470016 from I_love_thu_ha

209468826 from chhavirana8

I think they has copied each other or from one source.

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

One of the toughest contest ever faced??

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

Can anyone please help me to figure out... what wrongs in my logic for Problem D... it is giving me wrong answer for 5th test case... I had almost similar approach as others stated here... Any help will be appreciated!

Code Link

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

How much time does it takes to update rating after finishing system testing?

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

for C it was easy to come up with an idea but I found implementation was lengthy and error prone. Does someone have easy implementation for C?

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

Can anyone please explain to me the approach for problem D. And if possible, please share a list of question to master DP.

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

I found a small bug in tourist's code, in the code of his E, he used int where long long should have been used

Here is a python code to make a hack data

import random as rnd
N=200000
print("1\n200000")
for i in range(N):
    if i%3:print(0,end=' ')
    else:print(N,end=' ')
print()

The correct output is 13333200000

But tourist's output is 448298112

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

Hope to release tutorial earlier.

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

can someone tell me how to do problem C with DP

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

Can someone please tell me why my code is failing in D [submission:209540485 Jun/13/2023]

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

Can someone please tell me why my code is failing in D 209540485

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

Finally I became master in this round! And this time I got the highest rank of all Div. 2 round.

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

In question E, I do not understand that the answer to the fourth example is 4

4 2 0 3 1 10

Can someone help me?

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

sorry

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

a similar question approach for 1841-D is in Interviewbit

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

Please help with “Your solution 209416596 for the problem 1841A significantly coincides with solutions theSSS/209391885, tanukool/209416596.”

The only code I used from the common source is for dealing with IO which is from USACO guide. Other than that the solution is my own and it is actually very simple by the nature of the problem so I guess there might be room for collision. Please reconsider this blame.

Edited: Many people got the same solution with similar coding style except it is c++ (e.g. 209387876).

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

Any counter test for this code of C

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

https://youtu.be/xImHQo2cTJU Video solution for D (shameless promotion :P)

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

I have made a detailed video (its in hindi language) to solve problem C using different approaches.
Video link : link
Let me know if it helps you :)

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

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

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

Why did the rating updated before system test again?

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

My opinion about problems and contest: A: I think it was a cute problem. Just some observation and you have it, but if you get stuck, its over. I got stuck btw :'( B: Average. Just some implementation and you have it. C: Its tough, I think it should be at the place of D in the contest. Logic is easy but the implementation is way tough (atleast what I did to AC was really tough and annoying to code). D: Its easier, I think it would had around 3-4k AC in the contest if it was at the place of C. Most of the people got stuck into C and didn't moved forward.

If you're Interested to know about any of my approach then do let me know. I would love to explain. Overall Nice Contest. Great Problems.

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

The problem C has weakly pretest, maybe you need play genshin