正文
增加 4 行删除 4 行
19 行未改动20212223242526272819 行未改动48495051525354555628 行未改动8586878889909192938 行未改动10210310410510610710819 行未改动+ 得到 C 段的耗时:+ 这里有个小细节,就是若 $cnt_A + step_B$ 回合后,**恰好** 得到了 $cnt_B$ 个 $\tt 1$,那么下一回合 **依旧属于 B 段**,增加两个 $\tt 1$;否则下一回合属于 C 段(已经出现 $\tt 11$ 状物了),增加一个 $\tt 1$。+ 耗时为 $(n - cnt_B) - [cnt_B = cnt + cnt_A + 2step_B]$。+ 输出 $cnt_A + step_B + (n - cnt_B) - [cnt_B = cnt + cnt_A + 2step_B]$。## Hack这一部分特判 **尤为重要**。19 行未改动const int N = 10;int cnt = 0;#define MAXN 1000001int a[MAXN], b[MAXN], dp[MAXN];namespace Standard {int solve() {int cnt = 0, cntA = 0, ext = 0; a[0] = a[N + 1] = 0;28 行未改动int main() {while (cnt < 10000) {for (int i = 1; i <= N; ++i) b[i] = a[i] = rnd(0, 1);int u = Standard::solve();for (int i = 1; i <= N; ++i) a[i] = b[i];int v = MySolve::solve();8 行未改动}printf("AC #%d\n", ++cnt);}return 0;}```19 行未改动20212223242526272819 行未改动48495051525354555628 行未改动8586878889909192938 行未改动10210310410510610710819 行未改动+ 得到 C 段的耗时:+ 这里有个小细节,就是若 $cnt_A + step_B$ 回合后,**恰好** 得到了 $cnt_B$ 个 $\tt 1$,那么下一回合 **依旧属于 B 段**,增加两个 $\tt 1$;否则下一回合属于 C 段(已经出现 $\tt 11$ 状物了),增加一个 $\tt 1$。+ 耗时为 $(n - cnt_B) - [cnt_B = cnt + cnt_A + 2step_B]$。+ 输出 $cnt_A + step_B + (n - cnt_B) - [cnt_B = cnt + cnt_A + 2step_B]$。## Hack这一部分特判 **尤为重要**。19 行未改动const int N = 10;int cnt = 0;#define MAXN 1000001int a[MAXN], b[MAXN], dp[MAXN];namespace Standard {int solve() {int cnt = 0, cntA = 0, ext = 0; a[0] = a[N + 1] = 0;28 行未改动int main() {while (cnt < 10000) {for (int i = 1; i <= N; ++i) b[i] = a[i] = rnd(0, 1);int u = Standard::solve();for (int i = 1; i <= N; ++i) a[i] = b[i];int v = MySolve::solve();8 行未改动}printf("AC #%d\n", ++cnt);}return 0;}```