Discrete mathematics
逻辑和证明命题逻辑命题($proposition$)命题是一个陈述语句(即陈述事实的语句),它或真或假,但不能既真又假。
条件($implies$)令 $p$ 和 $q$ 为命题。条件语句 $p \rightarrow q$ 是命题“如果 $p$,则 $q$ ”。当 $p$ 为真而 $q$ 为假时,条件语句 $p \rightarrow q$ 为假,否则为真。在条件语句 $p \rightarrow q$ 中,$p$ 称为假设(前件、前提),$q$ 称为结论(后件)。
$p$
$q$
$p \rightarrow q$
T
T
T
T
F
F
F
T
T
F
F
T
原命题:$p \rightarrow q$
逆命题($converse$):$q \rightarrow p$
逆否命题($contrapositive$):$\neg q \rightarrow \neg p$
反命题($inverse$):$\neg p \rightarrow \neg q$
双条件($biconditional$)令 $p$ 和 $q$ 为命题。双条件语句 $p \ ...
2023 CCPC Guilin C.Master of Both IV
C. Master of Both IVSolution前置知识:线性基
线性基内的基元异或不会为 0 ,线性基插入失败等价于当前数与线性基的某些基元异或为 0
由此我们可以记录 插入失败的个数,记为$c$,则任选数异或为 0 的种类为 $2^c - 1$(排除空集)
题目要求:$\forall x\in[1,m],a_{i_x}|\bigoplus\limits_{j=1}^m a_{i_j}$
我们将异或结果分为两种:等于 0, 不等于 0
一、等于 0
0 是任何数的倍数, 把所有数插入线性基求插入失败次数 $c$ 贡献 $2^c - 1$
二、不等于 0
假设结果为 $f$,因为要整除,选的数必须为它的因子,
设因子为$f_1, f_2, f_3,…,f_n$ (不包括自己)
个数记为$c_1, c_2, c_3,…,c_n$ (不包括自己)
让因子的异或结果为 0, 再异或自己, 结果就是 $f$, 满足题目要求
把所有因子插入进线性基,同种数必定插入失败,直接加
插入失败的次数等于:$\sum\limits_{i = 1}^{n}(c_i - 1) + ...
Frieren Beyond Journey's End Solution
Frieren Beyond Journey’s End Solution考虑对a前缀和得s$$\sum_{i=1}^{n}\sum_{l=1}^{i}\sum_{r=i}^{n}\sum_{k=l}^{r}a_k$$
$$= \sum_{i=1}^{n}\sum_{l=1}^{i}\sum_{r=i}^{n}(s[r] - s[l - 1])$$
$$= \sum_{i=1}^{n}(\sum_{l=1}^{i}\sum_{r=i}^ns[r] - \sum_{l=1}^{i}\sum_{r=i}^ns[l - 1])$$
$$= \sum_{i=1}^{n}(\sum_{l=1}^{i}\sum_{r=i}^ns[r] - \sum_{r=i}^{n}\sum_{l=1}^is[l - 1])$$
$$= \sum_{i=1}^{n}(i * \sum_{r ...
Frieren and Rotating Calipers Solution
Frieren and Rotating Calipers Solution由题矩形长和宽需要与$x$轴或 $y$轴平行
找到最大,最小的$x$, $y$记为$max_x, min_x, max_y, min_y$
答案$(max_x - min_x) * (max_y - min_y)$
1234567891011121314151617181920212223#include <bits/stdc++.h>using namespace std;int main(){ int t; cin >> t; while(t--){ int n; cin >> n; vector<int> x(n), y(n); for(int i = 0;i < n;i++){ cin >> x[i] >> y[i]; } int max_x = *max_elem ...
在blog写作
在blog写作常规操作正常写完md后 放到post下
注意md Front-matter
Front-matter | Hexo
12hexo clean hexo g
然后本地启动就可以看到文章
1hexo s
上传到自己的网站要部署
1hexo d
常用命令
简写
中文含义
hexo server
hexo s
本地启动
hexo generate
hexo g
生成静态文件
hexo deploy
hexo d
部署网站
hexo clean
hexo cl
清除缓存和已经生成的静态文件
一般情况,我们先依次输入hexo clean、 hexo g 、 hexo s ,没问题再 hexo d就行。
常见问题图片未显示
图片名和路径不能有空格
本地图片要相对路径 以blog为根目录
typora + hexo
在Front-matter加上
1typora-root-url: ..
写作时把图片拖入即可
解释:在source下创建images放所有文章图片 WriteOnHexo是本文的图片文件夹, 拖入即可显示,并且网站上也可正 ...
本地hexo部署
本地hexo部署安装GitGit下载地址:https://git-scm.com/download/
直接安装即可,网站会自动匹配合适版本(一直点next, 安装位置可自定义)
安装Node.jsNode.js下载地址: https://nodejs.org/en/download/
选择合适的installer直接安装即可
安装Hexo新建文件夹blog
该blog文件夹作为blog根目录, 此后所有git bash 都在这操作
blog内右键可以看到 git bash here
安装hexo
1npm install -g hexo-cli
初始化hexo
1hexo init
安装相关依赖
1npm install
测试
1hexo s
输入后可以看到这个本地静态网站open即可
网站界面可以用butterfly 和 Next 美化
利用butterfly美化后,具体可参考
https://butterfly.js.org/
Frieren and Rotating Calipers
Frieren and Rotating Calipers时间限制:1s空间限制:256MB
Description 芙莉莲正在学习旋转卡壳,但是字不会念,你能告诉她正确的读音吗?
学习过程中看到最小矩形覆盖问题,即给你n个点,求最小的矩形使得覆盖所有点。她发现最小的矩形的长和宽不一定与$x$轴,$y$轴平行,她认为这些矩形非常无聊,你能找到面积最小的有趣矩形使得覆盖所有点吗?
有趣矩形:长和宽与$x$轴或$y$轴平行的矩形
Input Description第一行一个正整数T表示测试数 $1 \le T \le 10^2$
每个测试的第一行有一个正整数n表示点的数量 $1 \le n \le 10^4$
每个测试接下来有n行,每行两个整数 $(x, y) $ $0 \le x \le 10^4 $,$0 \le y \le 10^4 $
Output Description每行输出符合条件的有趣矩形的面积
Input Sample12345678910230 01 00 140 01 00 11 1
Output Sample1211
Frieren Beyond Journey's End
Frieren Beyond Journey’s End时间限制:1s空间限制:256MB
Description 芙莉莲热衷周游各方搜集奇怪的魔法,某一天她得到一个有趣的魔法公式,
$$ \sum_{i=1}^n\sum_{l=1}^i\sum_{r=i}^n\sum_{k=l}^r a_k$$
同时为此搜集了n个魔法单元。由于种族的长寿天性导致她对时间的感觉不同于一般人,所以她请求你来帮忙。她估算结果可能很大,请你告诉她结果对1000000007取余后的数
Input Description第一行一个正整数T表示测试数 $ 1 \le T \le 10^5 $
每个测试的第一行有一个正整数n表示魔法单元的数量 $ 1 \le n \le 10^5 $
每个测试的第二行有n个整数 $ a_1, a_2, … , a_n \quad 0 \le a_i \le 10^9 $
题目保证总的所有n的和不会超过 $ 2 \times 10^5 $
Output Description对于每个测试输出一个整数 即结果对 $ ...
usage
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment
Load images123$ hexo clean$ hexo g$ hexo d
Tags1tags: ...