‘Do you know what a gamer does first when he starts a new game?’
‘No. He goes to the graphics settings and sets everything to maximum.
Only after that he starts the training and realizes that it works too slowly.
So he goes to the settings once again, turns half of the options off,
returns to the training, and so on until he has found suitable parameters.
Or until he’s tired—then he quits the game and deletes it, which we don’t want to happen.’
‘What do you suggest?’
‘Look. When all the graphics enhancements are turned off, a frame with resolution w × h pixels
is generated in w · h GPU cycles. We know the factors by which the generation is slowed down
when a certain option is turned on. So we can calculate the number of GPU cycles in which
a frame is generated for a given set of options. Dividing the clock rate of the GPU by this number,
we obtain the number of frames per second. If it is too small or too large, we will write about it in the graphics settings.’
The first line contains the number of graphics options n
(0 ≤ n
≤ 100 000).
In the i
-th of the following n
lines you are given a word si
, which is the name of the
-th option, and an integer ki
(2 ≤ ki
≤ 100), which is the factor by which the image generation is slowed down
when this option is switched on. The names of the options contain only lowercase English letters, and
their lengths are from 1 to 10. The next line contains integers W
, and p
separated with a space (320 ≤ W
≤ 2 560; 200 ≤ H ≤ 1 600;
1 ≤ p
They are the initial width and height of the screen in pixels and the clock rate of the GPU in cycles per second.
At the beginning all the options are turned on. In the following line you are given the total number m (1 ≤ m ≤ 100 000)
of the changes in the option settings made by the user. Each of the following m
lines has one of the formats:
- “On s” — switch on the option with name s;
- “Off s” — switch off the option with name s;
- “Resolution w h” — set the screen resolution to w × h pixels (320 ≤ w ≤ 2 560; 200 ≤ h ≤ 1 600).
It is guaranteed that an option s has been turned off when the change “On s” is applied and
turned on when the change “Off s” is applied.
The first line should describe the performance of the game before changes in the settings.
Then next m lines should describe the performance of the game after each change in the settings.
Output “Slideshow” if the image generation speed is less than 10 frames per second,
“Perfect” if it is 60 frames per second or greater, and “So-so” otherwise.
640 480 10000000
Resolution 320 240
Problem Author: Denis Dublennykh
Problem Source: Ural Sport Programming Championship 2013