版本比较
NOIP2021-游记
正文
增加 11 行删除 11 行
117 行未改动全部展开11811912012112212212312412512692 行未改动21922022122222322322422522622749 行未改动27727827928028128128228328428568 行未改动35435535635735835835936036136226 行未改动38939039139239339339439539639794 行未改动49249349449549649649749849950069 行未改动57057157257357457457557657657757857857958058058158258358358458558658767 行未改动117 行未改动全部展开#include<set>#include<map>#include<unordered_map>#include<queue>#include<bitset> #include<bitset>using namespace std;inline unsigned RD() { unsigned TmpRD(0); char RChr(getchar());92 行未改动#include<set>#include<map>#include<unordered_map>#include<queue>#include<bitset> #include<bitset>using namespace std;inline unsigned RD() { unsigned TmpRD(0); char RChr(getchar());49 行未改动 } } } } } } } for (unsigned i(0); i <= t; ++i) { for (unsigned j(0); j <= n; ++j) { if(Pop[j] + i <= t) {68 行未改动&= n \sum_{i = 1}^{n}b_i(s_i + s_{i + 1}) - s_1^2\\\end{aligned}$$
这样就可以 $O(n)$ 求方差了. 这样就可以 $O(n)$ 求方差了.
不过在 $Day8$ 也就是 `2021.11.27`, 我猛然发现完全可以用差分数组直接把 $a$ 求前缀和积出来, 然后直接根据定义求 $Dn^2$, 所以我考场上这 $1.5H$ 是浪费了的, 而如果节省下这些时间, 我完全可以在 T4 刮到一点分.
就当是行为艺术了吧, 虽然我没有把过程写到代码里进不了迷惑行为.26 行未改动#include<set>#include<map>#include<unordered_map>#include<queue>#include<bitset> #include<bitset>using namespace std;inline unsigned RD() { unsigned TmpRD(0); char RChr(getchar());94 行未改动#include<set>#include<map>#include<unordered_map>#include<queue>#include<bitset> #include<bitset>using namespace std;inline unsigned RD() { unsigned TmpRD(0); char RChr(getchar());69 行未改动 for (unsigned i(1); i <= t; ++i) { C = RD() + 1, E = RD(), A = RD() - 1, B = RD(); Node* Cur(N + A * m + B); Set.clear(), Go(Cur), Set.insert(Cur - N); if(Cur->U.Type) if(Cur->U.Type) {Dire = 1, Now = Cur->U.Type; if(Cur->U.Type > 1) Go(Cur->U.To); else Set.insert(Cur->U.To - N);} if(Cur->D.Type) if(Cur->D.Type) {Dire = 1, Now = Cur->D.Type; if(Cur->D.Type > 1) Go(Cur->D.To); else Set.insert(Cur->D.To - N);} if(Cur->L.Type) if(Cur->L.Type) {Dire = 2, Now = Cur->L.Type; if(Cur->L.Type > 1) Go(Cur->L.To); else Set.insert(Cur->L.To - N);} if(Cur->R.Type) if(Cur->R.Type) {Dire = 2, Now = Cur->R.Type; if(Cur->R.Type > 1) Go(Cur->R.To); else Set.insert(Cur->R.To - N);} printf("%u\n", Set.size()); Cur->Col = C, Cur->Lev = E; Cur->Col = C, Cur->Lev = E; } } return 0;}67 行未改动