The Place I Paste Code

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>

using namespace std;

const int MaxN = 50000 + 5;

int n, m, a, b, c, d, Ans, MaxNum;
int Root[MaxN];

void Add(int x, int s, int t, int l, int r, int Num) {
	if (l <= s && r >= t) {
		Insert(x, 1, MaxNum, Num);
		return;
	}
	int m = (s + t) >> 1;
	if (l <= m) Add(x << 1, s, m, l, r, Num);
	if (r >= m + 1) Add(x << 1 | 1, m + 1, t, l, r, Num);
	Update(x);
}

int main()
{
	scanf("%d%d", &n, &m);
	MaxNum = n * 2 + 1;
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d%d%d", &a, &b, &c, &d);
		if (a == 1) {
			d = - d + n + 1;
			Add(1, 1, n, b, c, d);
		}
		else {
			Ans = GetKth(b, c, d);
			printf("%d\n", -Ans + n + 1);
		}
	}
	return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>

using namespace std;

const int MaxN = 50000 + 5;

int n, m, a, b, c, d, Ans, MaxNum;
int Root[MaxN];

void Add(int x, int s, int t, int l, int r, int Num) {
	if (l <= s && r >= t) {
		Insert(x, 1, MaxNum, Num);
		return;
	}
	int m = (s + t) >> 1;
	if (l <= m) Add(x << 1, s, m, l, r, Num);
	if (r >= m + 1) Add(x << 1 | 1, m + 1, t, l, r, Num);
	Update(x);
}

int main()
{
	scanf("%d%d", &n, &m);
	MaxNum = n * 2 + 1;
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d%d%d", &a, &b, &c, &d);
		if (a == 1) {
			d = - d + n + 1;
			Add(1, 1, n, b, c, d);
		}
		else {
			Ans = GetKth(b, c, d);
			printf("%d\n", -Ans + n + 1);
		}
	}
	return 0;
}

  

时间: 2024-07-30 03:22:04

The Place I Paste Code的相关文章

Recommended add-ons/plugins for Microsoft Visual Studio [closed]

SmartPaster - (FREE) Copy/Paste code generator for strings AnkhSvn - (FREE) SVN Source Control Integration for VS.NET VisualSVN Server - (FREE) Source Control ReSharper - IDE enhancement that helps with refactoring and productivity CodeRush - Code ge

8 Ways to Become a Better Coder

It’s time to get serious about improving your programming skills. Let’s do it! That’s an easy career improvement goal to give oneself, but “become a kick-ass programmer” is not a simple goal. For one thing, saying, “I want to get better” assumes that

&lt;转&gt;学习iOS开发的建议:如何从菜鸟到专家

本文转自:http://www.cnblogs.com/YouXianMing/p/3631577.html 文章原地址:http://mobile.tutsplus.com/tutorials/iphone/ios-quick-tip-from-novice-to-expert/ iOS Quick Tip: From Novice to Expert Bart Jacobs on Jul 29th 2013 with 5 comments Even though it's possible

crtmpserver实现防盗流和流推送验证

转自:http://blog.chinaunix.net/uid-26000296-id-3833397.html Protecting your streams from webpage copy&paste flash code, listing or recording保护流,防止在页面上被复制&粘贴,解析或录制by Rani     目录表 Table of ContentsI.    简要说明和目的  Brief description and our goalsII.   设置

Customizing AX 2012 Released Product ListPage Filter using X++

In Microsoft Dynamics AX 2012, ListPages are more restricted from customization than in prior versions of AX.  Primary reason for the restriction is so that the list pages maintain compatibility with Enterprise Portal.  Recently a customer had a requ

python 和 scikit-learn 实现垃圾邮件过滤

文本挖掘(Text Mining,从文字中获取信息)是一个比较宽泛的概念,这一技术在如今每天都有海量文本数据生成的时代越来越受到关注.目前,在机器学习模型的帮助下,包括情绪分析,文件分类,话题分类,文本总结,机器翻译等在内的诸多文本挖掘应用都已经实现了自动化. 在这些应用中,垃圾邮件过滤算是初学者实践文件分类的一个很不错的开始,例如 Gmail 账户里的"垃圾邮箱"就是一个垃圾邮件过滤的现实应用.下面我们将基于一份公开的邮件数据集 Ling-spam,编写一个垃圾邮件的过滤器.Ling

网页性能优化指导--说得太好了,详细,具体,易理解,推荐看----Website Speed Optimization Guide for Google PageSpeed Rules

原链接地址:http://www.artzstudio.com/2016/07/website-speed-optimization-guide-for-google-pagespeed-rules/ Website Speed Optimization Guide for Google PageSpeed Rules By Dave Artz 1 week ago 6  534 0 Page Speed/Site speed is termed as the speed with which

Using SimpleMembership With ASP.NET WebPages

from:http://osbornm.com/2010/07/21/using-simplemembership-with-asp-net-webpages/ With the introduction of ASP.NET WebPages and the WebMatrix stack our team has really be focusing on making things simpler for the developer. Based on a lot of customer

如何居中jqGrid的弹出模式窗口

1. 看来,要做到这一点最简单的方法是改变beforeShowForm事件的内部对话的位置: var grid = $("#list"); grid.jqGrid('navGrid','#pager', {add:false,del:false,search:false,refresh:false}, { beforeShowForm: function(form) { // "editmodlist" var dlgDiv = $("#editmod&q