C. Report
题意:给出n个无序的数以及m个操作,每个操作由两个数组成,第一个数是操作的方式,第二个数 i 是操作的范围,若第一个数是1,则给 1-i 个数按升序排序,若第二个数是2,则给 1-i 个数按降序排列。输出所有操作完成后的序列。



int n, m;
arr a, ans;
int top = ;
int tot = ;
struct node
{
int r, tp, id;
} p[N], q[N];
bool cmp(node a, node b)
{
if (a.r == b.r)
return a.id > b.id;
return a.r > b.r;
} int main()
{
// file("test");
sdf(n), sdf(m);
For(i, , n) sdf(a[i]);
For(i, , m)
{
int x, y;
sdf(x), sdf(y);
p[i] = (node){y, x, i};
}
sort(p + , p + + m, cmp);
int st = ;
For(i, , m)
{
if (p[i].id < st)
continue;
st = p[i].id;
if (i >= && p[i].tp == q[tot].tp)
continue;
q[++tot] = p[i];
if (p[i].id == m)
break;
}
top = n+;
FFor(i, n, q[].r + )
ans[--top] = a[i];
sort(a + , a + + q[].r);
int L = , R = q[].r; For(i, , tot)
{
int dt = q[i].r - q[i + ].r;
if (q[i].tp == )
{
FFor(j, R, R-dt+)
ans[--top] = a[j];
R -= dt;
}
else
{
For(j, L, L + dt - )
ans[--top] = a[j];
L += dt;
}
}
For(i,,n)
printf("%d ", ans[i]); return ;
}
C. Report的更多相关文章
- 2.ASP.NET MVC 中使用Crystal Report水晶报表
上一篇,介绍了怎么导出Excel文件,这篇文章介绍在ASP.NET MVC中使用水晶报表. 项目源码下载:https://github.com/caofangsheng93/CrystalReport ...
- Monthly Income Report – August 2016
原文链接:https://marcoschwartz.com/monthly-income-report-august-2016/ Every month, I publish a report of ...
- Step by step Install a Local Report Server and Remote Report Server Database
原创地址:http://www.cnblogs.com/jfzhu/p/4012097.html 转载请注明出处 前面的文章<Step by step SQL Server 2012的安装 &g ...
- Session for SSRS Report of Microsoft Dynamics AX
Session for SSRS Report of Microsoft Dynamics AX 版权声明:本文为博主原创文章,未经博主允许不得转载. Contract •A data contrac ...
- Report processing of Microsoft Dynamic AX
Report processing of Microsoft Dynamic AX 版权声明:本文为博主原创文章,未经博主允许不得转载. The implementation of a general ...
- Utility3:Understand Dashboard Report
To see data in the SQL Server Utility dashboard, select the top node in the Utility Explorer tree - ...
- PowerDesigner导出Report通用报表
PowerDesigner导出Report通用报表 通用模板下载地址:http://pan.baidu.com/s/1c0NDphm
- SQL Server 2012 The report server cannot open a connection to the report server database
案例环境: 操作系统版本: Windows Server 2012 R2 Standard 数据库版本 : SQL SERVER 2012 SP2 案例介绍: 今天进入一台新安装的SQL ...
- SQL Server 2008 R2 升级到 Service Pack 3后Report Builder启动不了
一同事将测试服务器从SQL Server 2008 R2 SP2升级到了SQL Server 2008 R2 SP3后发现Report Service的报表编辑时启动不了Report Builder, ...
- SQL报表(Report Builder)里面的几个常见问题(持续更新)
一 SQL报表常常会遇到在表格中的相除,如果分母为零,一般会显示错误号,我们可以这么处理:(加上是A/B) ,, B) 但是我们不能这么写: ,,A/B) //我们不能这么写,会产生BUG,至于什么B ...
随机推荐
- Python全栈学习_day003知识点
今日大纲: . 基础数据类型 总览 . int . bool . str . for循环 1. 基础数据类型 总览 int: 用于计算,计数等 str:'这些内容',用户少量数据的存储,便于操作 bo ...
- win10系统彻底卸载Mysql
本文介绍,在Windows10系统下,如何彻底删除卸载MySQL... 1>停止MySQL服务 开始->所有应用->Windows管理工具->服务,将MySQL服务停止. 2& ...
- 网络基础 cookie详解
cookie详解 by:授客 QQ:1033553122 cookie干嘛用的? 参见文章http 会话(session)详解: 网络基础 http 会话(session)详解 cookie分类 ...
- UML类图关系图解
一.类结构 在类的UML图中,使用长方形描述一个类的主要构成,长方形垂直地分为三层,以此放置类的名称.属性和方法. 其中, 一般类的类名用正常字体粗体表示,如上图:抽象类名用斜体字粗体,如User:接 ...
- 学习使用TestNG进行数据驱动测试
转自: https://mp.weixin.qq.com/s/8Bd8LEhiC2pu2VMcyNMGlQ 学习使用TestNG进行数据驱动测试 赵吃饭 51Testing软件测试网 前天 学习使 ...
- mongodb 配置文件
本文档是在mongodb为3.4下编写的,仅作为参考,详细内容请参考:https://docs.mongodb.com/manual/reference/configuration-options/# ...
- WebSocket简单尝试
System.Net.WebSockets.WebSocket 需要.NET 4.5,IIS8以上,Windows Server2008R2自带的IIS不支持,Windows8及Server2012以 ...
- datatable 列名重新排序
1. DataTable.Columns["MONEY"].SetOrdinal[4]; 2.dt = dt.DefaultView.ToTable(false, listarr. ...
- xunit-ICollectionFixture
https://github.com/dmetzgar/dotnetcoreinaction
- 网络编程——socket开发
Socket套接字方法 socket 实例类(8-10分钟) socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None) ...