My USACO Practice question

Over the past few weeks, I’ve been practicing for the USACO Silver contests and solving a wide variety of problems that have helped me grow as a competitive programmer. Through these problems, I’ve learned several important algorithms and techniques, including prefix sums, DFS, BFS, reverse and multi source BFS, flood fill, greedy algorithms, and the two pointer technique.

One important lesson I’ve discovered while solving USACO problems is that it’s crucial not to jump straight into coding after reading the problem. If your initial idea or algorithmic concept is wrong, you might end up wasting a lot of time debugging or rewriting your solution. Instead, it’s better to analyze the constraints, for example, looking at the values of N and T to determine whether the problem can be solved with brute force, a two pointer approach, or if it requires a more optimized or mathematical solution.

Among the problems I’ve solved, one that I found challenging and both fun was “Multiplayer Moo.” The difficult part of this problem was finding the largest connected region consisting of two distinct numbers. A brute force approach that checks all possible pairs would be far too slow possibly N^2. The key insight is to only consider numbers that are adjacent to each other in the grid. By doing this, you can efficiently check which regions are connected. It’s also important to maintain an auxiliary array to keep track of visited cells or connected components that have already been processed.
https://github.com/Jasper-World/USACO

Passing USACO bronze section

Two months ago, I participated in the USA Computing Olympiad (USACO) Bronze division, and the result was a great success. I scored 767 points across three problems. In the first problem, Roundabout Rounding, I solved all 13 test cases correctly, and it took me about an hour to complete. For the second problem, Farmer John’s Cheese Block, I managed to pass 7 out of 16 test cases. Looking back, I believe I could have done better, but considering I hadn’t yet learned how to work with 3D grids at the time, I’m still proud and a bit surprised by how much I was able to accomplish. The last problem, It’s Mooin’ Time, was, in my opinion, the most challenging of the three, but I still managed to figure out the solution and pass all the test cases correctly.

Overall, I was very proud of myself for passing USACO Bronze. I’m now currently working toward passing Silver, and I quickly realized that Silver is much harder than Bronze. It requires a stronger grasp of algorithms and greater control over functions. Back when I was preparing for Bronze, I mostly used brute force and vectors. But now, I’ve learned more advanced algorithms such as the two pointer technique, greedy strategies, prefix sums, binary search, BFS, and DFS. On the functions side, I’ve become familiar with built in tools like sort, pair, void, abs, min, max, and more. Hopefully, by the end of this year, I’ll successfully pass Silver and begin my journey toward USACO Gold.

Lanqiaobei-Blue Bridge Cup

In this weekend I attend the Lanqiaobei competition and Sunday is the day of the national competition. This competition is an online one and it faces at all the Chinese people.You have to go through three rounds to know your prize:first you need to fight against the kid living in the same District as you,then only the children who have got the first prize can participate the next round.And ,here I will tell you a two amazing thing first is if the first round you didn’t pass than you have another chance to do it again,second is if you do it very well and you are the one who is top 10% in your district than you can directly advance to the national competition.If you pass the first round than congratulations you are in the second round every one who come here are all elite,and the test is more complicated than in the first round and you have to compete with the kid in the same province,and if you win then you have to face the children who come from every place in China and they are more difficult to deal with than during the provincial competition.But in my opinion if you carefully review the question and do it with the fastest thinking, I believe you can succeed.

And now I will talk about what knowledge you need to succeed the test:If you are preparing to visit round one than at least you need to how to draw an circle on the screen,you open the action and find the display then set up shape and circle,and there is lot of value you need to change and now lets make the circle move we’ll let it move around in x axis.First we need to make variable called x,and we write in a number zero.Second we use a loop and we let the increment the x variable by one every time and give it to the x variable which is the circle one,and now we give it back to the x variable this to refresh the x variable if we don’t do that than the circle will stall in the same place forever .

But if you want to succeed, these are not enough. You need to know what type of questions he will solve for each question. If you’re both in the creative programming intermediate group like me, then these will definitely be helpful for you when preparing for the competition:For the choice question they will always test you for some basic knowledge first.But here is not also easy they will test you for binary and they will write a lot of program involved using variable and math or range module.And next is the Programming questions,the first one they will maybe just let you use you motor to run.The second one is about sound or about the brick status light.These two are very easy right but when come to the third one it change,in the third question you need to use loop and switch and maybe you need to use some sensor like the color sensor.The forth one is about the x variable and y variable they Basically will require you to use many small cubes to assemble large cubes and in the 14th edition they ask you to right 14 in the matrix,here you need to think about whether to write hard or logically using loops and variables to write it.The fifth question is testing you about the variable using and your logic,without too much explanation here, you can check the original questions from previous years to practiceThe sixth one is the same.

