| 2026-10-1 9:28:36 |
*
|
# 取数游戏 题解
## 思路
一个数对「33DAI 取到的和」的奇偶性的影响只有两种:取到奇数会把和的奇偶性翻转,
取到偶数不改变和的奇偶性。因此**只有奇数的个数 $c$ 与偶数的个数 $e$ 有意义**,
具体数值完全无关。
把博弈的状态记成 $(c, e, p)$:还剩 $c$ 个奇数、$e$...
|
33DAI
|
| 2026-10-1 0:25:44 |
*
|
# 传送阵·困难 题解
## 思路
先把"走到第 $i$ 座传送阵"的两条路算清楚:
- 从坐标 $0$ 走过去要 $i$ 步,用掉传送阵要 $a_i$,记 $d_1[i] = i + a_i$;
- 从坐标 $n+1$ 走过去要 $n+1-i$ 步,记 $d_2[i] = n+1-i +...
|
33DAI
|
| 2026-10-1 0:25:22 |
*
|
# 石子与异或 题解
## 思路
关键结论:**正整数 $x$ 的正因子个数是奇数,当且仅当 $x$ 是完全平方数**。
(因子总是成对出现 $d$ 与 $x/d$,只有 $d = x/d$ 时配对失败,此时 $x = d^2$。)
题目又规定 $0$ 的正因子个数按奇数算,于是
$$\text{答案} =...
|
33DAI
|
| 2026-10-1 0:24:44 |
*
|
# 平衡数对 题解
## 思路
记 $x = a \oplus b$。由按位异或与加法的关系
$$a + b = (a \oplus b) + 2(a \mathbin{\&} b)$$
题目的条件 $a \oplus b = \frac{a + b}{2}$ 等价于
$$2(a \oplus b) = (a...
|
33DAI
|
| 2026-10-1 0:24:26 |
*
|
# 三进制天平 题解
## 思路
把 $X$ 写成三进制。如果每位系数只取 $0/1$,那么"右托盘放这条系数为 $1$ 的砝码"
就能直接平衡。麻烦在于三进制系数可以取 $2$。
用平衡三进制(系数取 $-1/0/1$)解决:遇到系数 $2$ 时,把它改写成 $-1$ 并向高位进 $1$,
因为 $2...
|
33DAI
|
| 2026-10-1 0:23:47 |
*
|
# 传送阵·简单 题解
## 思路
使用第 $i$ 座传送阵的总花费由两部分构成:
1. **走过去的路费**:33DAI始终从坐标 $0$ 出发(用完传送阵会回到 $0$),
要到坐标 $i$ 必须向右走 $i$ 步,花费 $i$ 枚金币;
2. **传送阵本身的花费**:$a_i$ 枚。
所以第...
|
33DAI
|
| 2026-8-27 17:28:09 |
*
|
显然可以做到60的时间复杂度,但是3600已经足够
```cpp
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,ans;
signed...
|
leezzz
|
| 2026-8-23 19:27:09 |
*
|
# 「IOI 赛场」题解
## 题目简述
有 3 道题目,每道题满分 100 分,且由若干个子任务组成,每个子任务有各自的满分(总和为 100)。 你有 k 种可执行的操作(提交),每种操作花费 t 分钟,针对某一道题进行一次提交,这次提交会给出该题每个子任务的一个得分(可能为...
|
33DAI
|
| 2026-8-23 19:26:49 |
*
|
### 100分
#### 题意简述
小鸟从 $(0,k)$ 出发,第 $i$ 秒根据操作段 $j$ 的方向 $b_j$ 移动一格:$b_j=1$ 时上升($y+1$),$b_j=0$ 时下降($y-1$),横坐标每秒 $+1$。共 $n$ 个障碍,第 $i$ 个在横坐标 $x_i$ 处,缺口为...
|
33DAI
|
| 2026-8-23 19:26:30 |
*
|
### 解题思路
设 $B = 10^k$。一个 $k$ 位数 $y$(首位不能为 $0$)的取值范围是
$$10^{k-1} \le y \le 10^k - 1.$$
我们需要找出这个区间内所有 $x$ 的倍数,并回答两个问题:最小的一个是几?总共有多少个?
$x$ 的倍数从小到大为...
|
33DAI
|
| 2026-8-23 19:25:52 |
*
|
### 解题思路
两个小球的质量、速度大小都相同,发生一维对心碰撞时相当于交换速度。由于两球完全相同、只关心最终位置集合(不关心哪个球在前),碰撞交换速度的效果等价于两个球**互相穿过、互不影响**地继续运动。
因此完全不需要模拟碰撞过程:位于 $a$ 的球 $t$ 秒后到达 $a+t$,位于 $b$ 的球 $t$...
|
33DAI
|
| 2026-8-20 15:37:17 |
*
|
```cpp
#include<bits/stdc++.h>
using namespace std;
int n,k,m;
string s;
int tim,color[26];
string ans;
void work3(){
// 前 k 个字母长度为 n 有 k^n 种
// 长度为 m 的字符串有...
|
33DAI
|
| 2026-8-20 15:36:59 |
*
|
## 好做法
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
int n, m;
int a[MAXN + 5];
vector<int> b2, b3;
long long sum2[MAXN +...
|
33DAI
|
| 2026-8-20 15:36:25 |
*
|
```cpp
#include<bits/stdc++.h>
using namespace std;
int a,b,c,aa,bb,cc,ans;
int sum;
int f(int a,int b,int aa,int...
|
33DAI
|
| 2026-8-20 15:34:34 |
*
|
```cpp
#include<bits/stdc++.h>
using namespace std;
int c,x,y;
int main()
{
cin>>c>>x>>y;
if(c>=x)
cout<<c+c-y-y;
else...
|
33DAI
|
| 2026-8-18 15:13:47 |
*
|
T4 字符串描述状态
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 16;
const int MAXM = 16 * 15;
const long long INF = 16LL * 15 *...
|
33DAI
|
| 2026-8-18 15:11:43 |
*
|
T3 位运算
```cpp
#include <bits/stdc++.h>
using namespace std;
const long long INF = 20LL * 1'000'000'000 + 1;
int n, m;
int now[25], c[25];
int main()
{
...
|
33DAI
|
| 2026-8-16 16:50:45 |
*
|
## 记忆化搜索
```cpp
#include <bits/stdc++.h>
using namespace std;
const long long INF = 250LL * 250 * 1'000'000'000;
const int MAXN = 250;
int n;
int a[MAXN +...
|
33DAI
|
| 2026-8-16 16:04:01 |
*
|
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int n, k;
// <时间点、发生的事>
pair<int, int> a[MAXN * 2 + 5];
int main()
{
...
|
33DAI
|
| 2026-8-16 15:34:43 |
*
|
## n^2 DP + 特判
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int n;
int a[MAXN + 5];
// 以每个位置结尾的最长上升
int f[MAXN + 5];
//...
|
33DAI
|
| 2026-8-16 14:28:39 |
*
|
## 每行一个前缀和
略
## 曼哈顿转切比雪夫
补完第一个写法之后再写这个
```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int a[2005][2005];
long long sum[2005][2005];
long...
|
33DAI
|
| 2026-8-15 16:44:32 |
*
|
允许重复执行的广搜
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500000;
const int MAXM = 1000000;
const int INF = 1000000 + 1;
int n, m;
//...
|
33DAI
|
| 2026-8-15 16:42:25 |
*
|
二分答案+搜索检验
```cpp
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 500000;
const int MAXQ = 500000;
int n, q;
struct Ques
{
...
|
33DAI
|
| 2026-8-15 16:41:49 |
*
|
记忆化搜索
```cpp
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 1000;
const int INF = 2'000'000'000'000;
int n, m, c;
int...
|
33DAI
|
| 2026-8-15 16:41:16 |
*
|
贪心
```cpp
#include <bits/stdc++.h>
using namespace std;
int n;
// <ri+gi, li>
pair<int, int> line[200000 + 5];
int main()
{
ios::sync_with_stdio(false);
...
|
33DAI
|
| 2026-8-14 15:39:58 |
*
|
## 二分答案
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int n, k;
int a[MAXN + 5];
bool check(int maxD)
{
int cnt = 1;
...
|
33DAI
|
| 2026-8-14 15:26:13 |
*
|
## 链式
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int n;
int w[MAXN + 5];
vector<int> e[MAXN + 5];
bool vis[MAXN + 5];
int...
|
33DAI
|
| 2026-8-14 15:24:56 |
*
|
## 纯暴力
```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m;
char g[1005][1005];
int tim;
int vis[1005][1005];
int work(int x, int y)
{
tim++;
...
|
33DAI
|
| 2026-8-14 15:23:18 |
*
|
## 基础暴力
```cpp
#include <bits/stdc++.h>
using namespace std;
int n;
int a[200000 + 5];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >>...
|
33DAI
|
| 2026-8-13 16:45:24 |
*
|
## 三分钟暴力
```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
const int MOD = 1'000'000'000 + 7;
int n;
int a[MAXN + 5];
int...
|
33DAI
|