题意:有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. Spark中统计程序运行时间

    import java.text.SimpleDateFormat import java.util.Date val s=NowDate() //显示当前的具体时间 val now=new Date ...

  2. PCB Genesis脚本 C#调用Python

    在PCB行业,Genesis的二次开发的编程脚本越来越丰富了啊,从一开始进入眼界的Genesis脚本语言是很少的,CSH,PERL, 再后来慢慢发展,VB,易语言,VB.NET,C#,Java,TCL ...

  3. jquery模拟下拉框

    <!DOCTYPE html> <html lang="en"> <head> <title>jquery模拟SELECT框< ...

  4. P3399 丝绸之路(线性二维dp)

    P3399 丝绸之路 题目背景 张骞于公元前138年曾历尽艰险出使过西域.加强了汉朝与西域各国的友好往来.从那以后,一队队骆驼商队在这漫长的商贸大道上行进,他们越过崇山峻岭,将中国的先进技术带向中亚. ...

  5. [Apple开发者帐户帮助]七、注册设备(2)注册多个设备

    如果您有许多测试设备,则可以创建包含设备名称和设备ID的文件,并将整个文件上载到开发人员帐户.您的开发人员帐户支持以下两种文件格式:具有.deviceids文件扩展名和纯文本文件的属性列表文件.您选择 ...

  6. js判断客户端是手机端还是PC端

    封装函数: function isPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", ...

  7. 聪明的kk --- 搜索超时

    二话没说上去搜索 , 果不其然 华丽超时 . #include<stdio.h> #include<string.h> #include<math.h> #incl ...

  8. Jsp入门小常识

    因为选修了一门信息系统的课,选择了用jsp做了一个系统.在这期间自学了jsp的一点皮毛,特与大家分享: script标签:用于向jsp中嵌入java代码块,<%  // embed java c ...

  9. ACM_lowbit

    lowbit Time Limit: 2000/1000ms (Java/Others) Problem Description: long long ans = 0; for(int i = 1; ...

  10. 再战primer——decltype 和引用

    刷primer看到原文讲到"引用从来都作为其所指对象的同义词出现,只有用在decltype处是一个例外.",我很是好奇. 这个“引用”当然是指引用类型,like this: ; i ...