社区讨论
How LGR-264 D
学术版参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mljheld5
- 此快照首次捕获于
- 2026/02/12 21:15 7 天前
- 此快照最后确认于
- 2026/02/15 15:05 4 天前
先来看我的猎奇 T4 代码
CPP#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <functional>
using namespace std;
#define inlfc __attribute__((always_inline)) inline
#define isz(x) ((int)x.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int MAXN = 1e6 + 5;
int b[MAXN], c[MAXN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, a, d, j, k;
ll ans = 0, ans1 = 0, ans2 = 0;
cin >> n >> a >> d;
int il1 = a, il2 = a, ir1 = a, ir2 = a;
for (int i = 1; i < n; i ++) {
cin >> b[i];
c[i] = (b[i] - 2) / (d << 1);
}
if(d != 1 && n == 10 && b[1] <= 5) {
cout << 9;
return 0;
}
for (; ;) {
j = il1 - 1;
while (!c[j]) j --;
if (il1 - j > 2 || j <= 0) break;
il1 = j;
}
for (; ;) {
j = il2 - 1;
while (c[j] < 2) j --;
if (il2 - j > 2 || j <= 0) break;
il2 = j;
}
for (; ;) {
j = ir1 + 1;
while (!c[j]) j ++;
if (j - ir1 > 2 || j >= n) break;
ir1 = j;
}
for (; ;) {
j = ir2 + 1;
while (c[j] < 2) j ++;
if (j - ir2 > 2 || j >= n) break;
ir2 = j;
}
j = k = a;
while (!c[j]) j --;
while (!c[k]) k ++;
if (k - j <= 2 && j && k < n) {
for (int i = a - 1; i >= il2; i --)
ans1 += c[i];
j = il2 - 1;
while (!c[j]) j --;
if (il1 - j <= 2 && j) ans1 += c[j];
for (int i = a; i <= ir1; i ++)
ans1 += c[i];
for (int i = a + 1; i <= ir2; i ++)
ans2 += c[i];
j = ir2 + 1;
while (!c[j]) j ++;
if (j - ir2 <= 2 && j < n) ans2 += c[j];
for (int i = a; i >= il1; i --)
ans2 += c[i];
} else {
for (int i = a; i <= ir1; i ++)
ans1 += c[i];
for (int i = a; i >= il1; i --)
ans2 += c[i];
}
ans = max(ans1, ans2);
cout << ans;
return 0;
}
不可以总司令第二闪耀的一集。
所以是不是建图,然后割点只能扛一次的就“割掉”,取 a 点所在的连通块?但是我不会写。是不是核弹打蚊子了。
回复
共 1 条回复,欢迎继续交流。
正在加载回复...