版本比较
CSP-J 2026 SC 迷惑行为大赏!🤓👆
正文
增加 159 行删除 3 行
4 行未改动56789910111213947 行未改动全部展开96196296396496596696596696796896997018 行未改动9899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521,100 行未改动全部展开4 行未改动不会写前言。不过看到我们大 SC 江山辈有神人出,老身就放心了😋
话不多说直接开赤吧😋😋😋
欢迎在 11.14 之前向我私信投稿统计遗漏的迷惑行为,我会在 11.14 再更新一次的!欢迎在 11.21 之前向我私信投稿统计遗漏的迷惑行为,我会在 11.21 再更新一次的!
也可以联系我撤下,不过要证明这是你才行。
可以点个赞吗/kel/kel/kel,谢谢喵!!!947 行未改动全部展开
SC-J01655 的所有题目均使用了
```frein(travel.in,stdin);freout(travel.out,stdout);frein(xxx.in,stdin);freout(xxx.out,stdout);```当文件读写。
## 我要上电视18 行未改动:::
虽然因为没有那么多的时间和精力,很可惜我只统计了 J 组,不过这说明你能同时进两篇迷惑行为大赏了🤓
## \_\_attribute\_\_((always_inline))
>: >我是 SC-J01677,我想上电视 >能满足我吗喵
终于看到有人在正赛写这个(指 `__attribute__((always_inline)) inline`)了,感动。
:::info[代码]```cppSC-J01677\string\string.cpp
/*Author: kkksc98关注 kkksc98 谢谢喵*/#include <bits/stdc++.h>#define int long long#define inl_force __attribute__((always_inline)) inline#define rep(i, a, b) for (int i = (a); i <= (b); ++i)#define per(i, a, b) for (int i = (a); i >= (b); --i)using namespace std;template<typename Tp> inl_force Tp input() { int x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == EOF) return 0; if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 3) + (x << 1) + (ch - '0'); ch = getchar(); } return x * f;}template<typename Tp> inline void output(Tp x) { if (x < 0) x = -x, putchar('-'); if (x > 9) output(x / 10); putchar(x % 10 + '0');}const int N = 2e5 + 5;int n, ans, sum, id_L, id_R, a[N];char c[N];struct Segment { int cnt; char c;} L[N], R[N];inl_force void solve() { int now_sum = 0; int LIM = (sum >> 1); rep(i, 1, n) { if (now_sum + a[i] >= LIM) { L[++id_L].cnt = LIM - now_sum; L[id_L].c = c[i]; a[i] -= (LIM - now_sum); now_sum = LIM; break; } else { L[++id_L].cnt = a[i]; L[id_L].c = c[i]; now_sum += a[i]; a[i] = 0; } } per(i, n, 1) { if (a[i] == 0) break; R[++id_R].cnt = a[i]; R[id_R].c = c[i]; a[i] = 0; } for (int i = 1, j = 1; i <= id_L && j <= id_R; ++i) { while (L[i].cnt > 0) { if (L[i].cnt >= R[j].cnt) { if (L[i].c != R[j].c) ans += R[j].cnt; L[i].cnt -= R[j++].cnt; } else { if (L[i].c != R[j].c) ans += L[i].cnt; R[j].cnt -= L[i].cnt; L[i].cnt = 0; } } } return ;}inl_force void solve_now() { int now_sum = 0; int LIM = (sum >> 1); rep(i, 1, n) { if (now_sum + a[i] > LIM) { L[++id_L].cnt = LIM - now_sum; L[id_L].c = c[i]; a[i] -= ((LIM - now_sum) + 1); now_sum = LIM; break; } else if (now_sum + a[i] == LIM) { L[++id_L].cnt = LIM - now_sum; L[id_L].c = c[i]; a[i] -= (LIM - now_sum); --a[i + 1]; break; } else { L[++id_L].cnt = a[i]; L[id_L].c = c[i]; now_sum += a[i]; a[i] = 0; } } per(i, n, 1) { if (a[i] == 0) break; R[++id_R].cnt = a[i]; R[id_R].c = c[i]; a[i] = 0; } for (int i = 1, j = 1; i <= id_L && j <= id_R; ++i) { while (L[i].cnt > 0 && j <= id_R) { if (L[i].cnt >= R[j].cnt) { if (L[i].c != R[j].c) ans += R[j].cnt; L[i].cnt -= R[j++].cnt; } else { if (L[i].c != R[j].c) ans += L[i].cnt; R[j].cnt -= L[i].cnt; L[i].cnt = 0; } } } return ;}signed main() { freopen("string.in", "r", stdin); freopen("string.out", "w", stdout); n = input<int>(); rep(i, 1, n) { a[i] = input<int>(); c[i] = getchar(); sum += a[i]; } if (sum % 2 == 0) solve(); else solve_now(); output(ans); return 0;}/*09:12 写完准备测样例09:16 样例 WA 了09:24 重新写完09:27 样例 3 WA 了09:28 重测样例09:30 样例通过*/```:::
虽然但是为啥写了这么长。
## 公开处刑(?)
SC-J01797 在 T4 贴了 $\color{red}671$ 句 `@double_bird 我喜欢你喵!`😨
1,100 行未改动全部展开