MateoCV's blog

By MateoCV, 4 months ago, In English

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!

  • Vote: I like it
  • +103
  • Vote: I do not like it

»
4 months ago, # |
  Vote: I like it +13 Vote: I do not like it

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

»
4 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Hint J,K?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it
    • K: pensá únicamente en la última columna con caracteres ocupados.
    • J: No intentes cosas muy sofisticadas.
  • »
    »
    4 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    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.

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it +8 Vote: I do not like it

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

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I didn't get what you meant.

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I don't think I ended up solving that one so I don't get what I mean either haha All good!

»
4 months ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

could someone please give me a hint for L

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Try and think if agustin and juan share any numbers

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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.

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hint B?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    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?

»
4 months ago, # |
  Vote: I like it +8 Vote: I do not like it

where can I find the editorial?

»
4 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Hit C? Plaese

Spoiler
  • »
    »
    4 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
    That's not enough
    Hint
    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Another hint?

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Sure

        Hint 2
        Hint 3
        Hint 4
»
3 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Can someone give me a hint for E please?

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    It's a classical DP problem.

    Hint 1
    Hint 2
    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Could you give me a case for hint 2, I don't really get it. Thanks

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hint For Problem L? Please.

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it
    Hint 1
    Hint 2
    Hint 3
    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You're close.

        Hint 4
        Hint 5
        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it -8 Vote: I do not like it

          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'; } }
          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            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.

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

hint for I pls ><

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There is a classical problem to pass through every edge of a graph.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hello need hit H?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hint M? is this Convex Hull?