CF1101E Polycarp's New Job

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<bitset>
#include<ctime>
#include<deque>
#include<stack>
#include<functional>
#include<sstream>
//#include<cctype>
//#pragma GCC optimize(2)
using namespace std;
#define maxn 100005
#define inf 0x7fffffff
//#define INF 1e18
#define rdint(x) scanf("%d",&x)
#define rdllt(x) scanf("%lld",&x)
#define rdult(x) scanf("%lu",&x)
#define rdlf(x) scanf("%lf",&x)
#define rdstr(x) scanf("%s",x)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int U;
#define ms(x) memset((x),0,sizeof(x))
const long long int mod = 1e9 + 7;
#define Mod 1000000000
#define sq(x) (x)*(x)
#define eps 1e-4
typedef pair<int, int> pii;
#define pi acos(-1.0)
//const int N = 1005;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> pii;
inline ll rd() {
ll x = 0;
char c = getchar();
bool f = false;
while (!isdigit(c)) {
if (c == '-') f = true;
c = getchar();
}
while (isdigit(c)) {
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return f ? -x : x;
} ll gcd(ll a, ll b) {
return b == 0 ? a : gcd(b, a%b);
}
int sqr(int x) { return x * x; } /*ll ans;
ll exgcd(ll a, ll b, ll &x, ll &y) {
if (!b) {
x = 1; y = 0; return a;
}
ans = exgcd(b, a%b, x, y);
ll t = x; x = y; y = t - a / b * y;
return ans;
}
*/ priority_queue<int>q;
priority_queue<int>q2; int main() {
//ios::sync_with_stdio(0);
int n;
rdint(n);
for (int i = 1; i <= n; i++) {
char op; cin >> op;
if (op == '+') {
int x, y; rdint(x); rdint(y);
if (x > y)swap(x, y);
q.push(x); q2.push(y);
}
else {
int u, w; rdint(u); rdint(w);
bool fg = false;
if (q.top() <= u && q2.top() <= w)fg = true;
if (q.top() <= w && q2.top() <= u)fg = true;
if (fg) {
cout << "YES" << endl;
}
else cout << "NO" << endl;
}
}
return 0;
}
CF1101E Polycarp's New Job的更多相关文章
- cf723c Polycarp at the Radio
		
Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be re ...
 - codeforces 723C : Polycarp at the Radio
		
Description Polycarp is a music editor at the radio station. He received a playlist for tomorrow, th ...
 - Codeforces 723C. Polycarp at the Radio 模拟
		
C. Polycarp at the Radio time limit per test: 2 seconds memory limit per test: 256 megabytes input: ...
 - Codeforces Round #375 (Div. 2) C. Polycarp at the Radio 贪心
		
C. Polycarp at the Radio time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
 - Codeforces Round #346 (Div. 2) F. Polycarp and Hay 并查集
		
题目链接: 题目 F. Polycarp and Hay time limit per test: 4 seconds memory limit per test: 512 megabytes inp ...
 - Polycarp's problems
		
Polycarp's problems time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
 - Codeforce B. Polycarp and Letters
		
B. Polycarp and Letters time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
 - [Codeforces 864B]Polycarp and Letters
		
Description Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s con ...
 - 贪心 C - Polycarp's New Job
		
Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even sto ...
 
随机推荐
- jdbcTemplate学习(一)
			
概述 Spring JDBC抽象框架core包提供了JDBC模板类,其中JdbcTemplate是core包的核心类,所以其他模板类都是基于它封装完成的,JDBC模板类是第一种工作模式. JdbcTe ...
 - Shell编程进阶   1.2 shell结构及执行
			
创建一个shell脚本 mkdir shell vim first.sh #!/bin/bash ##The first test shell script. ##Written by wangsha ...
 - 用JS,求斐波那契数列第n项的值
			
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
 - [P3812][模板]线性基
			
解题关键:求异或最大值.线性基模板题. 极大线性无关组的概念. 异或的值域相同. #include<cstdio> #include<cstring> #include< ...
 - 解决ftp无法连接登录linux的办法
			
1. 首先安装vsftpd 命令:yum -y install vsftpd 之后开启服务:service vsftpd start 2.关闭防火墙 1) 重启后生效 开启: chkconfig ip ...
 - ARC059F
			
传送门 分析 见ptx大爷博客 代码 #include<iostream> #include<cstdio> #include<cstring> #include& ...
 - Luogu 2939 [USACO09FEB]改造路Revamping Trails   &&   Luogu 4568 [JLOI2011]飞行路线
			
双倍经验 写这两题之前被大佬剧透了呜呜呜. 分层图+最短路. 因为有$k$次机会能够把路径的费用变为$0$,我们可以建$k + 1$层图,对于每一层图我们把原来的边权和双向边连到上面去,而对于层与层之 ...
 - Luogu 3627 [APIO2009]抢掠计划
			
不爽. 为什么tarjan能爆栈啊 十分显然的缩点,给缩点之后的点连上权值为后一个点集权值的有向边,然后spfa跑最长路. 注意一开始$dis_{st}$应该等于$st$这个集合的权值. 时间复杂度$ ...
 - POJ 2836 Rectangular Covering (状压DP)
			
题意:平面上有 n (2 ≤ n ≤ 15) 个点,现用平行于坐标轴的矩形去覆盖所有点,每个矩形至少盖两个点,矩形面积不可为0,求这些矩形的最小面积. 析:先预处理所有的矩形,然后dp[s] 表示 状 ...
 - TestNG入门
			
在Eclipse中安装TestNG 打开Eclipse Help ->Install New Software , 然后Add "http://beust.com/ecli ...