话说我觉得这题应该降红
by 天有不测风云 @ 2021-08-15 20:45:24
建议橙
by SMT0x400 @ 2021-08-15 20:46:30
@[天有不测风云](/user/109217) 红你妈
by ByGones @ 2021-08-15 20:47:58
楼上。。
by Coros_Trusds @ 2021-08-15 20:48:47
红nm
by Sya_Resory @ 2021-08-15 20:49:22
。。
by Coros_Trusds @ 2021-08-15 20:49:43
我认为单是需要优化暴力这一部分就能让这题不是红
by _caiji_ @ 2021-08-15 20:50:51
@[卞宇轩](/user/209848) 。?
by 天有不测风云 @ 2021-08-15 20:51:00
@[caijianhong](/user/390033)
```cpp
signed main() {
int n, w, ans = 0;
n = read<int>(), w = read<int>();
if (w == 0) {
write(0);
return 0;
}
for (int i = 1; i <= n; i++) {
int x, b;
x = read<int>(), b = read<int>();
a[x] += b;
}
for (int i = 1; i <= w; i++) {
ans += a[i];
}
for (int i = w + 1; i <= n; i++) {
ans -= a[i - w];
ans += a[i];
if (ans > maxx) maxx = ans;
}
write(maxx);
return 0;
}
```
这不直接A了?
by 天有不测风云 @ 2021-08-15 20:51:42
@[天有不测风云](/user/109217) 小菜鸡认为这道题是黑题/wq/wq/wq
小菜鸡不会这道题/wq
by SIXIANG32 @ 2021-08-15 20:55:46