优先队列只能85吗?

P2827 [NOIP2016 提高组] 蚯蚓

85蛮高了啊
by Night_Aurora @ 2017-10-25 11:04:37


+1 我只有65、、、
by attack @ 2017-10-25 11:41:41


我的55.。。。。。。
by 叫我彪哥 @ 2017-10-25 13:08:06


哇~~蒟蒻表示手写堆都只有80
by Flyhigh @ 2017-10-26 20:23:02


```cpp @[bzy2000](/space/show?uid=35297) #include<bits/stdc++.h> #pragma GCC optimize(2) using namespace std; int n,m,q,u,v,t; priority_queue < int > heap; inline void read(int &x) { x=0; char ch=getchar(); while(ch<'0'||ch>'9')ch=getchar(); while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar(); } inline void write(int x) { if(x) { write(x/10); putchar(x%10+48); } } int main() { read(n),read(m),read(q),read(u),read(v),read(t); for(int i=1;i<=n;++i) { int x; read(x); heap.push(x); } for(int i=1;i<=m;++i) { int cut=heap.top(); heap.pop(); if(i%t==0)write(cut+(i-1)*q),putchar(' '); int x=cut*u/v; heap.push(x-q); heap.push(cut-x-q); } puts(""); for(int i=1;i<=n+m;++i) { if(i%t==0)write(heap.top()+q*(m-1)),putchar(' '); heap.pop(); } return 0; } 求带我捞八十分 ```
by qianfujia @ 2017-12-29 22:10:15


```cpp @[bzy2000](/space/show?uid=35297) #include<bits/stdc++.h> #pragma GCC optimize(2) using namespace std; int n,m,q,u,v,t; priority_queue < int > heap; inline void read(int &x) { x=0; char ch=getchar(); while(ch<'0'||ch>'9')ch=getchar(); while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar(); } inline void write(int x) { if(x) { write(x/10); putchar(x%10+48); } } int main() { read(n),read(m),read(q),read(u),read(v),read(t); for(int i=1;i<=n;++i) { int x; read(x); heap.push(x); } for(int i=1;i<=m;++i) { int cut=heap.top(); heap.pop(); if(i%t==0)write(cut+(i-1)*q),putchar(' '); int x=cut*u/v; heap.push(x-q); heap.push(cut-x-q); } puts(""); for(int i=1;i<=n+m;++i) { if(i%t==0)write(heap.top()+q*(m-1)),putchar(' '); heap.pop(); } return 0; } 求带我捞八十分 ```
by qianfujia @ 2017-12-29 22:11:04


```cpp @[bzy2000](/space/show?uid=35297) #include<bits/stdc++.h> #pragma GCC optimize(2) using namespace std; int n,m,q,u,v,t; priority_queue < int > heap; inline void read(int &x) { x=0; char ch=getchar(); while(ch<'0'||ch>'9')ch=getchar(); while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar(); } inline void write(int x) { if(x) { write(x/10); putchar(x%10+48); } } int main() { read(n),read(m),read(q),read(u),read(v),read(t); for(int i=1;i<=n;++i) { int x; read(x); heap.push(x); } for(int i=1;i<=m;++i) { int cut=heap.top(); heap.pop(); if(i%t==0)write(cut+(i-1)*q),putchar(' '); int x=cut*u/v; heap.push(x-q); heap.push(cut-x-q); } puts(""); for(int i=1;i<=n+m;++i) { if(i%t==0)write(heap.top()+q*(m-1)),putchar(' '); heap.pop(); } return 0; } 求带我捞八十分 ```
by qianfujia @ 2017-12-29 22:12:30


手写的也85qwq,写双队列去喽
by 浮云启心 @ 2018-05-23 21:22:14


priority_queue各种卡常,还是85
by communist @ 2018-07-09 09:21:50


ps:开O2慢1000ms 2333
by communist @ 2018-07-09 09:22:49


|