题意:有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. bzoj3105 [cqoi2013]新Nim游戏——贪心+线性基

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3105 首先,要先手必胜,就不能取后让剩下的火柴中存在异或和为0的子集,否则对方可以取成异或和 ...

  2. [Swift通天遁地]四、网络和线程-(6)检测网络连接状态

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  3. 推荐给Web前端开发人员的一些书籍(从基础到架构阶段)

    有很多人问我说作为一个前端开发人员都需要看一些什么书籍,尤其是刚入门的新手,今天我整理了一下推荐给大家,大佬绕过. HTML+CSS+JavaScript 网页设计 从入门到精通 作为一个前端新手,强 ...

  4. C# 针对文件夹的操作

    //创建文件夹Directory.CreateDirectory(Server.MapPath("a"));Directory.CreateDirectory(Server.Map ...

  5. String,StringBuffer和StringBuilder

    在执行速度方面的比较:StringBuilder > StringBuffer StringBuffer与StringBuilder,他们是字符串变量,是可改变的对象,每当我们用它们对字符串做操 ...

  6. ASP.NET MVC5 之数据迁移

    SQL 中新建数据库 DataSystem 1.web.config 数据库连接字符串: <add name="APPDataConnection" connectionSt ...

  7. 在vSphere Client上安装虚拟机工具VMware Tools

    一.什么是虚拟机工具 VMware Tools是一套安装在虚拟机操作系统中的实用程序.VMware Tools可提高虚拟机的性能,并在 VMware产品中实现多个易于使用的功能. 尽管客户机操作系统在 ...

  8. 通过HTTP协议实时获取微信聊天记录

    第一步:登陆 1.get访问微信首页https://wx.qq.com 提供session.headers 用途:获取cookie 后续访问必须带session.headers.cookie这三个参数 ...

  9. 定制UVM Messages(参考)

    UVM的Messages机制有些时候很繁琐,很多时候希望能够在UVM messages的基础上做一些个人化的订制,这里给出来一个找到的例子作为参考. my_macros.sv:    `define ...

  10. html——meta标签、link标签

    <meta> 元素可提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词. <meta> 标签位于文档的头部,不包含任何内容.&l ...