A11831 | Petr and Permutations
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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$ 中随机提取一对不同的元素,并将它们互换。亚历克斯非常羡慕彼得,并试图在所有事情上模仿他。亚历克斯还想出了一个关于随机排列的问题。他生成了一个和彼得一样的随机排列,但他交换了 $7n+1$ 次元素,而不是 $3n$ 次。因为这样随机性更大,好吗?
你从其中一个问题中得到了一个测试,现在你想知道是从哪个问题中得到的。
You somehow get a test from one of these problems and now you want to know from which one.
Petr 喜欢想一些关于随机生成数据的问题。这次的问题是关于随机排列的。他决定用这种方法生成随机排列:他从 $1$ 到 $n$ 的数字中提取身份排列,然后在 $3n$ 中随机提取一对不同的元素,并将它们互换。亚历克斯非常羡慕彼得,并试图在所有事情上模仿他。亚历克斯还想出了一个关于随机排列的问题。他生成了一个和彼得一样的随机排列,但他交换了 $7n+1$ 次元素,而不是 $3n$ 次。因为这样随机性更大,好吗?
你从其中一个问题中得到了一个测试,现在你想知道是从哪个问题中得到的。
输入格式
In the first line of input there is one integer $n$ ( $10^{3} \le n \le 10^{6}$ ).
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$ ( $10^{3} \le n \le 10^{6}$ )。
第二行中有 $n$ 个介于 $1$ 和 $n$ 之间的不同整数,即来自测试的大小为 $n$ 的排列。
可以保证除了样本之外的所有测试都是这样产生的:首先,我们选择 $n$ --大小为 $n$ 的排列。然后,我们随机选择一种方法来生成 permutation - Petr 的方法或 Alex 的方法。然后使用所选方法生成一个排列。
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$ ( $10^{3} \le n \le 10^{6}$ )。
第二行中有 $n$ 个介于 $1$ 和 $n$ 之间的不同整数,即来自测试的大小为 $n$ 的排列。
可以保证除了样本之外的所有测试都是这样产生的:首先,我们选择 $n$ --大小为 $n$ 的排列。然后,我们随机选择一种方法来生成 permutation - 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"(不带引号)。
输出
如果测试是通过 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。
由于输入的随机性,禁止在此问题中使用黑客技术。
Due to randomness of input hacks in this problem are forbidden.
备注
请注意,该示例并非有效测试(由于 $n$ 的限制),仅用于说明输入/输出格式。您的程序仍需打印该测试的正确答案,以获得 AC。
由于输入的随机性,禁止在此问题中使用黑客技术。
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted