版本比较
9.28总结:cmy不能作为文件名
正文
增加 867 行删除 0 行
772 行未改动全部展开773774775776772 行未改动全部展开这么难?为啥$O(n^2)$可以100pts???---772 行未改动全部展开77377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643772 行未改动全部展开这么难?为啥$O(n^2)$可以100pts???---### T3:地形计算(calculate)* **本题得分:40*** **开始时间:11:00*** **结束时间:12:00*** **总用时:1h**#### 初始思路很简单,先用$topu$把所有不在环中的节点全删了(打vis)然后DFS一遍(随便选一个在环中的节点),记录到开始节点的距离(就是走了几步),如果一条边连接了差为3的两点,回溯用tong统计出现次数,累加没了#### 考场解题过程又错了,总之就是调了半天写了个选两条边的暴力#### 考场代码```cpp/*writer: Luna_Frome_StarryProblem: 不知名屑题Knowledge: 垃圾算法Time: O(过不了)PS:Hhy don't have dick*//*Note:*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 2505;const int M = 1500005;const int INF = 1e9;const int mod = 1e9 + 7;int a[N], vis[N][N], u[N], v[N];void work(){//please write your code hereint n, m;cin >> n >> m;for(int i = 1; i <= n; i++){cin >> a[i];}for(int i = 1; i <= m; i++){cin >> u[i] >> v[i];vis[u[i]][v[i]] = 1;vis[v[i]][u[i]] = 1;}int ans = 0;for(int i = 1; i <= m; i++){for(int j = 1; j < i; j++){if(u[i] == u[j] || u[i] == v[j] || v[i] == u[j] || v[i] == v[j]) continue;if(vis[u[i]][v[j]] && vis[v[i]][u[j]]) ans += a[u[i]] + a[v[i]] + a[v[j]] + a[u[j]];if(vis[u[i]][u[j]] && vis[v[i]][v[j]]) ans += a[u[i]] + a[v[i]] + a[v[j]] + a[u[j]];ans %= mod;}}cout << ans / 2;}signed main(){freopen("calculate.in","r",stdin);freopen("calculate.out","w",stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1; while(t--){work();}return 0;}/*8 101 2 3 4 5 6 7 81 22 33 44 13 77 66 53 54 85 8*/```**再附上错的code**```cpp/*writer: Luna_Frome_StarryProblem: 不知名屑题Knowledge: 垃圾算法Time: O(过不了)PS:Hhy don't have dick*//*Note:*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 1000005;const int M = 1500005;const int INF = 1e9;const int mod = 1e9 + 7;int a[N];vector<int> g[N];void add_edge(int u, int v){g[u].push_back(v);g[v].push_back(u);}int in[N], vis[N], dfn[N], tong[N], cnt, path[N];void add(int st, int sum, int opt){if(sum > opt) return ;tong[st] ++;add(path[st], sum + 1, opt);}int check(int st, int sum){if(sum > 2) return st;return check(path[st], sum + 1);}void dfs(int st, int lst){dfn[st] = dfn[lst] + 1;// cout << st << " ";for(auto it : g[st]){if(st == 3){// cout << it << " ";}if(dfn[it] != 0){if(dfn[st] - dfn[it] == 3){// cout << st << " " << it << "\n";path[it] = st;add(it, 1, 4);}if(dfn[it] - dfn[st] == 3){// cout << st << " " << it << "\n";path[st] = it;add(st, 1, 4);}continue;}path[it] = st;dfs(it, st);// break;}}void work(){//please write your code hereint n, m;cin >> n >> m;for(int i = 1; i <= n; i++){cin >> a[i];}for(int i = 1; i <= m; i++){int u, v;cin >> u >> v;in[u] ++;in[v] ++;add_edge(u, v);}queue<int> topu;for(int i = 1; i <= n; i++){if(in[i] == 1){topu.push(i);vis[i] = 1;}}while(topu.size()){int x = topu.front();topu.pop();for(auto it : g[x]){in[it] --;if(in[it] == 1){topu.push(it);vis[it] = 1;}}}for(int i = 1; i <= n; i++){// cout << vis[i] << " ";// for(int j = 1; j <= n; j++){// dfn[j] = 0;// }if(vis[i] == 0){dfs(i, 0);break;}}int ans = 0;for(int i = 1; i <= n; i++){// cout << tong[i] << " ";ans += tong[i] * a[i];ans %= mod;}cout << ans % mod;}signed main(){// freopen("sample1.in","r",stdin);// freopen("calculate.out","w",stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1; while(t--){work();}return 0;}/*8 101 2 3 4 5 6 7 81 22 33 44 13 77 66 53 54 85 8*/```#### 赛后题解- 30% 数据:$n, m \le 50$,枚举四个顶点(就是我的代码)枚举四个不同的顶点 $p < q < r < s$。四个顶点能构成四元环,当且仅当它们之间的边恰好组成一个简单环。对于四个顶点,可能的四元环边集合只有以下三种(旋转和反向视为同一种):1. $p \to q \to r \to s \to p$2. $p \to q \to s \to r \to p$3. $p \to r \to q \to s \to p$依次检查这三种环的每条边是否都存在。若存在,则该四元环的权值为 $a_p + a_q + a_r + a_s$,累加到答案中。由于每种环只被枚举一次(因为固定了 $p<q<r<s$ 且只检查这三种),不会重复计数。**复杂度**- 时间:枚举四点 $O(n^4)$,每种检查 $O(1)$,总 $O(n^4)$。$n \le 50$ 时约 $6 \times 10^6$,可接受。- 空间:邻接矩阵 $O(n^2)$。**代码**```cpp/*writer: Luna_Frome_StarryProblem: 地形计算 (30pts)Knowledge: 枚举四点 + 邻接矩阵Time: O(n^4)PS:Hhy don't have dick*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 55;const int MOD = 1e9 + 7;int n, m;int a[N];bool g[N][N];void work(){cin >> n >> m;for(int i = 1; i <= n; i++) cin >> a[i];for(int i = 1; i <= m; i++){int u, v;cin >> u >> v;g[u][v] = g[v][u] = true;}int ans = 0;for(int p = 1; p <= n; p++){for(int q = p + 1; q <= n; q++){for(int r = q + 1; r <= n; r++){for(int s = r + 1; s <= n; s++){if(g[p][q] && g[q][r] && g[r][s] && g[s][p]){ans = (ans + a[p] + a[q] + a[r] + a[s]) % MOD;}if(g[p][q] && g[q][s] && g[s][r] && g[r][p]){ans = (ans + a[p] + a[q] + a[r] + a[s]) % MOD;}if(g[p][r] && g[r][q] && g[q][s] && g[s][p]){ans = (ans + a[p] + a[q] + a[r] + a[s]) % MOD;}}}}}cout << ans << '\n';}signed main(){freopen("calculate.in", "r", stdin);freopen("calculate.out", "w", stdout);ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);int t = 1; while(t--) work();return 0;}```---- 60% 数据:$n, m \le 2000$,枚举两边一个四元环由 4 条边组成。我们可以**枚举四元环中的两条对边**,通过这两条边的端点关系以及邻接矩阵,判断它们能否补全为一个四元环。具体地,设四元环的 4 个顶点为 $p, q, r, s$,环上的边为 $p \to q \to r \to s \to p$。这个环可以看成由两条对边组成:- 对边 1:$(p, q)$ 和 $(r, s)$- 对边 2:$(q, r)$ 和 $(s, p)$因此,**枚举任意两条边** $(u_i, v_i)$ 和 $(u_j, v_j)$,如果它们**没有公共端点**,就有两种可能补全成四元环:- **情况 1:交叉连接**- 边 $i$:$u_i - v_i$- 边 $j$:$u_j - v_j$- 若存在边 $u_i - v_j$ 和 $v_i - u_j$,则 $u_i, v_i, u_j, v_j$ 四个点构成四元环 $u_i \to v_i \to u_j \to v_j \to u_i$。- **情况 2:平行连接**- 边 $i$:$u_i - v_i$- 边 $j$:$u_j - v_j$- 若存在边 $u_i - u_j$ 和 $v_i - v_j$,则 $u_i, v_i, v_j, u_j$ 四个点构成四元环 $u_i \to v_i \to v_j \to u_j \to u_i$。对于每种情况,环的权值为四个顶点的点权之和,累加到答案中。**为什么最后要除以 2**在四元环 $p \to q \to r \to s \to p$ 中,两组对边分别是:- $(p, q)$ 与 $(r, s)$- $(q, r)$ 与 $(s, p)$当枚举边对 $(i, j)$ 时,如果 $(u_i, v_i) = (p, q)$ 且 $(u_j, v_j) = (r, s)$,会通过“交叉连接”或“平行连接”判定为同一个环;如果 $(u_i, v_i) = (q, r)$ 且 $(u_j, v_j) = (s, p)$,也会通过另一种连接方式判定为同一个环。因此**每个四元环会被统计两次**,最终答案需要除以 2。**代码**```cpp/*writer: Luna_Frome_StarryProblem: 地形计算 (60pts)Knowledge: 枚举边对 + 邻接矩阵Time: O(m^2)PS:Hhy don't have dick*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 2505;const int M = 2000005;const int INF = 1e9;const int mod = 1e9 + 7;const int INV2 = 500000004;int a[N], vis[N][N], u[M], v[M];void work(){int n, m;cin >> n >> m;for(int i = 1; i <= n; i++){cin >> a[i];}for(int i = 1; i <= m; i++){cin >> u[i] >> v[i];vis[u[i]][v[i]] = 1;vis[v[i]][u[i]] = 1;}int ans = 0;for(int i = 1; i <= m; i++){for(int j = 1; j < i; j++){if(u[i] == u[j] || u[i] == v[j] || v[i] == u[j] || v[i] == v[j]) continue;if(vis[u[i]][v[j]] && vis[v[i]][u[j]]){ans = (ans + a[u[i]] + a[v[i]] + a[v[j]] + a[u[j]]) % mod;}if(vis[u[i]][u[j]] && vis[v[i]][v[j]]){ans = (ans + a[u[i]] + a[v[i]] + a[v[j]] + a[u[j]]) % mod;}}}ans = ans * INV2 % mod;cout << ans << '\n';}signed main(){freopen("calculate.in","r",stdin);freopen("calculate.out","w",stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1; while(t--){work();}return 0;}```---- 100% 数据:$n, m \le 10^5$固定对角点 $u,v$,公共邻点集合 $S$,$|S|=c$,点权和 $t$。贡献为:$$F(u,v) = (c-1)t + \binom{c}{2}(a_u + a_v)$$最大度删点。每次选当前度数最大的点 $u$,枚举两步路径 $u \to x \to v$,维护每个 $v$ 的公共邻点计数和权值和,套用公式。删除 $u$ 及其边。每个环在最早删除的点处统计一次,无需除以 2。**100代码**```cpp/*writer: Luna_Frome_StarryProblem: 地形计算Knowledge: 最大度删点 + 公共邻点公式Time: O(m sqrt(m) + (n+m) log n)PS:Hhy don't have dick*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 100005;const int MOD = 1e9+7;int n, m;int a[N];set<int> adj[N];int deg[N];bool removed[N];int cnt[N], sumv[N];vector<int> touched;signed main(){freopen("calculate.in","r",stdin);freopen("calculate.out","w",stdout);ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; i++) cin >> a[i];for(int i = 0; i < m; i++){int u, v; cin >> u >> v;adj[u].insert(v); adj[v].insert(u);}for(int i = 1; i <= n; i++) deg[i] = adj[i].size();priority_queue<pair<int,int>> pq;for(int i = 1; i <= n; i++) pq.push({deg[i], i});long long ans = 0;while(!pq.empty()){auto [d, u] = pq.top(); pq.pop();if(removed[u] || d != deg[u]) continue;for(int x : adj[u]){for(int v : adj[x]){if(v == u) continue;if(cnt[v] == 0) touched.push_back(v);cnt[v]++;sumv[v] = (sumv[v] + a[x]) % MOD;}}for(int v : touched){int c = cnt[v];if(c >= 2){int t = sumv[v];int contrib = ((c-1) * t % MOD + (c * (c-1) / 2 % MOD) * (a[u] + a[v]) % MOD) % MOD;ans = (ans + contrib) % MOD;}cnt[v] = 0; sumv[v] = 0;}touched.clear();removed[u] = true;for(int v : adj[u]){adj[v].erase(u);deg[v]--;pq.push({deg[v], v});}adj[u].clear();}cout << ans % MOD << '\n';return 0;}```#### 复杂度* 时间复杂度:$\mathcal{O(m \sqrt{m} + (n+m) \log n)}$* 空间复杂度:$\mathcal{O(n+m)}$#### 本题总结题解太易懂了,~哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈刀哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈草哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈~---### T4:黑哥的灯光预案(heige)* **本题得分:0*** **开始时间:24:00*** **结束时间:0:00*** **总用时:INFmin**#### 初始思路【数据删除】#### 考场解题过程【数据删除】#### 考场代码```cpp【数据删除】```#### 赛后题解$\large{本题总结由\mathfrak{deepseek} 提取公式,本人\~润\~色提供}$展开平方:$$K = \sum_{i=1}^n i(n-i+1)A_i^2 + 2\sum_{j<i} j(n-i+1)A_j A_i$$期望角度:每条指令独立选,概率 $1/2$。计算 $E[K]$,最后乘 $2^q$。对角线 $A_i^2$:只有覆盖 $i$ 的指令影响。用线性基求秩 $d_i$,枚举可达值 $v$,计算 $(a_i \oplus v)^2$ 之和,除以 $2^{d_i}$。交叉项 $A_j A_i$:固定位置对 $(j,i)$ 和位号 $(b,c)$。将指令按对两位的影响分为四类:只翻左、只翻右、同时翻、都不翻。统计数量,计算两位最终都为 1 的概率,乘位权 $2^{b+c}$ 和位置权重 $j(n-i+1)$,累加。用差分和扫描优化统计,复杂度 $O(B^2(q+n^2) + n2^B)$,$B=7$。**部分分**:- 1,2:$n \le 100, q \le 10$直接枚举所有 2^q 个指令子集。对每个子集,从原数组出发执行所有选中的区间异或,得到最终数组 A。然后 $\mathcal{O(n^2)}$ 枚举所有连续段,计算段和并累加平方,得到该子集的分值 K。将所有子集的分值求和并取模。**代码**```cpp/*writer: Luna_Frome_StarryProblem: 黑哥的灯光预案 (1-2档)Knowledge: 枚举子集Time: O(2^q * (q*n + n^2))PS:Hhy don't have dick*//*Note:*/#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 105;const int mod = 1e9 + 7;int n, q;int a[N], l[N], r[N], x[N];int b[N];void work(){cin >> n;for(int i = 1; i <= n; i++) cin >> a[i];cin >> q;for(int i = 0; i < q; i++){cin >> l[i] >> r[i] >> x[i];}int ans = 0;for(int mask = 0; mask < (1 << q); mask++){for(int i = 1; i <= n; i++) b[i] = a[i];for(int i = 0; i < q; i++){if(mask >> i & 1){for(int j = l[i]; j <= r[i]; j++){b[j] ^= x[i];}}}int K = 0;for(int i = 1; i <= n; i++){int sum = 0;for(int j = i; j <= n; j++){sum += b[j];K = (K + sum * sum) % mod;}}ans = (ans + K) % mod;}cout << ans << '\n';}signed main(){freopen("heige.in", "r", stdin);freopen("heige.out", "w", stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1;while(t--){work();}return 0;}```- 3-6:所有指令均为单点异或,即 $$l = r$$。不同位置受不同指令控制,因此最终值 $$A_i$$ 相互独立。对每个位置 $$i$$,收集所有覆盖它的指令异或值,建立线性基,求出秩 $$d_i$$。枚举所有可达值 $$v$$,计算:$$E[A_i] = \frac{1}{2^{d_i}} \sum_{v \in \text{span}} (a_i \oplus v)$$**代码**```cpp/*writer: Luna_Frome_StarryProblem: 黑哥的灯光预案 (3-6档)Knowledge: 线性基 + 期望Time: O(q + n * B * 2^B)PS:Hhy don't have dick*//*Note:*/#include<bits/stdc++.h>#define int long longusing namespace std;const int mod = 1e9 + 7;const int INV2 = 500000004;const int B = 7;int n, q;int a[105];vector<int> ops[105];int basis[B];int d[105];int qpow(int a, int b){int res = 1;while(b){if(b & 1) res = res * a % mod;a = a * a % mod;b >>= 1;}return res;}void insertBasis(int x, int &rank){for(int b = B - 1; b >= 0; b--){if(!(x >> b & 1)) continue;if(!basis[b]){basis[b] = x;rank++;return;}x ^= basis[b];}}bool inSpan(int x){for(int b = B - 1; b >= 0; b--){if(!(x >> b & 1)) continue;if(!basis[b]) return false;x ^= basis[b];}return true;}void work(){cin >> n;for(int i = 1; i <= n; i++) cin >> a[i];cin >> q;for(int i = 1; i <= n; i++) ops[i].clear();for(int i = 0; i < q; i++){int l, r, x;cin >> l >> r >> x;if(l == r) ops[l].push_back(x);}int E1[105] = {0}, E2[105] = {0};for(int i = 1; i <= n; i++){memset(basis, 0, sizeof(basis));int rank = 0;for(int x : ops[i]) insertBasis(x, rank);int s1 = 0, s2 = 0;for(int v = 0; v < (1 << B); v++){if(inSpan(v)){int val = a[i] ^ v;s1 = (s1 + val) % mod;s2 = (s2 + val * val) % mod;}}int inv = qpow(qpow(2, rank), mod - 2);E1[i] = s1 * inv % mod;E2[i] = s2 * inv % mod;}int EK = 0;for(int i = 1; i <= n; i++){int w = i * (n - i + 1) % mod;EK = (EK + w * E2[i]) % mod;}for(int j = 1; j <= n; j++){for(int i = j + 1; i <= n; i++){int w = j * (n - i + 1) % mod;EK = (EK + 2 * w % mod * E1[j] % mod * E1[i]) % mod;}}int ans = EK * qpow(2, q) % mod;cout << ans << '\n';}signed main(){freopen("heige.in", "r", stdin);freopen("heige.out", "w", stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1;while(t--){work();}return 0;}```- 7-10:所有指令的区间两两不相交,因此每个位置至多被一条指令覆盖。将位置按所属指令分块,未覆盖位置视为确定值。对每个块,块内位置共享同一个选择变量。计算每个位置的均值与二阶矩,以及同一块内位置对的二阶矩。不同块之间独立,可用均值乘积。枚举所有位置对,乘位置权重后累加,最后乘以 $$2^q$$。- 11,12:$n \le 30, q \le 20$不写了,~草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草草刀草草草草草草草草草草草草草草草草~**代码**```cpp/*writer: Luna_Frome_StarryProblem: 黑哥的灯光预案 (7-10档)Knowledge: 期望 + 按块计算Time: O(n^2 + q)PS:Hhy don't have dick*//*Note:*/#include<bits/stdc++.h>#define int long longusing namespace std;const int mod = 1e9 + 7;const int INV2 = 500000004;int n, q;int a[1005];int belong[1005];int L[505], R[505], X[505];int qpow(int a, int b){int res = 1;while(b){if(b & 1) res = res * a % mod;a = a * a % mod;b >>= 1;}return res;}void work(){cin >> n;for(int i = 1; i <= n; i++) cin >> a[i];cin >> q;for(int i = 1; i <= n; i++) belong[i] = 0;for(int i = 1; i <= q; i++){cin >> L[i] >> R[i] >> X[i];for(int j = L[i]; j <= R[i]; j++){belong[j] = i;}}int E1[1005] = {0}, E2[1005] = {0};for(int i = 1; i <= n; i++){if(belong[i] == 0){E1[i] = a[i];E2[i] = a[i] * a[i] % mod;}else{int x = X[belong[i]];int v1 = a[i];int v2 = a[i] ^ x;E1[i] = (v1 + v2) % mod * INV2 % mod;E2[i] = (v1 * v1 % mod + v2 * v2 % mod) % mod * INV2 % mod;}}int EK = 0;for(int i = 1; i <= n; i++){int w = i * (n - i + 1) % mod;EK = (EK + w * E2[i]) % mod;}for(int j = 1; j <= n; j++){for(int i = j + 1; i <= n; i++){int w = j * (n - i + 1) % mod;int E12;if(belong[j] != 0 && belong[j] == belong[i]){int x = X[belong[j]];int v1 = a[j] * a[i] % mod;int v2 = (a[j] ^ x) * (a[i] ^ x) % mod;E12 = (v1 + v2) % mod * INV2 % mod;}else{E12 = E1[j] * E1[i] % mod;}EK = (EK + 2 * w % mod * E12) % mod;}}int ans = EK * qpow(2, q) % mod;cout << ans << '\n';}signed main(){freopen("heige.in", "r", stdin);freopen("heige.out", "w", stdout);ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t = 1;while(t--){work();}return 0;}```- 13-15:$n \le 30, q \le 500$- 16-20:$n \le 300, q \le 300$- 21-25:满分算法。#### 补题代码```cpp我补个鬼,堪比杀蚂蚁```#### 复杂度* 时间复杂度:$O(B^2(q+n^2) + n2^B)$* 空间复杂度:$O(q + nB^2 + n2^B)$#### 本题总结【数据删除】,有看懂的风险吗---## 四、整体反思T2拖了太久了,导致T3没调出来(~可我觉得T4那样的话我其实做的挺对的~)T4有看懂的风险吗????????????????### 做得较好的地方T4有看懂的风险吗### 需要改进的地方合理调整时间以后遇到不会的题,不能一直停留### 时间安排总结这次的时间安排是:- T1:30 分钟;- T2:120 分钟;- T3:60 分钟- T4:0T2棒!