Chapter 221: Pattern

The difficulty of the questions in this National Information Computer Olympiad is obviously one level higher than that of the city competition.

It is also more difficult than the provincial competition.

The return of the expedition, bubbling sorting......

The computer-based test paper is preceded by some precautions.

Regarding the executable file name, input file name, output file name, time limit per test point, memory limit, and the file name of the submitted source program for C++ language, C language, and Pascal language requirements, the result comparison method is to ignore the space at the end of the line, and the full text comparison after the carriage return at the end of the text will not be accepted.

The rules of this precaution are the same as those for the college entrance examination.

For multiple-choice questions, you need to use a 2B pencil, you have to fill it up, otherwise you can't scan, don't answer the question beyond the answer area, otherwise the answer will be considered invalid, etc., in short, follow the rules.

After reading the precautions, Zhou Xian entered the first test return journey, the background of the question, the story of this question takes place in the magic city, here we will introduce you to some necessary settings.

The magic can be abstracted into an n nodes, an undirected connected graph of m edges, the nodes are numbered from 1 to n, and we use i,a to describe the length and elevation of an edge.

As a representative city of the monsoon climate, the magic city is often accompanied by rain, so it is inevitable that the roads will be waterlogged, and since the entire urban drainage system is connected, the waterlogged edges must be the lowest elevations.

We use the water mark to describe the degree of rainfall, which means that all the elevations above the water mark are waterlogged.

Yazid is an OIer from the City of Mana, who has just finished participating in the ION2002 and is about to embark on his return journey to his warm home.

Yazid's home happens to be on node 1 of the Magic City, and for the following Q days, every day Yazid will tell you his starting point v, as well as the watermark p for the day.

......

......

......

Some test points of this question are mandatory to be online, please refer to [Input Format] and [Subtask] for specific details.

Input format, read data from the file return,in.

A single test point contains multiple sets of data, the first line of input is a non-negative integer T, the number of groups of data is shown in Table 6, and each set of data is described in the next time......

......

......

Minutes and seconds passed.

11:25 p.m.

After fighting for a few hours, Zhou Xian completed all the exercises, these questions were quite time-consuming, this time he did not walk out of the examination room in advance arrogantly, because the knowledge of these questions is not only for you to understand, but also to examine your way of thinking, if it weren't for his previous life's skills, according to pure intelligence, Zhou Xian felt that he would definitely be useless.

After all, he is not a natural scholar, and he does not have the thinking mode of professional competition, he basically relies on the prophet plug-in, and he has studied computer science for many years before he is like a fish in water.

Why is he so slow to solve the problem this time, that is, in the way of thinking, he solves the problem, but the solution may not be the fastest way, if it is not for the experience of the old way, others with the same method at this time can not do it at all, although the method is not the shortest, but so what, he still completed it in the examination room, solved the problem, and hung it.

Experience to make up, this is also his own [apex www.booktxt.xyz] people now have more skills.

Others can't.

The reborn Zhou Xian's IQ may not have become smarter, but he is experienced and rich, which is the capital to beat those computer geniuses.

"Teacher Cheng Yan, Teacher Wang, in the past, Zhou Xian either submitted the papers in advance, or he could finish the exam in half the time, this time Zhou Xian, he hasn't come out yet, there are other candidates who have come out before, Zhou Xian is not hanging this time. ”

"Isn't it, isn't it?"

Teacher Geng kept walking back and forth.

Although Zhou Xian has created a miracle and can reach the national arena quite powerfully, Mr. Geng thinks that Zhou Xian is going to stop here, but on the other hand, he also hopes that Zhou Xian can actually continue to create miracles.

"Teacher Geng, your point of view is not quite right, you have not brought the Olympiad, this year is the first year to bring the Olympiad of Informatics, let me talk about my experience, I have taken the physics Olympiad of No. 1 Middle School for many years, and there are also students who have been sent to Qingbei University, no, to participate in the Olympiad, your radical idea now is not good, because ......"

Cheng Yan didn't speak, and Teacher Wang said.

This national competition made Zhou Xian realize that his creativity on the computer was insufficient.

However, for the technology that he conquered many later generations of the Internet, those are his creativity ahead of others, and this is enough, these can make themselves preemptive, occupy half of the future Internet, at that time he can still fight with them on the front line, at that time is to recruit the most creative young people to their own company, they are all big bosses are still in the front line of programming, just that pattern, that is not successful.

"After the exam, the students all came out. ”

Many instructors are looking forward to their disciples.

"Zhou Xian, how are you doing, can you win the national first prize again!"

"Zhou Xian, you told me that you would win the first prize, the teacher took it seriously, after the exam, do you still have the confidence to say. ”

Teacher Geng's monkey looked anxious.

“......”

Teacher Wang was speechless, and his feelings were plainly said to Teacher Geng just now.

She told Teacher Geng not only to see the students win awards and certificates, because the Olympiad, from the entry to the award, has gone through no less hardships than going through a college entrance examination, participating in the Olympiad, can not just think about the result, to pay attention to the growth of students, after participating in the Olympiad, students imperceptibly, change and cast is the character, quality, vision, and even life pattern, not just a result.

"Teacher Geng, I'll know when the results come out. ”

Zhou Xian suddenly said so "low-key", Teacher Geng chuckled psychologically, this Zhou Xian has always believed in himself, and he is extremely confident after every exam, but this time he actually said so, he may not do well in the exam, this idea made him a little disappointed.

In the end, the miracle still failed to continue, but Teacher Jiang had a different point of view, and she saw the obvious growth of Zhou Xian.

In the past, he didn't take the Olympiad in his eyes, he was very arrogant, and it was no problem to win the first prize after the exam, but this time he restrained a lot, there is no shortage of smart students, but smart and self-aware students are particularly valuable, so they can go further.

She likes Zhou Xian's classmate more and more.

Accommodation in the National Olympiad in the magic capital, accommodation and food are all included, and there is nothing to do outside, and after the exam, the teachers have booked tickets to go back to Jiangcheng.

When Jiangcheng was waiting for the results of the national competition, Zhou Xian was like a spinning top, updating "Zhu Xianji" at night, and before he was sent to Qingbei during the day, he still had to go to school honestly, and "Miracle" was going to hold a public beta over there, Jiang Dabai's advertisement was filmed, and he wanted to choose that TV station to advertise, and Gao Peng was also looking for himself, didn't he promise that he would invest part of the real estate funds he started......