bzoj5045: 打砖块 (粗制滥造)
来源:互联网 发布:淘宝双11怎么修改价格 编辑:程序博客网 时间:2024/05/19 09:17
辣鸡题解
题意
就是打砖块
问你最多可以打多少砖块
题解
暴力维护一下有什么砖块被打了就好了
CODE:
#include<cstdio>#include<cstring>#include<iostream>#include<queue>#include<algorithm>using namespace std;typedef long long LL;const LL N=100005;LL n;inline LL read(){ LL x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f;}struct qq{ LL x,y1,y2; bool operator < (qq a) const { if (a.x!=x) return a.x<x; if (a.y1!=y1) return a.y1<y1; return a.y2>y2; }}a[N];priority_queue<qq> q;int main(){ n=read(); for (LL u=1;u<=n;u++) a[u].x=read(),a[u].y1=a[u].y2=read(),q.push(a[u]); LL ans=0; while (!q.empty()) { qq a=q.top();q.pop(); while (!q.empty()) { qq b=q.top(); if (a.y2+2>=b.y1&&a.x==b.x) { a.y2=max(a.y2,b.y2); q.pop(); } else break; } ans=ans+((a.y2-a.y1)/2+1); if (a.y1!=a.y2) { qq b=a; b.x++;b.y1++;b.y2--; q.push(b); } } printf("%lld\n",ans); return 0;}
阅读全文
0 0
- bzoj5045: 打砖块 (粗制滥造)
- 打砖块
- 打砖块
- 打砖块
- Android游戏:弹弹球(打砖块)
- Unity 官方案例 打砖块(二)
- Unity 弹球打砖块游戏(简易)
- 打砖块游戏源码
- HNOI2004 打砖块
- Qt打砖块游戏
- android 打砖块游戏
- Linux C 打砖块
- 【HNOI2004】打砖块
- wiki 1257 打砖块
- unity3D__球打砖块
- 【codevs1257】打砖块 DP
- 【codevs1257】 打砖块
- 洛谷 P1174 打砖块
- Markdown编辑器快捷键使用
- 三向单词查找树(c++版)
- 分布式跟踪系统(二):Zipkin的Span模型
- 《HBase权威指南》读书笔记 第八章:架构,WAL预写日志
- webstrom下运行gulp初试
- bzoj5045: 打砖块 (粗制滥造)
- jQuery操作表格(table)的常用方法、技巧汇总
- Java 中的方法内部类
- Python篇(一):ubuntu14.04下Python的环境配置
- 基于MFC的五子棋应用(四)实践
- dpdk vhost研究 (三)
- Palindrome Partitioning
- ConcurrentHashMap
- 《图解HTTP》读书笔记(1)之第一章了解Web及网络基础(关键词:计算机网络/HTTP/Web/网络基础)