[luogu CF1427F] Boring Card Game (nature)

Boring Card Game Title Link: luogu CF1427F Main idea Give you 6n cards in order, and two people take turns to take three consecutive cards at a time. Then give you the 3n cards that the first person wants, ensure that there is a way to get them, and ask you to output the scheme. (this is not a game, and the two can be regarded as cooperation ...

Posted by Johannes80 on Sat, 10 Sep 2022 21:15:33 +0300

2022 Hangzhou Electric Power Multi-School 9 (Summary + Supplement)

summary Today, this multi-school should be the best one to hit this summer vacation (although the ranking is not very high). My starting teammate found that the tree dp was signed in for question 1009. I thought about guessing an even-numbered side. I stared at my teammate and wrote A for ten minutes. Then we went to see 1003 again. After my t ...

Posted by thomasgrant on Thu, 18 Aug 2022 22:30:52 +0300

P1792 [national training team] planting trees

Problem surface Luogu preface At the beginning, I don't want to write this question, because I can't write a linked list (it seems that I haven't written it several times). Finally, with the encouragement (oppression) of the coach, he made up for his knowledge about the linked list and barely passed the problem. (after all, the linked list was ...

Posted by pablocullen on Fri, 20 May 2022 23:16:04 +0300

2020-09-03 / 04 test question solution

2020-09-03 test questions Hobson's Trains Title portal General idea of the topic Give a graph to ensure that each point has only one edge. For each point, add 1 to all the point answers on the path of \ (k \) step, and ask the answer of each last point. \(n\le 5\times 10^5\) thinking It was sb time for the exam and I didn't figure out how to do ...

Posted by frosero on Wed, 18 May 2022 15:53:14 +0300

Optimizing DP with Dij's idea

1, Content If the state transition equation of \ (DP \) is \ (f[i]=min\{f[i],\sum f[j]+k \} \) Then we can consider optimizing it with the idea of \ (Dij \) Because if the \ (f \) value of a point is the smallest, no other point can affect it Therefore, every time we take the smallest point from the heap and update other points 2, Examples 1. L ...

Posted by BenProl on Sat, 14 May 2022 19:28:38 +0300

[Solution] CF767E Change-free

Los Valley Links Forgot to enter the translation of this question, I read the English original... First, it's a greedy problem Greedy strategy: From the first day to the last day, you can choose to ask for money or not to ask for money every day. If you do not ask for money, the amount of change m minus the extra change; . In this case, we can ...

Posted by Adarmo on Fri, 13 May 2022 19:50:54 +0300

[caption] [note] repentance of Greed & lgP3620|lgP1484|lgP1792

[explanation] [note] repentance of Greed & \ (lgp3620 | lgp1484 | lgp1792 \) Write in front Let's take \ (lgP1484 \) as an example. In the examination room, I wrote a \ (DP (50pts) \) and put the code first. Although it is not a positive solution, it is similar to the idea of positive solution. #include <bits/stdc++.h> using namespace ...

Posted by plzhelpme on Sat, 07 May 2022 08:30:53 +0300

Algorithm - greedy algorithm

preface Greedy algorithm is my favorite algorithm. It is simple and effective. It is easy to think of ideas, but it is troublesome to prove its correctness. 1, Thought Greed means that when making a choice, we should choose the most favorable result for ourselves every time to ensure the maximization of our own interests. Greedy algo ...

Posted by matthijs on Wed, 27 Apr 2022 06:50:44 +0300

P1016 [NOIP1999 improvement group] traveler's budget

P1016 [NOIP1999 improvement group] traveler's budget This question, wow, took me a long time. I'm too delicious, so I decided to write a blog and sort out my ideas~ Let's look at the topic first A traveler wants to drive a car from one city to another at the least cost (assuming the fuel tank is empty at the time of departure). Given the dista ...

Posted by thegman on Tue, 26 Apr 2022 10:24:02 +0300

LeetCode question bank: greedy algorithm

LeetCode notes: greedy algorithm Since the University, I have been learning some algorithms and data structures one after another. At the same time, I also began to brush questions on some platforms and participate in some algorithm competitions, large and small. However, the lack of purposefulness and systematicness of problem brushing at ord ...

Posted by i on Mon, 18 Apr 2022 21:03:31 +0300