版本比较
LGJ OI 6.3
正文
增加 5 行删除 5 行
5 行未改动67891010111213148 行未改动23242526272728293031323334343536373824 行未改动63646566676768696970717273185 行未改动全部展开5 行未改动
```cpp#include<bits/stdc++.h>#define int long long#define MN 100010 #define MN 100010
using namespace std;
const int inf=1ll<<60;8 行未改动 if(f[x-d[a[i]]]==inf) continue; if(f[x-d[a[i]]]+1>f[x]||f[x]==-1) f[x]=f[x-d[a[i]]]+1, g[x]=a[i]; else if(f[x-d[a[i]]]+1==f[x]&&a[i]>g[x]) g[x]=a[i]; g[x]=a[i]; } if(f[x]==-1) f[x]=inf;}
void print(int x) { if(x<=0) return; cout << g[x]; cout << g[x]; print(x-d[g[x]]);}
signed main() {24 行未改动
那不是拓欧板子?注意到会爆 longlong /fad
$a,b$ 很小但是其它很大,然后因为尽量小的约束 $y$ 也是范围很小。
所以我们枚举 $y$ 去算就行了(((
```cpp#include<bits/stdc++.h>#define int long long
185 行未改动全部展开