# 【贪心+线段树】Codeforces 557C Arthur and Table
[题面在这里](http://codeforces.com/problemset/problem/557/C)
其实很简单……
暴枚最长桌脚的长度$l$,然后长度比$l$长的桌脚全部都要砍掉
长度比$l$短的桌脚选择代价前$k$小的砍掉
用线段树维护……
示例程序 :
```C++
#include
#include
#include
using namespace std;
typedef long long ll;
inline char nc(){
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int red(){
int res=0,f=1;char ch=nc();
while (ch<'0'||'9'