[Codeforces Round #165 (Div. 2)]D. Greenhouse Effect
生活随笔
收集整理的這篇文章主要介紹了
[Codeforces Round #165 (Div. 2)]D. Greenhouse Effect
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
地址:http://codeforces.com/contest/270/problem/D
這題看過別人代碼,理解了好久
本來覺得這題和USACO里的三值的排序是一樣的,但是USACO里通不過......看來還得想
1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 int n,m,s[5001],p[5001]; 6 double x; 7 8 int main() 9 { 10 ios::sync_with_stdio(false); 11 int j; 12 cin>>n>>m; 13 for(int i=0;i<n;i++) cin>>s[i]>>x; 14 m=0; 15 for(int i=0;i<n;i++) 16 { 17 j=(int)(upper_bound(p,p+m,s[i])-p); 18 if(j==m) p[m++]=s[i]; 19 else p[j]=s[i]; 20 } 21 cout<<n-m<<endl; 22 return 0; 23 }?
轉(zhuǎn)載于:https://www.cnblogs.com/tjsuhst/archive/2013/02/10/2892375.html
總結(jié)
以上是生活随笔為你收集整理的[Codeforces Round #165 (Div. 2)]D. Greenhouse Effect的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 刹车或会失灵!法拉利上演史诗级大召回 超
- 下一篇: 死磕Intel最赚钱业务:AMD霄龙在服