ural 1273. Tie
1273. Tie
Memory limit: 64 MB
Input
Output
Sample
| input | output |
|---|---|
3 |
1 |
Problem Source: Ural State University championship, October 25, 2003
/**
Create By yzx - stupidboy
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef double DB;
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, s, t) for(int i = (s); i >= (t); i--)
#define Rep(i, t) for(int i = (0); i < (t); i++)
#define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
#define rep(i, x, t) for(int i = (x); i < (t); i++)
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair
inline void SetIO(string Name)
{
string Input = Name+".in",
Output = Name+".out";
freopen(Input.c_str(), "r", stdin),
freopen(Output.c_str(), "w", stdout);
} inline int Getint()
{
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const int N = ;
typedef pair<int, int> II;
int n;
II Data[N];
int Arr[N], Dp[N]; inline void Input()
{
scanf("%d", &n);
For(i, , n) scanf("%d%d", &Data[i].ft, &Data[i].sd);
} inline void Solve()
{
sort(Data + , Data + + n);
For(i, , n) Arr[i] = Data[i].sd;
For(i, , n)
{
Dp[i] = ;
For(j, , i - )
if(Arr[j] < Arr[i])
Dp[i] = max(Dp[i], Dp[j] + );
} int Ans = ;
For(i, , n) Ans = max(Ans, Dp[i]);
printf("%d\n", n - Ans);
} int main()
{
#ifndef ONLINE_JUDGE
SetIO("I");
#endif
Input();
Solve();
return ;
}
ural 1273. Tie的更多相关文章
- Ural 1741 Communication Fiend(隐式图+虚拟节点最短路)
1741. Communication Fiend Time limit: 1.0 second Memory limit: 64 MB Kolya has returned from a summe ...
- URAL 1779 F - The Great Team 构造
F - The Great TeamTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest ...
- URAL 1776 C - Anniversary Firework DP
C - Anniversary FireworkTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/c ...
- URAL 1741 Communication Fiend
URAL 1741 思路: dp 状态:dp[i][1]表示到第i个版本为正版的最少流量花费 dp[i][0]表示到第i个版本为盗版的最少流量花费 初始状态:dp[1][0]=dp[0][0]=0 目 ...
- URAL 1501 Sense of Beauty
URAL 1501 思路: dp+记忆化搜索 状态:dp[i][j]表示选取第一堆前i个和第二堆前j的状态:0:0多1个 1:0和1相等 2:1 ...
- URAL 1029 Ministry
URAL 1029 思路: dp+记录路径 状态:dp[i][j]表示到(i,j)这个位置为止的最少花费 初始状态:dp[1][i]=a[1][i](1<=i<=m) 状态转移:dp[i] ...
- URAL 1658 Sum of Digits
URAL 1658 思路: dp+记录路径 状态:dp[i][j]表示s1为i,s2为j的最小位数 初始状态:dp[0][0]=0 状态转移:dp[i][j]=min(dp[i-k][j-k*k]+1 ...
- URAL 1303 Minimal Coverage
URAL 1303 思路: dp+贪心,然后记录路径 mx[i]表示从i开始最大可以到的位置 sufmx[i]表从1-i的某个位置开始最大可以到达的位置 比普通的贪心效率要高很多 代码: #inclu ...
- URAL 1183 Brackets Sequence
URAL 1183 思路:区间dp,打印路径,详见http://www.cnblogs.com/widsom/p/8321670.html 代码: #include<iostream> # ...
随机推荐
- FineUI第四天---PageManage的概述
页面级别的配置PageManager控件的配置 每一个使用FineUI控件的页面都必须包含一个PageManager控件,我们可以把PageManager控件看做页面级别的参数配置(相对于Web.co ...
- 在Linux上使用的10种云备份方案
导读 不久前,为用户提供一种备份远程机器上数据的简易方法还很稀奇.现在,我们已觉得这理所当然.Dropbox及其他公司简化了这项任务.苹果.谷歌和微软都提供各自的数据备份方法. 在Linux上,情况有 ...
- Google Chrome浏览器调试入门————转载只为自己查看方便
Google Chrome浏览器调试 作为Web开发人员,我为什么喜欢Google Chrome浏览器 [原文地址:http://www.cnblogs.com/QLeelulu/archive/20 ...
- Ubuntu上安装gtk2.0不能安装的问题,“下列的软件包有不能满足的依赖关系”
zez@localhoss:~$ sudo apt-get install libgtk2.0-dev正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 ...
- java中queue的使用
Queue接口与List.Set同一级别,都是继承了Collection接口.LinkedList实现了Queue接 口.Queue接口窄化了对LinkedList的方法的访问权限(即在方法中的参数类 ...
- python声明文件编码,必须在文件的第一行或第二行
#coding=utf-8和# -*- coding: utf-8 -*-的作用 – 指定文件编码类型 注意的两点: 1.声明必须在文件的第一行或第二行: 2.coding后面必须紧跟冒号或等号,#c ...
- 37.寻找丑数[Ugly numbers]
[题目] 我们把只包含质因子2.3和5的数称作丑数(Ugly Number),例如:2,3,4,5,6,8,9,10,12,15,等,习惯上我们把1当做是第一个丑数.求按从小到大的顺序的第1500个丑 ...
- iOS 定义圆角控件
ios7 以前,想把UILabel变为圆角的,只需要设置layer的 cornerRadius属性,ios7以后,还需要设置 masksToBounds = true. 以下是这个属性的说明 A Bo ...
- ACdream 1195 Sudoku Checker (数独)
Sudoku Checker Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit ...
- Android 设置旋转朝向
在AndroidMenifest.xml中activity标签中,添加一个属性 android:screenOrientation="landscape"