perturbations single-cell problems solution

AtCoder Beginner Contest 335 G Discrete Logarithm Problems

洛谷传送门 AtCoder 传送门 考虑若我们对于每个 \(a_i\) 求出来了使得 \(g^{b_i} \equiv a_i \pmod P\) 的 \(b_i\)(其中 \(g\) 为 \(P\) 的原根),那么 \(a_i^k \equiv a_j \pmod P\) 等价于 \(kb_i \ ......
Logarithm Beginner Discrete Problems AtCoder

Solution Set【2024.1.13】

B. 山河入梦来 不难发现所求的其实就是该矩阵的行列式,考虑对矩阵进行高斯消元后求解。 我们考虑高斯消元的过程:从左到右枚举列,对于当前枚举的列,我们需要找到一个非零的行,使得该行的当前列的值为1,并且通过消元使得该列的其他行的值为0。 不难发现对于所有从当前列开始的连续的 \(1\) 中,取最短的 ......
Solution 2024 Set 13

GDKOI 2024 Description & My Solution

注:这里的 My Solution 仅提供我自己的赛时做法,可能非常乱搞。 Day 1 T1 Description 有 \(n\) 个怪物,\(m\) 点能量,每个怪血量为 \(a_{i}\),怪血量小于等于 \(0\) 就死亡。有三个技能: 平 a:不花能量对指定怪造成 \(1\) 点伤害; 战 ......
Description Solution GDKOI 2024 amp

Solution Set【2024.1.11】

A. 战争模拟器 设 \(f_{l, r, p}\) 表示区间满足 \(\operatorname{argmax}\limits_{l \le i \le r} A_i = p\) 的情况下区间 \(\left[l, r\right]\) 的最大利益,有转移: \[f_{l, r, p} = \ma ......
Solution 2024 Set 11

CF1006E Military Problem 题解

CF1006E Military Problem 题解 题意 给定一颗有 \(n \thinspace (2 \leq n \leq 2 \times 10^5)\) 个节点的树,树根为 \(1\)。 对于每个节点 \(i \thinspace (2 \leq i \leq n)\) 都有它的父节点 ......
题解 Military Problem 1006E 1006

P4137 Rmq Problem / mex

题意 给定一个长度为 \(n\) 的数组。 \(q\) 次询问,每次询问区间 \(mex\)。 Sol 考虑主席树维护区间 \(mex\)。 不难发现可以考虑维护当前所有点的最后出现的下标。 直接套板子即可。 Code #include <iostream> #include <algorithm> ......
Problem P4137 4137 Rmq mex

gurobipy: Gurobi Optimizer is a mathematical optimization software library for solving mixed-integer linear and quadratic optimization problems

Project description The Gurobi Optimizer is a mathematical optimization software library for solving mixed-integer linear and quadratic optimization p ......

http://www.nfls.com.cn:20035/contest/1878/problem/5

http://www.nfls.com.cn:20035/submission/781868 #include<bits/stdc++.h> using namespace std; int N, ct[45], b[25], ans, a[45][5]; void dfs(int t, int s ......
contest problem 20035 http 1878

Solution Set【2024.1.10】

CF1919F1 Wine Factory (Easy Version) / CF1919F2 Wine Factory (Hard Version) 考虑使用网络流刻画这个问题,将每个工厂建一个对应的节点,连出以下三种边: 从源点向工厂连一条容量为 \(a_i\) 的边 从工厂向汇点连一条容量为 ......
Solution 2024 Set 10

Solution Set【2024.1.9】

A. k 大值 不喜欢 k 大值,所以转化为求第 \(n - k + 1\) 小值。 注意到在 \(\left[0, V\right]\) 中均匀随机生成 \(n\) 个变量,其中第 \(k\) 小值的期望为 \(\frac{k}{n+1}V\),因此我们可以设置一个阈值 \(t\),并且存储位于 ......
Solution 2024 Set

Solution Set【2024.1.9】

A. k 大值 不喜欢 k 大值,所以转化为求第 \(n - k + 1\) 小值。 注意到在 \(\left[0, V\right]\) 中均匀随机生成 \(n\) 个变量,其中第 \(k\) 小值的期望为 \(\frac{k}{n+1}V\),因此我们可以设置一个阈值 \(t\),并且存储位于 ......
Solution 2024 Set

Solution - Holes

Link。 暴力做是 \(O(nm)\) 的。怎么优化呢? 结果用到了一个特别神的东西(罗阿姨认为 useless 的东西),分块。想到这个就豁然开朗了! 假设块长为 \(\sqrt{n}\),我们分成若干段,如果 \(i + power_i\) ......
Solution Holes

Solution - Stacking Cylinders

Link。 有一个向量旋转做法,但是我不会。 Note: To help you check your work, the x-coordinate of the center of the top cylinder should be the average of the x-coordinate ......
Cylinders Solution Stacking

CF1917D Yet Another Inversions Problem 题解

官方题解。 思路 首先可以把 \(a\) 数组分成 \(n\) 块,每块都是长为 \(k\) 的 \(q\) 数组。于是我们可以把答案拆成两部分计算:块内的贡献和块外的贡献。对于块内,\(p_i\) 都是一样的,因此可以直接消去,计算的实际上就是 \(q\) 序列的逆序对数,把这个值 \(\time ......
题解 Inversions Another Problem 1917D

Solution Set #6

这个博客最近阅读量突然变得好多,甚至有同学开始 QQ 催更了(?)感觉非常受宠若惊啊。 实在找不到好题了,这篇博客里一半的题目都是从 1kri 老师的趣题里面牛过来的,如果大家有好题可以推给博主,非常感谢!! 84 12.23 考试 train 题目大意 可以看出来是志愿者招募的模型,但是这样是不可 ......
Solution Set

The Biggest Water Problem

地址 #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin>>n; ll sum=0; while(n>10){ ll sum=n; ll d=0; while(sum){ ......
Biggest Problem Water The

P9356 Solution

Preface 甜橙好闪,拜谢甜橙。来一发验题人题解。 其实这题是出题人看错题后对着 CF1750E 出的,头图里的「只有一笔」指的是 oi 生只有这一道题。 Solution 直接考虑线性做法。 我们需要计数两个问题: 每个区间需要增加多少个括号: 对于一个有 \(x\) 个 \(\texttt ......
Solution P9356 9356

P8927 Solution

Preface 乱猜结论 并且懒得 implement 害人不浅。 Problem 给 \(a_1 \sim a_n\) 重排列,最大化 \(\sum\limits_{i=1}^n \lvert pa_i - qa_{i+1} \rvert\),其中 \(a_{n+1} = a_1\)。 Solut ......
Solution P8927 8927

在 remake 之前,你要先 rebuild。 | P8340 Solution

Preface 翻到自己两年前出的题,记得好像被一位 gm 评价为「参考山河重整可以轻易做到 \(\mathcal O(n\sqrt{n})\)」。现在我也是 (not-i)gm 了,但是回过头来看看还是只会 \(\mathcal O(n^3)\),然而当年指导我的 gm 已经高三退役了,令人感叹。 ......
Solution rebuild remake P8340 8340

P8381 Solution

Preface 你不觉得这很酷吗?作为一名 OIer 我觉得这太酷了,很符合我对构造题的想象,傻逼并带着人类智慧。 虽然是复读官方题解但是相比意识流我希望带给您更好的阅读体验。 您好,Sol1 先生,请问您在 NOI 之余方便解决一下我的疑问吗 /kel :【云剪贴板】 我大概看了一遍,是不是您那个 ......
Solution P8381 8381

P4005 Solution

Preface 一定要剪枝:如果搜到的答案 \(\geq\) 当前的最优答案就不要继续搜了!!!不剪枝跑 \(T = 100\) 只能沦为暴力同分!!! Solution 首先对于每组地铁站,有 \(8\) 种换乘情况。标注一遍: 直接爆搜(\(\mathcal O(n8^{\frac{n}{2}} ......
Solution P4005 4005

P7186 Solution

Preface 好久之前 随机跳题跳到这道题。既然现在都没有题解,那我就来水一发。 Problem 给出一个 \(N\times N\) 的,标号初始为有规律 \(1\dots N\times N\) 的网格。有 \(K\) 个关键点与其对应的位置,对于每个关键点,依次把该行向右循环平移直到与对应位 ......
Solution P7186 7186

CF750F Solution

Preface 咕咕咕咕咕咕咕了半年有余。不得不说这题真的会把你调炸!!!!!!11 本题解中的所有 Hints 以白字显示。所以它可能不适合手机观看。 以及,首黑,2022 年 7 月 31 日 15:51。 Solution 算法一 询问次数 $2^h - 2$,适用于 $h \leq 4$。 ......
Solution 750F 750 CF

QTREE2 - Query on a tree II - solution

目录QTREE2 - Query on a tree II前置知识定义First. 求 \(dis_{u, v}\)Second. 求 \(u\) 到 \(v\) 路径上的第 \(k\) 个点时间复杂度Code QTREE2 - Query on a tree II \(\mathtt {TAGS} ......
solution QTREE2 QTREE Query tree

QTREE2 - Query on a tree II - solution

目录QTREE2 - Query on a tree II前置知识定义First. 求 \(dis_{u, v}\)Second. 求 \(u\) 到 \(v\) 路径上的第 \(k\) 个点时间复杂度Code QTREE2 - Query on a tree II \(\mathtt {TAGS} ......
solution QTREE2 QTREE Query tree

curl_easy_perform() failed: Problem with the SSL CA cert (path? access rights?)

curl_easy_perform() failed: Problem with the SSL CA cert (path? access rights?) 最近遇到了一个这个问题 发现是因为自己加了一个这个 curl_easy_setopt(pCURL, CURLOPT_SSL_OPTIONS, ......

Solution 2.3 -《Sets, Functions, and Logic》

2.3 a) (a) $$ (\exists x \in \mathbb{N}) (x^3=27)$$ (b) $$ (\exists p \in \mathbb{N}) (p > 1,000,000) $$ (c) $$ \exists((p \in \mathbb{N})\wedge (1<p< ......
Functions Solution Logic Sets 2.3

Solution 1.1-《Sets, Functions, and Logic》

(1) (a). \(0<\pi<10\) (b). \(3<4\) (c). \(-3<e<3\) (d). \(\pi>0\) (e). \(\pi\neq0\) (2) (a). T (b). T (c). T (d). F (e). F (f). F (g). T (h). T (i). T ......
Functions Solution Logic Sets 1.1

Solution 1.2 -《Sets, Functions, and Logic》

(1) (a) 34159 is not a prime number. (b) Not all roses are red or not all vialets are blue. (c) If there are no hamburgers, I'll not have a hot dog. ( ......
Functions Solution Logic Sets 1.2

FreeBSD “su: Sorry” Problem

Solving the FreeBSD “su: Sorry” Problem The solution is to restart FreeBSD in single user mode and then make the change as root. This can be done by f ......
FreeBSD Problem Sorry su
共474篇  :1/16页 首页上一页1下一页尾页