constructive problem
PSO Solve N-Queen Problem
title: PSO Solve N-Queen Problem layout: page categories: data analysis PSO Solve 16-Queen Problem The N-Queens problem is a classic problem in the fi ......
CF1325E Ehab's REAL Number Theory Problem
题目传送门 题目大意 给定 \(n\) 个数,每个数的因数个数不超过 \(7\),求最少选出多少个数能使得乘积为一个完全平方数。 无解输出 \(-1\)。 思路 约数个数定理:对于 \[n=\prod^{k}_{i=1}p_i^{a_i} \]\(n\) 的正约数个数为 \(\prod^{k}\li ......
SEERC 2020 Problem H
题目链接 模拟赛搬了这题,场切了顺手写个题解。 这种题当然先考虑单组询问怎么做,然后再拓展出去。 设按位与的集合是 \(A\),按位或的集合是 \(B\),结果都是 \(x\),我们考虑 \(A,B\) 的元素应该满足的性质。不难发现,所有 \(y<x\) 的 \(y\) 都应该在 \(B\),\( ......
D. XOR Construction
D. XOR Construction You are given $n-1$ integers $a_1, a_2, \dots, a_{n-1}$. Your task is to construct an array $b_1, b_2, \dots, b_n$ such that: ever ......
[ABC327G] Many Good Tuple Problems 题解
题意 对于一对长度均为 \(M\) 且元素值在 \(\left[1, N\right]\) 之间的序列 \((S, T)\),定义其为好的当且仅当: 存在一个长度为 \(N\) 的 \(01\) 序列 \(X\),使得其满足如下条件: 对于任意 \(i \in \left[1, M\right]\) ......
Educational Codeforces Round 157 (Rated for Div. 2) D. XOR Construction
原题链接 解读一下题意:给一个长度n-1的数组,让你找到一个长度为n的数组b,并且是0到n-1的全排列,使得bi异或bi+1对于ai。 这道题乍一看没什么思路,但是仔细一想会发现其实考察的就是异或的性质。我们可以发现:如果a异或b等于c,那么abc任意两个异或都能得到另外一个,所以只要初始的b0确定 ......
NEFU OJ Problem1356 帽儿山奇怪的棋盘 题解
帽儿山奇怪的棋盘 题目: Time Limit:1000ms Memory Limit:65535K Description 军哥来到了帽儿山,发现有两位神人在顶上对弈。棋盘长成下图的模样: 每个点都有一个编号:由上到下,由左到右,依次编号为 1、2……12。两位神人轮流博 弈,每一轮操作的一方可以 ......
Educational Codeforces Round 157 (Rated for Div. 2) D. XOR Construction
题目链接 题意 给你 \(n-1\) 个整数 \(a_1, a_2, \dots, a_{n-1}\) 。 你的任务是构造一个数组 \(b_1, b_2, \dots, b_n\) ,使得: 从 \(0\) 到 \(n-1\) 的每个整数都在 \(b\) 中出现一次; 对于从 \(1\) 到 \(n ......
environmental problem--deforestation
Deforestation is a serious environmental issue in China and many other countries. The main reasons for deforestation are economic development needs, u ......
Trailhead - 证书维护挑战失败 提示Whoops, looks like there was a problem. Please try again.
前情提要 当进行Trailhead证书维护的时候,往往会需要完成答题+挑战(Challenge)。然而有时候会遇到下述的问题👉代码正确(至少看起来)并且在页面验证通过,在Challenge里Check时却提示”Whoops, looks like there was a problem. Plea ......
China's Air Pollution Problem
China's Air Pollution Problem Air pollution is a global problem, but China is particularly serious about it. In recent years, China's air quality inde ......
Solution to OpenSSL Connection Problems With Github
Problems Uploading Files with Git Sometimes we can use git tool to successfully upload projects to Github, but in other time especially after a period ......
https://www.luogu.com.cn/problem/P1104 生日问题笔记
标记:当出现一组数据中有多个数据,这个时候我们常考虑用结构体去编写代码,因为结构体可以使得 几个本不相关的变量联系起来,并且当一个变量改变时,其他变量也会跟着改变,这使得代码变得简单。 使用结构体后,我们在读入数据之后,我们用sort 进行排序,并且构造一个cmp函数,使得我们的排序 满足题目的要求 ......
Urbanization Problem in CHINA
Urbanization Rapid urbanization has taken place in China ever since the economic development and socioeconomic changes of the 1980s. Approximately 40% ......
2021 CCPC桂林 B.A Plus B Problem (线段树)
传送门 线段树大模拟!。考验线段树功底的时候来了,作为队伍的史山选手,写这么史也是情有可原的。 #include <bits/stdc++.h> using ll = long long; const int INF = 0x3f3f3f3f; const int N = 1e6 + 10; typ ......
CF1073G Yet Another LCP Problem
一道 *2600 调了一年,代码细节是有点粪了,但自己菜也是挺菜的。/oh/oh 考虑容斥,令 \(f(A)=\sum\limits_{i,j\in A}\operatorname{lcp}(i,j)\),那么答案就是 \(f(A\cup B)-f(A)-f(B)\)(这里的并表示可重集合并)。 令 ......
SSL certificate problem: unable to get local issuer certificate 错误解决
终端报了如下错误git SSL certificate problem: unable to get local issuer certificate 这个问题是由于没有配置信任的服务器HTTPS验证。默认,cURL被设为不信任任何CAs,就是说,它不信任任何服务器验证。在网上查了很多方法,最终使用 ......
[HDU 3483] A Very Simple Problem 题解
题目描述 快速求出下面式子的值: \[\left(\sum\limits_{k=1}^{N}k^{x}x^{k}\right)\bmod M \]其中 \(1 ≤ N, M ≤ 2\times 10^9\), 并且 \(1 ≤ x ≤ 50\)。 题解 (solution) 对于该类题目,\(N\) ......
题解 CF903G【Yet Another Maxflow Problem】
加边 \(A_n\stackrel{0}{\to}A_{n+1}\),\(B_0\stackrel{0}{\to}B_1\)。称形如 \(A_i\to A_{i+1}\) 的边为左部边,形如 \(B_j\to B_{j+1}\) 的边为右部边,形如 \(A_i\to B_j\) 的边为中间边。 根据 ......
BUG:cURL error 60: SSL certificate problem: unable to get local issuer certificate
PHP ssl 证书问题 (我的环境是phpstudy) 解决方案: 1.https://curl.se/docs/caextract.html 打开网址,下载最新PEM 2.将证书放进对应PHP版本extras/ssl 文件里面 3.修改对应版本的PHP.INI 4.重启PHP 问题解决 ......
Vivado生成bitstream时报错[Opt 31-67] Problem: A LUT3 cell in the design is missing a connection on input pin I1, which is used by the LUT equation
这个原因主要是因为有一个引脚没有用到,解决方法。 1、打开Schematic。 2、根据提示的模块去找,比如说我的报错。 [Opt 31-67] Problem: A LUT3 cell in the design is missing a connection on input pin I1, w ......
CF1003E Tree Constructing
很trivial的构造题 首先上来判掉一些显然无解的情况,然后考虑既然最后直径长为\(d\)那么不妨先搞一条长度为\(d\)的链来 考虑在链上接一些点使得直径不会变长,对于链上的某个点,它最多能接上的链的长度就是它到两个端点距离的最小值 不妨设计递归函数求解,设solve(x,dis,lim)表示在 ......
Paper Reading: Sample and feature selecting based ensemble learning for imbalanced problems
为了克服现有集成方法的缺点,本文提出一种新的混合集成策略——样本和特征选择混合集成学习 SFSHEL。SFSHEL 考虑基于聚类的分层对大多数样本进行欠采样,并采用滑动窗口机制同时生成多样性的特征子集。然后将经过验证训练的权重分配给不同的基学习器,最后 SFSHEL 通过加权投票进行预测。SFSHE... ......
[JOISC 2021 Day2] 道路の建設案 (Road Construction)
[JOISC 2021 Day2] 道路の建設案 (Road Construction) 题意 给定图上 \(n\) 个点,求前 \(k\) 小曼哈顿距离点对距离。 题解 很好的一道题。 首先有一个 \(O(nlog^2n)\) 的做法,个人感觉还是很有启发性的。 一般对于第 \(k\) 小的处理方 ......
CF513G3 Inversions problem
CF513G3 Inversions problem 更好的阅读体验 推式子题。 task 1 直接爆搜,统计每种结果的答案,最后加在一起除以总方案数。 task 2 数据范围变大,显然不能记录整个数组的状态,考虑拆位算贡献。设 \(f_{i,j,k}\) 表示交换了 \(k\) 步,\((i,j) ......
Codeforces Round 893 (Div. 2) C. Yet Another Permutation Problem
有一个 \(gcd\) 游戏,按以下步骤进行: 选择一个 \(n\) 的排列 \(p_1, p_2, \cdots, p_n\) 。 对于每个 \(i\) ,\(d_i = gcd(p_i, p_{i \% n + 1})\) 排列 \(p\) 的 \(score\) 为数组 \([d_1, d_2 ......
【转载】How to solve the problem that getting timestamp from Mysql database is 8 hours earlier than the normal time
This article introduces the relevant knowledge of "how to solve the problem of obtaining timestamp from Mysql database 8 hours earlier than the normal ......
Gym101064L The Knapsack problem
CF 传送门 发现物品的体积很小,尝试从此处入手。 设 \(K\) 为最大的物品体积。把背包体积 \(m\) 分成差不超过 \(K\) 的两部分,然后合并。这样需要求出 \(f(\frac{m}{2} - K \sim \frac{m}{2} + K)\)。 递归地,可以发现需要求出 \(f(\fr ......
CF1870E Another MEX Problem 题解
原题 翻译 首先 \(O(n^3)\) 的 dp 是 simple 的。设 \(dp_{i,j}\) 表示前 \(i\) 个划分后异或和为 \(j\) 是否可行。因为转移不具有连续性,故bitset无法优化(其实 \(O(\frac{n^3}{\omega})\) 也跑不过去) 官方做法: 定义对于 ......