版本比较
题解:P17877 糖葫芦 / tanghulu
正文
增加 2 行删除 4 行
28 行未改动2930313233343334353656 行未改动939495969997989910010120 行未改动12212312412512812612712812913041 行未改动28 行未改动如果当前没有可用的锅,合并最大的两个锅。
做完了。细节有点多,看代码吧。
以及,虽然没卡,小心爆 `long long`,大数乘法运算记得开 `__int128`。
# Code
```cpp#include <bits/stdc++.h>56 行未改动 ans++;// cerr << "MG\n"; continue; } if((__int128)gv * mcnt <= c) { if(gv * mcnt <= c) { c -= gv * mcnt;// cerr << mcnt << "YES\n"; if(cnt - mcnt > 0) { mp[vl] += cnt - mcnt;20 行未改动 }// cerr << (*p).first << " has " << (*p).second << "\n"; int cl = (*p).first - l + 1; int cs = (*p).second; __int128 ac = cl * cs; int ac = cl * cs;// cout << l << " find " << (*p).first << " have " << cs << "\n"; if(ac <= c) { c -= ac; mp[l - 1] += cs;41 行未改动