强大的STL!强大的vector!

P1090 [NOIP2004 提高组] 合并果子 / [USACO06NOV] Fence Repair G

…… 这个不用vector也很简便啊
by 小粉兔 @ 2017-12-06 19:52:18


这个用优先队列做才是正解吧………… 用vector太慢了
by 小粉兔 @ 2017-12-06 19:54:29


vector好慢的啊
by Rorshach @ 2017-12-06 20:29:03


那不如用优先队列咯·····
by Dog_Two @ 2017-12-06 20:48:57


不至于用vector
by JSZX @ 2017-12-06 21:15:33


```cpp //本弱鸡认为以下代码会好一些 #include<iostream> #include<queue> using namespace std; #define INf 0x7f7f7f7f const int maxn = 1e5; #define LL unsigned long long int n,x; priority_queue<int,vector<int>,greater<int> >que; inline void test() { cin>>n; for(int i=0;i<n;i++) cin>>x,que.push(x); //====================== //sort&&delete while(que.size() )//!que.empty() cout<<que.top()<<' ' ,que.pop() ; } int main() { ios::sync_with_stdio(false); //freopen("testdata.in","r",stdin); //freopen("testdata.out","w",stdout); test(); return 0; } ```
by Michael123456 @ 2017-12-06 21:25:29


强烈支持vector!!!强烈支持STL!!!力顶作者!!!——————by 永远的C++党
by LightningUZ @ 2018-07-05 20:49:18


|