版本比较
CSP-J 2026 SC 迷惑行为大赏!🤓👆
正文
增加 213 行删除 3 行
4 行未改动56789910111213947 行未改动全部展开96196296396496596696596696796896997018 行未改动989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152468 行未改动全部展开16211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682570 行未改动全部展开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 我喜欢你喵!`😨
468 行未改动全部展开#endif /* _STL_ITERATOR_BASE_TYPES_H */```:::
## 这是什么做法
大哥你枚举所有情况枚举成 ABCDE 了/xk
:::info[代码]```cppSC-J01111\travel\travel.cpp
#include <bits/stdc++.h> #define ll long long #define rep(i, j, k) for (int i = j; i <= k; i++) #define dow(i, j, k) for (int i = j; i >= k; i--)
std::string s1, s2, c1, c2;
std::map < std::pair < std::string, std::string >, bool > ans[5];
signed main() {// freopen("travel6.in", "r", stdin); freopen("travel.in", "r", stdin); freopen("travel.out", "w", stdout); ans[1][{"00", "00"}] = 1; ans[1][{"01", "01"}] = 1; ans[1][{"02", "02"}] = 1; ans[1][{"03", "03"}] = 1; ans[1][{"04", "04"}] = 1; ans[1][{"05", "05"}] = 1; ans[1][{"06", "06"}] = 1; ans[1][{"07", "07"}] = 1; ans[1][{"08", "08"}] = 1; ans[1][{"09", "09"}] = 1; ans[1][{"10", "10"}] = 1; ans[1][{"11", "11"}] = 1; ans[1][{"12", "12"}] = 1; ans[1][{"13", "13"}] = 1; ans[1][{"14", "14"}] = 1; ans[1][{"15", "15"}] = 1; ans[1][{"16", "16"}] = 1; ans[1][{"17", "17"}] = 1; ans[1][{"18", "18"}] = 1; ans[1][{"19", "19"}] = 1; ans[2][{"00A", "00A"}] = 1; ans[2][{"00A", "00B"}] = 1; ans[2][{"00A", "00C"}] = 1; ans[2][{"00A", "00D"}] = 1; ans[2][{"00A", "00E"}] = 1; ans[2][{"00B", "00A"}] = 1; ans[2][{"00B", "00B"}] = 1; ans[2][{"00B", "00C"}] = 1; ans[2][{"00B", "00D"}] = 1; ...```:::
## 那你也进来吧
:::info[代码]```cpp570 行未改动全部展开