You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
the Power Gem of purple color,
the Time Gem of green color,
the Space Gem of blue color,
the Soul Gem of orange color,
the Reality Gem of red color,
the Mind Gem of yellow color.
Using colors of Gems you saw in the Gauntlet determine the names of absent Gems.
Input
In the first line of input there is one integer nn (0≤n≤6) — the number of Gems in Infinity Gauntlet.
In next nn lines there are colors of Gems you saw. Words used for colors are: purple, green, blue, orange, red, yellow. It is guaranteed that all the colors are distinct. All colors are given in lowercase English letters.
Output
In the first line output one integer mm (0≤m≤6) — the number of absent Gems.
Then in mm lines print the names of absent Gems, each on its own line. Words used for names are: Power, Time, Space, Soul, Reality, Mind. Names can be printed in any order. Keep the first letter uppercase, others lowercase.
Examples
input
Copy
4 red purple yellow orange
output
Copy
2 Space Time
input
Copy
0
output
Copy
6 Time Space Power Reality Mind Soul
Note
In the first sample Thanos already has Reality, Power, Mind and Soul Gems, so he needs two more: Time and Space.
In the second sample Thanos doesn‘t have any Gems, so he needs all six.
题意:6种石头对应六中颜色,然后输入颜色,求没出现的颜色对应的石头
直接set处理下
#include<bits/stdc++.h>
#define ll long long
usingnamespace std;
map<string,string> mp;
int main()
{
int n;
set<string> s;
string p;
mp["purple"]="Power";
mp["green"]="Time";
mp["blue"]="Space";
mp["orange"]="Soul";
mp["red"]="Reality";
mp["yellow"]="Mind";
map<string,string>::iterator ip;
for(ip=mp.begin();ip!=mp.end();ip++)
{
s.insert(ip->second);
}
scanf("%d",&n);
int m=n;
while(n--)
{
cin>>p;
s.erase(mp[p]);
}
printf("%d\n",6-m);
set<string>::iterator it;
for(it=s.begin(); it!=s.end(); it++)
{
cout<<*it<<endl;
}
}
B. High School: Become Human
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.
It turns out that high school struggles are not gone. If someone is not like others, he is bullied. Vasya-8800 is an economy-class android which is produced by a little-known company. His design is not perfect, his characteristics also could be better. So he is bullied by other androids.
One of the popular pranks on Vasya is to force him to compare x with yx. Other androids can do it in milliseconds while Vasya‘s memory is too small to store such big numbers.
Please help Vasya! Write a fast program to compare xy with yx for Vasya, maybe then other androids will respect him.
Input
On the only line of input there are two integers xx and yy (1≤x,y≤109).
Output
If xy<yx, then print ‘<‘ (without quotes). If xy>yx, then print ‘>‘ (without quotes). If xy=yx, then print ‘=‘ (without quotes).
Examples
input
Copy
5 8
output
Copy
>
input
Copy
10 3
output
Copy
<
input
Copy
6 6
output
Copy
=
Note
In the first example 58=5?5?5?5?5?5?5?5=39062558=5?5?5?5?5?5?5?5=390625, and 85=8?8?8?8?8=3276885=8?8?8?8?8=32768. So you should print ‘>‘.
In the second example 103=1000<310=59049103=1000<310=59049.
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are nn displays placed along a road, and the ii-th of them can display a text with font size sisi only. Maria Stepanovna wants to rent such three displays with indices i<j<ki<j<k that the font size increases if you move along the road in a particular direction. Namely, the condition si<sj<sksi<sj<sk should be held.
The rent cost is for the ii-th display is cici. Please determine the smallest cost Maria Stepanovna should pay.
Input
The first line contains a single integer nn (3≤n≤3000) — the number of displays.
The second line contains nn integers s1,s2,…,sn(1≤si≤109) — the font sizes on the displays in the order they stand along the road.
The third line contains nn integers c1,c2,…,cn (1≤ci≤108) — the rent costs for each display.
Output
If there are no three displays that satisfy the criteria, print -1. Otherwise print a single integer — the minimum total rent cost of three displays with indices i<j<ki<j<k such that si<sj<sksi<sj<sk.
Some company is going to hold a fair in Byteland. There are nn towns in Byteland and mm two-way roads between towns. Of course, you can reach any town from any other town using roads.
There are kk types of goods produced in Byteland and every town produces only one type. To hold a fair you have to bring at least ssdifferent types of goods. It costs d(u,v)d(u,v) coins to bring goods from town uu to town vv where d(u,v)d(u,v) is the length of the shortest path from uuto vv. Length of a path is the number of roads in this path.
The organizers will cover all travel expenses but they can choose the towns to bring goods from. Now they want to calculate minimum expenses to hold a fair in each of nn towns.
Input
There are 4 integers n, m, k, s in the first line of input (1≤n≤105, 0≤m≤105, 1≤s≤k≤min(n,100)) — the number of towns, the number of roads, the number of different types of goods, the number of different types of goods necessary to hold a fair.
In the next line there are nn integers a1,a2,…,an(1≤ai≤k), where aiai is the type of goods produced in the ii-th town. It is guaranteed that all integers between 11 and kk occur at least once among integers aiai.
In the next mm lines roads are described. Each road is described by two integers uu vv (1≤u,v≤nu≠v) — the towns connected by this road. It is guaranteed that there is no more than one road between every two towns. It is guaranteed that you can go from any town to any other town via roads.
Output
Print nn numbers, the ii-th of them is the minimum number of coins you need to spend on travel expenses to hold a fair in town ii. Separate numbers with spaces.
Examples
input
Copy
5 5 4 3 1 2 4 3 2 1 2 2 3 3 4 4 1 4 5
output
Copy
2 2 2 2 3
input
Copy
7 6 3 2 1 2 3 3 2 2 1 1 2 2 3 3 4 2 5 5 6 6 7
output
Copy
1 1 1 2 2 1 1
Note
Let‘s look at the first sample.
To hold a fair in town 1 you can bring goods from towns 1 (0 coins), 2 (1 coin) and 4 (1 coin). Total numbers of coins is 2.
Town 2: Goods from towns 2 (0), 1 (1), 3 (1). Sum equals 2.
Town 3: Goods from towns 3 (0), 2 (1), 4 (1). Sum equals 2.
Town 4: Goods from towns 4 (0), 1 (1), 5 (1). Sum equals 2.
Town 5: Goods from towns 5 (0), 4 (1), 3 (2). Sum equals 3.
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from 11 to nn and then 3n3n times takes a random pair of different elements and swaps them. Alex envies Petr and tries to imitate him in all kind of things. Alex has also come up with a problem about random permutation.
He generates a random permutation just like Petr but swaps elements 7n+1times instead of 3n times. Because it is more random, OK?!
You somehow get a test from one of these problems and now you want to know from which one.
Input
In the first line of input there is one integer n (103≤n≤106).
In the second line there are nn distinct integers between 1 and n — the permutation of size nn from the test.
It is guaranteed that all tests except for sample are generated this way: First we choose nn — the size of the permutation. Then we randomly choose a method to generate a permutation — the one of Petr or the one of Alex. Then we generate a permutation using chosen method.
Output
If the test is generated via Petr‘s method print "Petr" (without quotes). If the test is generated via Alex‘s method print "Um_nik" (without quotes).
Example
input
Copy
5 2 4 5 1 3
output
Copy
Petr
Note
Please note that the sample is not a valid test (because of limitations for n) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.
Due to randomness of input hacks in this problem are forbidden.