@[麒然](/user/105266) maxn改成5005试试
by feecle6418 @ 2019-11-08 08:27:25
@[Fee_cle6418](/user/42156)
还是不行(哭)
by kakao @ 2019-11-08 08:35:30
???我没优化都能过啊
```cpp
#include <bits/stdc++.h>
using namespace std;
struct node{
int cost, num;
};
vector<node> fmr;
bool cmp(const node &a, const node &b){
return a.cost < b.cost;
}
int n, m, ans = 0, cnt = 0;
int main(){
cin >> n >> m;
while(m--){
int c, v;
cin >> c >> v;
fmr.push_back((node){c, v});
}
sort(fmr.begin(), fmr.end(), cmp);
while(n > 0){
if(fmr[cnt].num){
n --;
fmr[cnt].num --;
ans += fmr[cnt].cost;
}
else cnt ++;
}
cout << ans;
return 0;
}
```
by mzWyt @ 2019-11-08 08:42:07
怕不是哪卡死了
by mzWyt @ 2019-11-08 08:43:03
@[mzWyt](/user/219628)
所以现在很懵,不知道怎么回事
by kakao @ 2019-11-08 08:43:08
```for(;!isdigit(c);c-getchar())```
不应该是等号吗?
by 0nullptr @ 2019-11-08 08:45:48
@[麒然](/user/105266)
快读炸了,[去掉快读ac](https://www.luogu.org/record/26533895)
by mzWyt @ 2019-11-08 08:49:17
@[一个python屑](/user/82672)
谢谢大佬
by kakao @ 2019-11-08 08:52:18
@[mzWyt](/user/219628)
A了谢谢大佬
by kakao @ 2019-11-08 08:52:33