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 ...
随机推荐
- TCP握手过程中建连接的流程和队列
这里有两个队列:syns queue(半连接队列):accept queue(全连接队列). 三次握手过程中: 第一步: server 收到 client 的 syn 后,把这个连接信息放到半连接队列 ...
- python之管道, 事件, 信号量, 进程池
管道:双向通信 2个进程之间相互通信 from multiprocessing import Process, Pipe def f1(conn): from_zjc_msg = conn.recv( ...
- Tars --- Hello World
服务端开发 1,创建一个 webapp maven 项目,pom.xml 导入依赖 <dependency> <groupId>com.tencent.tars</gro ...
- Linux 学习笔记之超详细基础linux命令 Part 11
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 10---------------- ...
- multipart/form-data文件上传
form表单的enctype属性:规定了form表单数据在发送到服务器时候的编码方式 application/x-www-form-urlencoded:默认编码方式 multipart/form-d ...
- JMeter—断言(十一)
参考<全栈性能测试修炼宝典JMeter实战>第六章 JMeter 元件详解中第六节断言断言用来对服务器的响应数据做验证,常用的断言是响应断言,支持正则表达式. 一.BeanShell As ...
- selenium获取cookie
参考地址:https://www.cnblogs.com/lingwang3/p/7750156.html # 获取cookie import time from selenium import we ...
- 基于 node 搭建博客系统(一)
系统分为两端,分别实现. 管理员端: 功能 :个人信息,设置,发布随笔,随笔列表,删除随笔,查找,文章 等. 技术点:Boostrap + AdminLTE; 基于nodejs 实现的express ...
- My strength (C-A-R)
My strength: I am good at problem resolving Challenge In the first year when I come to America I pas ...
- NFS服务搭建与配置
启动NFS SERVER之前,首先要启动RPC服务(CentOS5.8下为portmap服务,CentOS6.6下为rpcbind服务,下同),否则NFS SERVER就无法向RPC服务注册了.另外, ...