### MateoCV's blog

By MateoCV, 2 weeks ago,

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

 » 2 weeks ago, # |   +27 These were the authors of each problem:
 » 2 weeks ago, # |   +13 Thanks to the authors for producing such a great GYM!!
 » 2 weeks ago, # |   +8 Hint J,K?
•  » » 2 weeks ago, # ^ |   +8 K: pensá únicamente en la última columna con caracteres ocupados. J: No intentes cosas muy sofisticadas.
•  » » 2 weeks ago, # ^ |   +8 For J Hint 1If you sort the numbers, what are the different possibilities for adjacent numbers to add up to X? Hint 2What's the max number of $x / 2$ you can have in the list?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.
•  » » » 11 days ago, # ^ |   0 I did this but it still gives me wrong on test 7?!
•  » » » » 11 days ago, # ^ |   +8 What about numbers that are contiguous and add up to X, just think about all the edge cases.
•  » » » 9 days ago, # ^ |   0 Isn't it simply a question of calculating x combinations and seeing if there are enough elements (x-1) to intercede between them?
•  » » » » 8 days ago, # ^ |   0 I didn't get what you meant.
•  » » » » » 4 days ago, # ^ |   0 .ComplaintFrame { display: inline-block; position: absolute; top: 0; right: -1.4em; } .ComplaintFrame a { text-decoration: none; color: #ff8c00; opacity: 0.5; } .ComplaintFrame a:hover { opacity: 1; } ._ComplaintFrame_popup p, ._ComplaintFrame_popup button { margin-top: 1rem; } ._ComplaintFrame_popup input[type=submit] { padding: 0.25rem 2rem; } ._ComplaintFrame_popup ul { margin-top: 1em !important; margin-bottom: 1em !important; } I don't think I ended up solving that one so I don't get what I mean either haha All good!
 » 2 weeks ago, # | ← Rev. 4 →   0 could someone please give me a hint for L
•  » » 13 days ago, # ^ |   0 Try and think if agustin and juan share any numbers
•  » » » 12 days ago, # ^ |   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
•  » » » » 13 hours ago, # ^ |   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.
 » 13 days ago, # |   0 hint B?
•  » » 11 days ago, # ^ |   +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?
 » 12 days ago, # |   +8 where can I find the editorial?
 » 11 days ago, # | ← Rev. 2 →   0 Hit C? Plaese SpoilerCheck if the intersection point of the line between the sun and the ape and the z=0 plane lies inside the polygon base of the pyramid.
•  » » 8 days ago, # ^ |   +3 That's not enoughWhat if the base is like a peanut (2 circles connected via a curved path, don't know a better way to explain the image I'm thinking about). In that case you could have the projection of the apex inside the base but you would wrongly say that there is no shadow region, there is one between the circles. HintWhat happens if a face doesn't get the sun light? What's the condition for that (or the opposite) to happen?
•  » » » 13 hours ago, # ^ |   0 Another hint?
•  » » » » 13 hours ago, # ^ |   0 Sure Hint 2If a face is shadowed then it casts a shadow. Hint 3To check if a face is shadowed you can check if the sun is "behind" the plane that the face lies in. Hint 4Just use the normal of the face defined by the points it contains and see the condition it must satisfy with a vector from the apex to the sun.
 » 4 days ago, # |   +9 Can someone give me a hint for E please?
•  » » 13 hours ago, # ^ | ← Rev. 2 →   0 It's a classical DP problem. Hint 1You have N weapons, and each of them has an associated cost and profit. Each weapon can only be picked at most once. You want to pick the weapons in such a way that the sum of their "profits" is maximal. Hint 2Division can be expensive and imprecise, especially if you're working with floats. Use cross multiplication to sort the weapons by their costs.
 » 45 hours ago, # |   0 Hint For Problem L? Please.
•  » » 14 hours ago, # ^ | ← Rev. 2 →   0 Hint 1You'll be given three types of numbers: the ones A can chose, the ones B can chose, the ones both can choose and the ones neither one can chose. Do you care about all of them? Hint 2Since the game only ends when neither player can choose a number and a player's score is the sum of all the numbers they picked, we can conclude the score of each player is the sum of all the numbers they can pick in that range. Can you think of an efficient way of calculating the answer? Hint 3There is one number both players can pick. Since they're playing optimally, they'll always pick it in order to maximize their score. What happens if the amount of times this number appears in the range is even? And what if it's odd?
•  » » » 9 hours ago, # ^ |   0 Thanks
•  » » » 9 hours ago, # ^ |   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.
•  » » » » 8 hours ago, # ^ |   0 You're close. Hint 4One is a power of two because 2 ^ 0 = 1. Hint 5Use prefix sums to efficiently calculate the answer.
•  » » » » » 6 minutes ago, # ^ |   0 Yah I have used but It gives me wrong answer on test case 4 and this is the code i have used #include using namespace std; int main(){ int n, q; cin >> n >> q; vector a(n); for(int i = 0; i < n; ++i){ cin >> a[i]; } vector 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'; } }