题意:有n个数,将其分组使整个数列排序后每组中的数仍在该组中,求最多的分组数。

代码很易懂

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime> using namespace std; pair<int,int> a[]; int main()
{
int i,Max=,Ans=,n; cin >> n;
for(i=;i<=n;++i)
{
cin >> a[i].first;
a[i].second=i;
} sort(a+,a+n+); for(i=;i<=n;++i)
{
if(a[i].second>Max)Max=a[i].second;
if(i>=Max)Ans++;
} cout << Ans << endl;
return ;
}

[cf 599C] Day at the Beach的更多相关文章

  1. Codeforces 599C Day at the Beach(想法题,排序)

    C. Day at the Beach One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunate ...

  2. Codeforces 599C. Day at the Beach 模拟

    Day at the Beach time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  3. codeforce 599C Day at the Beach

    Bi表示第i个块,那么就是说Bi max ≤ Bi+1 min,又因为Bi min ≤ Bi max, 因此只要判断前缀的最大值是否小于等于后缀. #include<bits/stdc++.h& ...

  4. CodeForces 599C Day at the Beach

    预处理一下i到n的最小值. #include<cstdio> #include<cstring> #include<cmath> #include<algor ...

  5. C. Day at the Beach

    codeforces 599c C. Day at the Beach One day Squidward, Spongebob and Patrick decided to go to the be ...

  6. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  7. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  8. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  9. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

随机推荐

  1. Behavior Designer扩展

    BehaviorManager.instance.Tick(behaviorTree); 卸载update里u3d直接卡死 = = SharedVariable直接赋值会改变他的引用关系,必须用XXX ...

  2. jquery中对于为一组标签赋予点击事件

    可以用each,但是each不能对动态的元素进行事件的绑定, 不过,其实也很简单,只需要获取所有的标签集,然后用动态绑定的方法,比如live进行绑定就可以了. 有时候,其实不难,只是自己想的太过复杂. ...

  3. sessionStorage 的使用

    sessionStorage 的使用: sessionStorage.removeItem("data"); sessionStorage.getItem("data&q ...

  4. cocos2dx实现单机版三国杀(二)

    接上续,东西还没有做完 所以代码免不了改动 之前的头文件现在又改了不少,因为架构也改变了现在主要类就是GameScene.GameUI.PlayInfo.Poker这四个类  前面想的GameLoop ...

  5. Ambari?自动部署Hadoop集群

    自动部署?Ambari Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是顶级项目.就 Ambari 的作用来说,就是创建 ...

  6. 初学者Android studio安装

    学习过java基础,最近趁着大量课余时间想学习Android开发.百度很多资料Android studio,由Google开发的开发工具,那就不需要再多说.对于初学者的我来说,一定足够用了.此文主要介 ...

  7. jQuery——this

    js注册事件this代表的dom对象 jQuery注册事件this代表的也是dom对象,所以需要$(this)转成jQuery对象

  8. (转) Arcgis for Javascript实现两个地图的联动

    http://blog.csdn.net/gisshixisheng/article/details/40127895 今天在看天地图的时候,有一个多时相的地图显示功能,感觉很好玩,作为技术控的我晚上 ...

  9. ICMP,ARP协议

    ICMP ICMP是(Internet Control Message Protocol)Internet控制报文协议.它是TCP/IP协议族的一个子协议,用于在IP主机.路由器之间传递控制消息.控制 ...

  10. BZOJ 2276: [Poi2011]Temperature 单调队列

    Code: #include<bits/stdc++.h> #define maxn 3000000 using namespace std; void setIO(string s) { ...