Roborave Asia Championship

In the last month I participated in the Roborave competition.I was part of primary line patrol group.My team was the winner.there were four rounds and take the best two times.There were customary and elimination game I will tell the elimination games now.

Our team has two types of program: the general patrol and the gyroscope patrol.In the regular game we use the general patrol and utilize my block builder when the left color sensor detect the black stripe it will turn left the opposite is true on the right.Our car use middle motor to run because with the same power middle motor is faster than other motor

For the gyroscope patrol you need gyroscope sensor the best place to install is to put in the middle of the car ensure you don’t put it upsidedown and this program needs the color senser too the theory is that when the left color senser seen the stripe and we’ll use the gyroscope senser to turn.And it will be faster than the regular patrol

Even though our program was perfect but that also posed problem. When we’re training we find out just having a good program is not enough. You still need a car that suits the program we went through three generations to finally create the right car

At first we use the general big motor but it’s to slow it 100 power is not half as fast as the next generation So then the next one come,this time we use four motor acceleration consequently when first test it crash.the third general is the final one which is the most suitable for our program this time it’s not to fast and not to slow we use just two middle motor.

Or teamwork was very great one of us started the program and I took the car back to the promoter region and the third boy would place the ball in the car after I took it back.This tactic has saved us a lot of time which is an important part of helping us become the winner.Know you may say why don’t other team do that?they do it too but not faster as we did or they has only two people

We also have two little skill we will took a long a timer and when the race isn’t start we would go to every site to test and see where the fastest run is using the same program.Every one knows when you buy a EV3 host it will bring his own EV3 dedicated battery but do you know the one that manufacturer gives you isn’t the one can let the motor run fastest In fact, the household battery at home runs the fastest, but you need to be careful of its battery level at all times because it won’t display the battery level like traditional ones. However, if you fully charge it in the morning, you don’t have to worry about running out of battery

When we first arrive to the site we were excited and a little worried about strong opponents but after about half an hour we took a look around and then we surprised to find that we were the best actually we were five points higher than the second place.

Million rabbit Program

In the spring festival holiday,I write a million rabbit program because this year is rabbit year ,I came up the idea from a fast food restaurant there is hundreds of chickens on the tablecloth. I want to do like this:

firstly I want to make it all different and colorful, second

the rabbit will covered the whole screen,and last I made every rabbit covers the feet that was on the top of it.

Fastly I make the first version the good thing is there’s all different and very colorful,the bad news is there’s many space and it could only draw two rabbit at once .

After thinking I recognize it’s because of the ear’s is irregular pattern it’s to big,so I make a new one the ear’s is smaller and there is more kind of eye’s and mouth but all program have their flaw,sometime the rabbit can covered the last rabbit face,and it will randomly appear in the same place so if you want to make the rabbit to cover the whole screen than you need to wait it for a long time.

Well,I took a different tack the last program I made the rabbits randomly appear on the screen but this time I think about it if you want to cover the last one feet you need to make it stagger

Like this:

the first loop is for drawing the first row if it come to 240 pixel it will come down a little bit, and the x coordinate will reinitialize to -214 and it just right covers the last rabbit feet

As you can see on the first row there is a rabbit that has only body

So I made a latest program at first there is only body,but if you run the program very fast you will realize it wasn’t didn’t draw it because of the body is slower and it cover the five senses,so I add a waiting then the body will appear first at the screen and a second later five senses(every sense is correspond to a acter) begin to draw out.

After writing the program I recognize that there are two ways to program.The first way is multithreading every acter have a program and it have priority I time it and it’s very fast it only take up 5 second.

The second one is single thread every acter work together like a teem it take up 20 second it because the fist acter finish drawing the body and it send a message to the others and wait for them to finish drawing the other part of the rabbit

So I learn a thing is that when you write a program or something you need to first organize the structure and it’s multithreading or single thread.

And know I will show the result of all version of the million rabbit program.

The first version

the second version

million rabbit program3

million rabbit final edition

million rabbit final edition(plus)