Educational Codeforces Round 27 D. Driving Test
单调栈
题意看了半天。。。
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long const int maxn=2e5+;
const int inf=1e9; int sum1,tot1;
int f[maxn],g; int main()
{
int n,a,b,i,j,v;
scanf("%d",&n);
for (i=;i<=n;i++)
{
scanf("%d",&a);
if (a== || a==)
scanf("%d",&b); if (a==)
tot1=;
else if (a==)
tot1++;
else if (a==)
sum1+=tot1,tot1=; if (a==)
g=;
else if (a==)
{
v=b;
while (g> && f[g]<v)
g--,sum1++;
}
else if (a==)
{
if (b<v)
sum1++;
else
f[++g]=b;
}
}
printf("%d",sum1);
return ;
}
Educational Codeforces Round 27 D. Driving Test的更多相关文章
- Educational Codeforces Round 27 补题
题目链接:http://codeforces.com/contest/845 A. Chess Tourney 水题,排序之后判断第n个元素和n+1个元素是不是想等就可以了. #include < ...
- Educational Codeforces Round 27 A B C
A. Chess Tourney Berland annual chess tournament is coming! Organizers have gathered 2·n chess pla ...
- Educational Codeforces Round 27
期末后恢复性训练,结果完美爆炸... A,题意:2n个人,分成两队,要求无论怎么分配,第一队打赢第二队 #include<bits/stdc++.h> #define fi first # ...
- Educational Codeforces Round 27 F. Guards In The Storehouse
F. Guards In The Storehouse time limit per test 1.5 seconds memory limit per test 512 megabytes inpu ...
- Educational Codeforces Round 117 (Rated for Div. 2)
Educational Codeforces Round 117 (Rated for Div. 2) A. Distance https://codeforces.com/contest/1612/ ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [Educational Codeforces Round 16]B. Optimal Point on a Line
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...
随机推荐
- 7年Java后端被淘汰,一路北漂辛酸史。。。
作者:春天花会开foryou oschina.net/question/3465562_2281392 今天分享一位同行的经历: 本人Java开发6年半不到7年的样子. 英语专业,临毕业跟着隔壁专业去 ...
- [已解决]报错:ValueError: Expected 2D array, got scalar array instead
报错代码: new_x = 84610 pre_y = model.predict(new_x) print(pre_y) 报错结果: ValueError: Expected 2D array, g ...
- 6.1_springboot2.x分布式-整合SpringCloud
1.SpringCloud简介 Spring Cloud是一个分布式的整体解决方案.Spring Cloud 为开发者提供了在分布式系统(配置管理,服务发现,熔断,路由,微代理,控制总线,一次性t ...
- web前端Vue+Django rest framework 框架 生鲜电商项目实战✍✍✍
web前端Vue+Django rest framework 框架 生鲜电商项目实战 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频 ...
- python列表中enumerate和zip函数用法
enumerate: 定义:enumerate() 函数用于将一个可遍历的数据对象(如列表.元组或字符串)组合为一个索引序列,同时列出数据和数据下标 例子: list1 =[89,98,00,75,6 ...
- 【洛谷】P1288 取数游戏II
题目链接:https://www.luogu.org/problemnew/show/P1288 题意:中文题面不赘述啦. 题解:代码很好写,其实就是判断边数是否为偶数.先手确定方向其实都是一样的,但 ...
- tomcat启动内存修改
# USE_NOHUP (Optional) If set to the string true the start command will # ...
- 【Http】keepalive
http是现在web领域极其普遍的应用层传输协议, 目前常见的使用版本则是http1.1, 当然最先版本是http2.0. 传统的Http应用里都是一次TCP连接一次request. image ...
- NX-二次开发创建圆弧(三点圆弧)UF_CURVE_create_arc_3point
NX9+VS2012 #include <uf.h> #include <uf_curve.h> UF_initialize(); //起点 ]; ArcStartPoint[ ...
- Linux命令(1):date
查看时间: date "+%Y-%m-%d %H:%M:%S" 参数说明: %n : 下一行 %t : 跳格 %H : 小时(00..23) %I : 小时(01..12) %k ...