Monobilliards

Time limit: 1.0 second
Memory limit: 64 MB
A monobilliards table set up in a gaming house of a town N turned out to be a very profitable investment, but only till the day the famous Mr. Chichikov came to the town. Chichikov was winning again and again, and the owner was counting his losses suspecting that something was wrong. But he couldn't prove the cheating until an inspector from Petersburg arrived in the town.
The rules of monobilliards are very simple. One has to pocket successively the balls with numbers 1, 2, …, N into the only pocket (exactly in this order). While Mr. Chichikov was playing, the inspector several times came up to the table and took out from the table's pocket the last of the pocketed balls. In the end it turned out that Chichikov had pocketed all the balls and the inspector had taken out and inspected them. The cheater claimed that he had pocketed the balls in the right order! The owner understood that this was his chance, because the inspector had to remember the order in which he had taken out the balls. But would it be so easy to prove the cheating?

Input

The first line contains the number of billiard balls N (1 ≤ N ≤ 100000). In the next N lines there are the numbers of the balls in the order in which the inspector took them out from the pocket.

Output

Output the word "Cheater" if Chichikov could not pocket all the N balls in the right order, otherwise output "Not a proof".

Samples

input output
2
2
1
Not a proof
3
3
1
2
Cheater

Notes

In the first sample, Chichikov could pocket the balls in the right order if the inspector took them out after Chichikov pocketed the second ball. In the second sample, Chichikov could pocket the balls in any order excepting the right one 1-2-3.
分析:题意大概是按1,2,3...n的顺序放球,然后在任意时间检察员会取出最后一个球,问某一序列是否成立;
   优先队列模拟一下即可;
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
const int maxn=1e5+;
const int dis[][]={{,},{-,},{,-},{,}};
using namespace std;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p;p=p*p;q>>=;}return f;}
int n,m,k,t,now;
bool flag;
priority_queue<int>a;
int main()
{
int i,j;
now=;
scanf("%d",&n);
while(n--)
{
scanf("%d",&j);
while(now<=j)a.push(now),now++;
if(a.top()!=j)flag=true;
else a.pop();
}
if(flag)puts("Cheater");
else puts("Not a proof");
//system("pause");
return ;
}

ural1494 Monobilliards的更多相关文章

  1. 1494. Monobilliards(栈)

    1494 之前记得数据结构试卷上有这种题 就是判断某一出栈顺序 是不是满足以1.2...n为入栈顺序 a1,a2,a3..an; 对于任意相邻a[i],a[i+1] 如果a[i]>a[i+1]+ ...

  2. ural 1494 Monobilliards

    #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ],b ...

随机推荐

  1. Ajax+Spring MVC实现跨域请求(JSONP)JSONP 跨域

    JSONP原理及实现 接下来,来实际模拟一个跨域请求的解决方案.后端为Spring MVC架构的,前端则通过Ajax进行跨域访问. 1.首先客户端需要注册一个callback(服务端通过该callba ...

  2. PS:抠图方法1(利用对比度ctrl+l)

    PS:抠图方法1(利用对比度ctrl+l) 工具/原料   Photoshop.美女照片 方法/步骤     小编使用的是Photoshop cs5版本,大家使用其他版本都没有关系,界面略有不同,但操 ...

  3. think in uml-关系

    1.关联关系association 在一段时间内将多个类的实例连接在一起 某个对象在一段时间内一直"知道"另一个对象的存在 2.依赖关系dependency 一个对象的修改会导致另 ...

  4. fp oo

    http://blog.enfranchisedmind.com/2009/05/scala-not-functional/

  5. ENC28j60以太网芯片驱动程序简介

    ENC28j60以太网芯片驱动程序简介 ENC28J60 驱动开发要点 enc28J60 和 Arduino (1)——ping通你的Arduino MCU51单片机uIP协议栈+ENC28J60网卡 ...

  6. css 重新学习系列(2)

    摘自: http://www.cnblogs.com/liuzhaoyang/articles/3289456.html Position定位:relative | absolute 定位一直是WEB ...

  7. liunx 平台下软件包管理

    RPM/DPKG 两大阵营简介 在 GNU/Linux( 以下简称 Linux) 操作系统中,RPM 和 DPKG 为最常见的两类软件包管理工具,他们分别应用于基于 RPM 软件包的 Linux 发行 ...

  8. 【转载】关于SetWindowOrgEx、SetViewportOrgEx、SetViewportExtEx 和SetWindowExtEx 详解

    关于SetWindowOrgEx.SetViewportOrgEx.SetViewportExtEx 和SetWindowExtEx 详解 1.  SetWindowOrgEx是设置窗口的原点坐标. ...

  9. 转:WebDriver进行屏幕截图

    例: 打开百度首页 ,进行截图 01 packagecom.example.tests;  02 importjava.io.File;  03 importorg.apache.commons.io ...

  10. 43个优秀的Swift开源项目推荐(转载)

    ["轮子"] 工具类 SwiftyJSON:GitHub 上最为开发者认可的 JSON 解析类 Dollar.swift:Swift 版 Lo-Dash (或 underscore ...