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

Автор MateoCV, 3 недели назад, По-английски

Hola Codeforces!

The 2024 Argentinian Programming Tournament (TAP) was held last weekend. This is a 2024-2025 ICPC subregional contest for teams from Argentina to qualify to the South America/South Regional contest. You can send your solutions or do a virtual participation in the Codeforces gym. I invite you all to solve the problems.

The problems were written and prepared by elsantodel90, fredy10, Guty, lsantire, MarcosK, pablobce, reedef and me (MateoCV)

I would like to thank CodigoL, FedeNQ, JPrime, Marckess, MrNachoX and visho33 for solving and reviewing the problems and providing valuable feedback.

Feel free to use this blog to discuss about the problems :)

Happy coding!

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

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

Thanks to the authors for producing such a great GYM!!

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

Hint J,K?

  • »
    »
    3 недели назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится
    • K: pensá únicamente en la última columna con caracteres ocupados.
    • J: No intentes cosas muy sofisticadas.
  • »
    »
    3 недели назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    For J

    Hint 1
    Hint 2

    There is more to it than these hints, but IMO the problem is mostly annoying to implement rather than difficult to get to the answer.

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

      I did this but it still gives me wrong on test 7?!

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

        What about numbers that are contiguous and add up to X, just think about all the edge cases.

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

      Isn't it simply a question of calculating x combinations and seeing if there are enough elements (x-1) to intercede between them?

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

could someone please give me a hint for L

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

    Try and think if agustin and juan share any numbers

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

      yeah i think about that and augustin will take such a number because he is playing first but still have a wrong answer in test case 8

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

        Are you sure the first player will always pick that number? I'd suggest you handle that case separately. Also, keep in mind that, if the amount of times said number appears on the range is odd, one of them will pick it more often.

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

hint B?

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

    First of all, it is clear that the usefull segments can be like $$$(1, d)$$$ where $$$d$$$ is a divisor of the number $$$K$$$. Think in cases with a lot of divisors like $$$K = 12$$$, can $$$(1, 2)$$$ or $$$(1, 3)$$$ be minimal or there is another segment that makes them unncesary?

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

where can I find the editorial?

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

Hit C? Plaese

Spoiler
  • »
    »
    13 дней назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится
    That's not enough
    Hint
    • »
      »
      »
      6 дней назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Another hint?

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

        Sure

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

Can someone give me a hint for E please?

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

    It's a classical DP problem.

    Hint 1
    Hint 2
»
8 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hint For Problem L? Please.

  • »
    »
    6 дней назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
    Hint 1
    Hint 2
    Hint 3
    • »
      »
      »
      6 дней назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Thanks

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

      I thinks we can we store the count of powers of 2 and count of odd numbers and then ee just compare the sum.

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

        You're close.

        Hint 4
        Hint 5
        • »
          »
          »
          »
          »
          6 дней назад, # ^ |
            Проголосовать: нравится -8 Проголосовать: не нравится

          Yah I have used but It gives me wrong answer on test case 4 and this is the code i have used


          #include <bits/stdc++.h> using namespace std; int main(){ int n, q; cin >> n >> q; vector<int> a(n); for(int i = 0; i < n; ++i){ cin >> a[i]; } vector<long long> x(n, 0), y(n, 0); if((a[0] & (a[0] - 1)) == 0) x[0] = a[0]; for(int i = 1; i < n; ++i){ if((a[i] & (a[i] - 1)) == 0) x[i] += x[i - 1] + a[i]; else x[i] = x[i-1]; } if(a[0] & 1) y[0] = a[0]; for(int i = 1; i < n; ++i){ if(a[i] & 1) y[i] += y[i - 1] + a[i]; else y[i] = y[i-1]; } while(q--){ int lo, hi; cin >> lo >> hi; lo--, hi--; if(lo == 0){ long long f = x[hi]; long long s = y[hi]; cout << (f > s ? "A" : f < s ? "B" : "E") << '\n'; continue; } long long f = x[hi] - x[lo - 1]; long long s = y[hi] - y[lo - 1]; cout << (f > s ? "A" : f < s ? "B" : "E") << '\n'; } }
          • »
            »
            »
            »
            »
            »
            5 дней назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            I see what the problem is. Try running your code with the following test case:

            5 1
            1 1 1 1 1
            1 5
            

            Your code will probably output E, since you're counting the number one twice, but the answer should be A.

            I suggest you count the ones separately by storing them on another prefix sum array.

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

hint for I pls ><