pair的使用
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cstdio>
#include<list>
#include<sstream>
//#include<regex>
using namespace std;
typedef long long ll;
int INF=;
int inf=-;
#define read(x) scanf("%d",&x);
#define fo(i,n) for(int i=0;i<(n);i++)
#define me(a) memset(a,0,sizeof(a));
#define one(x) cout<<(x)<<endl;
#define two(a,b) cout<<(a)<<" "<<(b)<<endl;
#define three(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl;
#define four(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl;
//int dir[4][2]={-1,0,1,0,0,-1,0,1};
//int dir[8][2]={-1,0,1,0,0,-1,0,1,-1,-1,1,1,1,-1,-1,1};
//int dir[4][2]={-2,0,2,0,0,-2,0,2};
int main()
{
//ios::sync_with_stdio(false);
int n,i,l=,r=,ans=,a,b;
cin>>n;
pair<int,int>p[];
for(i=;i<n;i++){
cin>>p[i].first>>p[i].second;
//p[i]=make_pair(a,b);
if(p[i].first<)
l++;
else
r++;} sort(p,p+n);
for(i=max(,l-r-);i<=min(n,l*);i++)
ans+=p[i].second; cout<<ans;
return ;
}
pair的使用的更多相关文章
- c++ pair 使用
1. 包含头文件: #include <utility> 2. pair 的操作: pair<T1,T2> p; pair<T1,T2> p(v1,v2); pai ...
- 论Pair的重要性
这些天我在用React和D3做图表,从已经实现的图表里复制了一些坐标轴的代码,发现坐标轴上的n个点里,只有第一个点下面能渲染出文字提示,其余点下面都无法渲染出文字. 和组里的FL一起百思不得其解好几天 ...
- 2016 ACM/ICPC Asia Regional Dalian Online 1010 Weak Pair dfs序+分块
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submissio ...
- 【C++】pair
STL的pair,有两个值,可以是不同的类型. template <class T1, class T2> struct pair; 注意,pair在头文件utility中,不要inclu ...
- hackerrank Similar Pair
传送门 Problem Statement You are given a tree where each node is labeled from 1 to n. How many similar ...
- uva12546. LCM Pair Sum
uva12546. LCM Pair Sum One of your friends desperately needs your help. He is working with a secret ...
- C++标准库 -- pair
头文件:<utility> 可访问属性: first 第一个值 second 第二个值 可访问方法: swap(pair) 和另外一个pair交换值 其他相关方法: make_pair(v ...
- 2016 大连网赛---Weak Pair(dfs+树状数组)
题目链接 http://acm.split.hdu.edu.cn/showproblem.php?pid=5877 Problem Description You are given a rooted ...
- C++学习之Pair
C++学习之Pair Pair类型概述 pair是一种模板类型,其中包含两个数据值,两个数据的类型可以不同,基本的定义如下: pair<int, string> a; 表示a中有两个类型, ...
随机推荐
- C#高级编程笔记2016年10月12日 运算符重载
1.运算符重载:运算符重重载的关键是在对象上不能总是只调用方法或属性,有时还需要做一些其他工作,例如,对数值进行相加.相乘或逻辑操作等.例如,语句if(a==b).对于类,这个语句在默认状态下会比较引 ...
- 1.44tft
https://item.taobao.com/item.htm?spm=a230r.1.14.107.pBOVu5&id=16660981098&ns=1&abbucket= ...
- HashMap和 Hashtable的比较
Hashtable 和 HashMap的比较 1. HashMap可以接受null(HashMap可以接受为null的键值(key)和值(value), HashTable不可以接受为null的键( ...
- 将本地项目提交到coding上托管
1: 注册coding并新建项目test2:在终端 cd 到要提交的项目 使用git init创建.git文件夹3:使用git pull <项目地址>https的那个4:git a ...
- 【项目】百度搜索广告CTR预估
-------倒叙查看本文. 6,用auc对测试的结果进行评估: auc代码如下: #!/usr/bin/env python import sys def auc(labels,predicted_ ...
- Linux下安装MongoDB
MongoDB是一个C++编写的基于分布式文件存储的数据库,是一个介于关系和非关系之间的数据库,当然也属于NoSQL的行列,存储方式和Redis类似,是json格式的kav-value存储方式,只是R ...
- websocket与socket.io
什么是Websocket? Websocket是一个独立于http的实时通信协议,最初是在HTML5中被引用进来的,在HTML5规范中作为浏览器与服务器的核心通信技术被嵌入到浏览器中.WebSocke ...
- [iOS]创建一像素的线
float sortaPixel = 1.0/[UIScreen mainScreen].scale; UIView* line = [[UIView alloc]initWithFrame:CGRe ...
- c/c++ 缓冲区的刷新
利用string 对象查看缓冲区的变化,因为每个string对象在输入时会以空格作为分界. #include<iostream> #include<string> using ...
- 相机变换与Ray-Casting
p { margin-bottom: 0.1in; direction: ltr; line-height: 120%; text-align: justify; orphans: 0; widows ...