Donald and Mike are the leaders of the free world and haven’t yet (after half a year) managed tostart a nuclear war. It is so great! It is so tremendous!
Despite the great and best success of Donald’s Administration, there are still a few things helikes to complain about.
The Mexican government is much smarter, much sharper, and much more cunning.And they send all these bad hombres over because they don’t want to pay for them.They don’t want to take care of them.
Donald J. Trump, First Republican Presidential Debate, August 6, 2015
He also frequently compares `Mexicans` to other bad people (like Germans, since they areexporting so many expensive cars to the US). Due to the tremendous amount of statementshe has made (mostly containing less than 140 characters ...) the “Fake-News” New YorkTelegraph (NYT) has to put in a lot of effort to clarify and comment on all the statements ofDonald. To check a statement, they have a list of facts they deem to be true and classify Donald’sstatements into three groups: real facts (which are logical conclusions from their list of truefacts), exaggerations (which do not follow, but are still consistent with the papers list of facts),and alternative facts (which contradict the knowledge of the newspaper).
They have asked you to write a program helping them to classify all of Donald’s statements –after all it is hard for a journalist to go through them all and check them all, right?
Input
The input consists of:
one line containing two integers nn and mm, where
- n (1 \leq n \leq 200)n(1≤n≤200) is the number of facts deemed true by the NYT;
- m (1 \leq m \leq 200)m(1≤m≤200) is the number of statements uttered by the Donald.
nn lines each containing a statement deemed true by the NYT.
mm lines each containing a statement uttered by the Donald.
All statements are of the form aa` are worse than `bb, for some strings aa and bb, stating that aa is (strictly) worse than bb. The strings aa and bb are never identical. Both aa and bb are of lengthbetween 11 and 3030 characters and contain only lowercase and uppercase letters of the Englishalphabet.
Note that Donald’s statements may contain countries that the NYT does not know about. Youmay assume that worseness is transitive and that the first nn lines do not contain any contradictorystatement. Interestingly, Donald’s press secretary (Grumpy Sean) has managed to convince himnot to make up countries when tweeting, thus the input mentions at most 193193 different countries.
Output
For every of the mm statements of Donald output one line containing
`Fact` if the statement is true given the n facts of the NYT
`Alternative Fact` if the inversion of the statement is true given the n facts of theNYT
`Pants` on Fire if the statement does not follow, but neither does its inverse.
样例输入复制
4 5 Mexicans are worse than Americans Russians are worse than Mexicans NorthKoreans are worse than Germans Canadians are worse than Americans Russians are worse than Americans Germans are worse than NorthKoreans NorthKoreans are worse than Mexicans NorthKoreans are worse than French Mexicans are worse than Canadians
样例输出复制
Fact Alternative Fact Pants on Fire Pants on Fire Pants on Fire
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
You just bought a large piece of agricultural land, but you noticed that – according to regulations– you have to test the ground water at specific points on your property once a year. Luckilythe description of these points is rather simple. The whole country has been mapped using aCartesian Coordinate System (where (0, 0)(0,0) is the location of the Greenwich Observatory). Thecorners of all land properties are located at integer coordinates according to this coordinatesystem. Test points for ground water have to be erected on every point inside a property whosecoordinates are integers.
Input
The input consists of:
- one line with a single integer n (3 \leq n \leq 100 000)n(3≤n≤100000), the number of corner points of yourproperty;
- nn lines each containing two integers xxand y (-10^6 \leq x, y \leq 10^6)y(−106≤x,y≤106), the coordinates ofeach corner.
The corners are ordered as they appear on the border of your property and the polygon describedby the points does not intersect itself.
Output
The number of points with integer coordinates that are strictly inside your property.
样例输入复制
4 0 0 0 10 10 10 10 0
样例输出复制
81
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
The lectures are over, the assignments complete and even those pesky teaching assistantshave nothing left to criticize about your coding project. Time to play some video games! Asalways, your procrastinating self has perfect timing: Cold Weather Entertainment just releasedÜberwatch, a competitive first person video game!
Sadly, you aren’t very good at these kind of games. However, Überwatch offers more than justskill based gameplay. In Überwatch you can defeat all opponents in view with a single buttonpress using your ultimate attack. The drawback of this attack is that it has to charge over timebefore it is ready to use. When it is fully charged you can use it at any time of your choosing.After its use it immediately begins to charge again.
With this knowledge you quickly decide on a strategy:
- Hide from your opponents and wait for your ultimate attack to charge.
- Wait for the right moment.
- Defeat all opponents in view with your ultimate attack.
- Repeat.
After the game your teammates congratulate you on your substantial contribution. But youwonder: How many opponents could you have defeated with optimal timing?
The game is observed over nn time slices. The ultimate attack is initially not charged and requires mm time slices to charge. This first possible use of the ultimate attack is therefore in the (m+1)(m+1)-thtime slice. If the ultimate attack is used in the ii-th time slice, it immediately begins chargingagain and is ready to be fired in the (i + m)(i+m)-th time slice.
Input
The input consists of:
one line with two integers n and m, where
– n (1 \leq n \leq 300 000)n(1≤n≤300000) is the game duration;
– m (1 \leq m \leq 10)m(1≤m≤10) is the time needed to charge the ultimate attack in time slices.
one line with nn integers x_i (0 \leq x_i \leq 32)xi(0≤xi≤32)describing the number of opponents in viewduring a time slice in order.
Output
Output the maximum number of opponents you can defeat.
样例输入1复制
4 2 1 1 1 1
样例输出1复制
1
样例输入2复制
9 3 1 1 2 2 3 2 3 2 1
样例输出2复制
5
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
The latest quarterly report of the Pump Organization does not look promising at all: the costsexploded while the revenue decreased by 42%. Taking a closer look at the numbers, CEODagobert J. Pump comes to the conclusion that the only way to save the company is to fire someof the employees.
The problem is that CEO Pump just recently claimed in an interview that "he is the greatest jobcreator that God ever created". So if he fired too many people, the dishonest corrupted left-wingmedia would certainly report about it, which would make him look extremely unreliable. ThePR experts of the Pump Organization already estimated a number of employees that CEO Pumpmay fire without raising any attention in the media. To be on the safe side, CEO Pump furtherdecides to fire as few employees as possible.
Taking a list of all employees of his company and their respective salary, CEO Pump has to saveat least dd Dollars by firing not more than kkemployees. If this is possible, CEO Pump wants topersonally tell each and every one of them: YOU ARE FIRED!
Input
The input consists of:
one line with three integers n, dn,d, and kk, where
– n (1 \leq n \leq 10 000)n(1≤n≤10000) is the number of employees of the Pump Organization;
– d (1 \leq d \leq 10^9)d(1≤d≤109) is the amount of money that CEO Pump needs to save at least;
– k (1 \leq k \leq n)k(1≤k≤n) is the maximum number of employees that CEO Pump can firewithout raising attention in the media.
nn lines each containing a string s_isi and an integer c_ici, where
– s_i (1 \leq |s_i| \leq 7)si(1≤∣si∣≤7) is the name of the ii-th employee;
– c_i (1 \leq c_i \leq 100 000)ci(1≤ci≤100000) is the salary of the ii-th employee.
All s_isi are distinct and only contain lowercase and uppercase letters of the English alphabet.
Output
If there is no way to save at least dd Dollars by firing not more than kk employees, output `impossible`.
If there is a way to save at least dd Dollars by firing not more than k employees, then the outputconsists of:
- one line containing a single integer x (1 \leq x \leq k)x(1≤x≤k), where xx is the number of people to befired.
- xx lines each containing the string s_isi, `YOU ARE FIRED!`, where s_isi is the name of the ii-th employee to be fired.
If there are multiple solutions, any of them will be accepted.
本题答案不唯一,符合要求的答案均正确
样例输入1复制
5 2000 3 John 999 Lyndon 450 Richard 1234 Gerald 1001 Jimmy 300
样例输出1复制
2 Richard, YOU ARE FIRED! Gerald, YOU ARE FIRED!
样例输入2复制
3 5555 2 Ronald 1000 George 2000 Bill 3000
样例输出2复制
impossible
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include