CF986B.Petr and Permutations
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 1 to n and then 3n 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+1 times 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.
Petr 喜欢设计关于随机生成数据的题目。这次的题目是关于随机排列的。他采用如下方式生成一个随机排列:首先取从 1 到 n 的恒等排列,然后重复 3n 次,每次随机选取两个不同的元素并交换它们。Alex 很羡慕 Petr,并试图在各方面模仿他。Alex 也设计了一个关于随机排列的题目:他生成随机排列的方式与 Petr 完全相同,但交换操作执行 7n+1 次,而不是 3n 次。因为这样“更随机”,对吧?!
你偶然得到了其中一道题目的测试用例,现在你想判断它来自哪一道题。
输入格式
In the first line of input there is one integer n (103≤n≤106).
In the second line there are n distinct integers between 1 and n — the permutation of size n from the test.
It is guaranteed that all tests except for sample are generated this way: First we choose n — 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.
输入的第一行包含一个整数 n(103≤n≤106)。
第二行包含 n 个互不相同的整数,取值范围为 1 到 n —— 即测试中给出的长度为 n 的排列。
除样例外,所有测试数据均按如下方式生成:首先选定 n(即排列的长度);然后随机选择一种排列生成方法(Petr 的方法或 Alex 的方法);最后使用所选方法生成排列。
输出格式
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).
如果测试用例是通过 Petr 的方法生成的,则输出 “Petr”(不带引号)。如果测试用例是通过 Alex 的方法生成的,则输出 “Um_nik”(不带引号)。
输入输出样例
输入#1
5 2 4 5 1 3
输出#1
Petr
说明/提示
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.
请注意,样例不是一个有效的测试用例(受限于 n 的取值范围),仅用于说明输入/输出格式。但你的程序仍需对此样例输出正确答案才能通过(AC)。
由于本题的输入具有随机性,因此禁止使用 hack。
输入解题思路,AI测评打分。不知道怎么写?