文件
csp/cpp_basic_20_upsert.sql
cryptocommuniums-afk 2b6def2560 feat: print includes answer only after unlocking solutions
- If solutions already unlocked (full mode), print button shows '打印题目+答案'
- If not unlocked, print button shows '打印题目' (problem only)
- No longer forces unlock when printing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-16 21:19:57 +08:00

364 行
24 KiB
PL/PgSQL
原始文件 Blame 文件历史

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
BEGIN;
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-01-hello','C++基础01环境配置与Hello WorldVSCode','# C++基础01环境配置与Hello WorldVSCode
## 学习目标
- 安装并打开 VSCode,创建并运行第一个 C++14 程序
- 学会新建文件、保存、运行、查看输出
- 了解 `main()`、`#include <iostream>`、`cout`
## 推荐视频(观看后写笔记)
- 保姆级VSCode + mingw64 配置 C/C++BV1tg411N7Fq
- https://www.bilibili.com/video/BV1tg411N7Fq/
- 每天五分钟学C++01 开发工具BV1dK4y137bk,系列入口
- https://www.bilibili.com/video/BV1dK4y137bk/
## 参考图文
- LoongBa 极简配置GCC/VSCode/HelloWorld
- https://github.com/LoongBa/Cpp_Beginner_Guide
## 练习(完成至少 2 题)
- B2002 Hello, World! https://www.luogu.com.cn/problem/B2002
- P1000 超级玛丽游戏 https://www.luogu.com.cn/problem/P1000
## 提交要求
- 在本题页面下方“学习笔记”区域写下:
1) 你安装了什么、遇到什么坑、怎么解决
2) 你的 HelloWorld 代码
3) 你学到的 3 个关键词
',1,'course:cpp-basic:01',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-01-hello');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-01-hello'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-01-hello'),'vscode');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-01-hello'),'io');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-02-io','C++基础02输入输出与变量','# C++基础02输入输出与变量
## 学习目标
- 会用 `cin` 读入、`cout` 输出
- 理解变量:`int / long long / double / char / string`
## 推荐视频
- 每天五分钟学C++02 输出、03 变量(系列入口见上)
- https://www.bilibili.com/video/BV1dK4y137bk/
## 练习
- P1001 A+B Problem https://www.luogu.com.cn/problem/P1001
- B2008 计算 (a+b)×c 的值 https://www.luogu.com.cn/problem/B2008
- P5704 字母转换 https://www.luogu.com.cn/problem/P5704
## 提交要求
- 上传/填写学习笔记:写出 `cin/cout` 模板、常见错误(空格/换行)
',1,'course:cpp-basic:02',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-02-io');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-02-io'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-02-io'),'io');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-02-io'),'types');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-03-branch','C++基础03分支结构if / switch','# C++基础03分支结构if / switch
## 学习目标
- 会写 `if / else if / else` 与基本逻辑运算
- 能处理边界与分类讨论
## 练习
- B2035 判断数正负 https://www.luogu.com.cn/problem/B2035
- P5711 闰年判断 https://www.luogu.com.cn/problem/P5711
- P1909 买铅笔 https://www.luogu.com.cn/problem/P1909
## 提交要求
- 笔记里写清:你如何找“边界”(例如 0、最小/最大、等于条件)
',2,'course:cpp-basic:03',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-03-branch');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-03-branch'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-03-branch'),'branch');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-03-branch'),'logic');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-04-loop','C++基础04循环结构for / while','# C++基础04循环结构for / while
## 学习目标
- 会用循环做:计数、累加、打印图形
## 练习
- B2083 画矩形 https://www.luogu.com.cn/problem/B2083
- P1421 小玉买文具 https://www.luogu.com.cn/problem/P1421
## 提交要求
- 笔记里写:循环三要素(初始化/条件/更新)+ 你调试的方法
',2,'course:cpp-basic:04',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-04-loop');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-04-loop'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-04-loop'),'loop');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-04-loop'),'debug');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-05-array','C++基础05数组入门一维','# C++基础05数组入门一维
## 学习目标
- 会定义数组、遍历、统计
## 练习
- P1427 小鱼的数字游戏 https://www.luogu.com.cn/problem/P1427
- P1428 小鱼比可爱 https://www.luogu.com.cn/problem/P1428
## 提交要求
- 笔记里写:数组下标从 0/1 的选择;如何避免越界
',3,'course:cpp-basic:05',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-05-array');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-05-array'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-05-array'),'array');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-06-char-string','C++基础06字符与字符串char / string','# C++基础06字符与字符串char / string
## 学习目标
- 区分 `char`(一个字符)与 `string`(一串字符)
- 会做:大小写转换、统计字母、简单加密
## 重点
- `char c=''A''`,`string s="abc"`
- `s.size()` / `s[i]` / 遍历字符串
## 练习(完成至少 2 题)
- P5704 字母转换 https://www.luogu.com.cn/problem/P5704
- P5733 自动修正 https://www.luogu.com.cn/problem/P5733
- P1914 小书童——凯撒密码 https://www.luogu.com.cn/problem/P1914
## 提交要求
- 笔记写:`string` 下标访问与越界风险(最后一个下标是 size()-1
',3,'course:cpp-basic:06',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-06-char-string');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-06-char-string'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-06-char-string'),'string');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-06-char-string'),'char');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-07-operator-cast','C++基础07运算、取整与类型转换/ %','# C++基础07运算、取整与类型转换/ %
## 学习目标
- 写对 `+ - * / %`
- 理解:整数除法会向下取整;`%` 只能用于整数
- 学会用 `long long` 防止溢出
## 练习
- B2008 计算 (a+b)×c 的值 https://www.luogu.com.cn/problem/B2008
- P1421 小玉买文具 https://www.luogu.com.cn/problem/P1421
- P5708 三角形面积 https://www.luogu.com.cn/problem/P5708
## 提交要求
- 笔记写:什么时候要用 `long long`(例如钱、人数、乘法很大)
',3,'course:cpp-basic:07',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-07-operator-cast');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-07-operator-cast'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-07-operator-cast'),'math');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-07-operator-cast'),'cast');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-08-logic','C++基础08逻辑运算与边界&& || !','# C++基础08逻辑运算与边界&& || !
## 学习目标
- 能把题目里的“并且/或者/不是”写成条件
- 学会找边界:等于、最小/最大、0
## 练习
- P5710 数的性质 https://www.luogu.com.cn/problem/P5710
- P5711 闰年判断 https://www.luogu.com.cn/problem/P5711
- P1909 买铅笔 https://www.luogu.com.cn/problem/P1909
## 提交要求
- 笔记写:你列出的边界测试用例(至少 3 个)
',3,'course:cpp-basic:08',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-08-logic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-08-logic'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-08-logic'),'logic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-08-logic'),'boundary');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-09-switch','C++基础09switch 与枚举列情况','# C++基础09switch 与枚举列情况
## 学习目标
- 会写 `switch/case/break`
- 面对“情况很少”的题,会列举所有情况
## 练习
- P2433 小学数学N合一 https://www.luogu.com.cn/problem/P2433
## 提交要求
- 笔记写:为什么每个 case 后要 `break`(避免贯穿执行)
',3,'course:cpp-basic:09',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-09-switch');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-09-switch'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-09-switch'),'switch');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-09-switch'),'enum');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-10-for','C++基础10for循环计数与累加','# C++基础10for循环计数与累加
## 学习目标
- 熟练掌握 `for(初始化; 条件; 更新)`
- 会写:求和、求最大最小、统计个数
## 练习
- P1425 小鱼的游泳时间 https://www.luogu.com.cn/problem/P1425
- P5718 找最小值 https://www.luogu.com.cn/problem/P5718
## 提交要求
- 笔记写:循环“三要素”分别是什么
',3,'course:cpp-basic:10',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-10-for');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-10-for'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-10-for'),'loop');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-10-for'),'for');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-11-while','C++基础11while循环未知次数','# C++基础11while循环未知次数
## 学习目标
- 会用 `while` 处理:读到结束、读到 0 停止
- 避免死循环:每次循环必须改变状态
## 练习
- P1427 小鱼的数字游戏 https://www.luogu.com.cn/problem/P1427
- P1047 校门外的树选做https://www.luogu.com.cn/problem/P1047
## 提交要求
- 笔记写:你是如何避免死循环的(更新变量写在哪里)
',3,'course:cpp-basic:11',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-11-while');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-11-while'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-11-while'),'loop');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-11-while'),'while');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-12-nested','C++基础12嵌套循环与打印图形','# C++基础12嵌套循环与打印图形
## 学习目标
- 外层循环=行,内层循环=列
- 能打印:矩形、三角形、乘法表
## 练习
- B2083 画矩形 https://www.luogu.com.cn/problem/B2083
- P5717 三角形分类(练分类讨论 + 输出格式https://www.luogu.com.cn/problem/P5717
## 提交要求
- 笔记写:你画图时是怎么想“行/列”的
',3,'course:cpp-basic:12',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-12-nested');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-12-nested'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-12-nested'),'nested-loop');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-12-nested'),'print');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-13-array-ops','C++基础13数组进阶统计/查找/反转)','# C++基础13数组进阶统计/查找/反转)
## 学习目标
- 用数组做:统计、查找位置、反转、去重(了解)
## 练习
- P1428 小鱼比可爱 https://www.luogu.com.cn/problem/P1428
- P5727 冰雹猜想 https://www.luogu.com.cn/problem/P5727
## 提交要求
- 笔记写:数组越界的 2 个典型原因 + 你的检查方法
',4,'course:cpp-basic:13',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-13-array-ops');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-13-array-ops'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-13-array-ops'),'array');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-13-array-ops'),'practice');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-14-function','C++基础14函数入门把重复代码变成工具','# C++基础14函数入门参数/返回值/作用域)
## 学习目标
- 会定义并调用函数
- 知道局部变量作用域({} 内有效)
## 练习
- P5735 距离函数 https://www.luogu.com.cn/problem/P5735
- P5739 计算阶乘也可用递归https://www.luogu.com.cn/problem/P5739
## 提交要求
- 笔记写:你把哪段重复代码抽成了函数?为什么这样更清晰?
',4,'course:cpp-basic:14',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-14-function');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-14-function'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-14-function'),'function');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-14-function'),'scope');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-15-recursion','C++基础15递归入门选学','# C++基础15递归入门选学
## 学习目标
- 理解递归:函数调用自己
- 必须有终止条件(否则会无限调用)
## 练习
- P5739 计算阶乘 https://www.luogu.com.cn/problem/P5739
- P1028 数的计算选做https://www.luogu.com.cn/problem/P1028
## 提交要求
- 笔记写:你的递归“终止条件”是什么?
',4,'course:cpp-basic:15',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-15-recursion');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-15-recursion'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-15-recursion'),'recursion');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-16-struct','C++基础16结构体 struct选学','# C++基础16结构体 struct选学
## 学习目标
- 用 `struct` 把多个字段打包成一个“人物卡/记录”
- 学会 `struct` 数组
## 练习
- P5740 最厉害的学生 https://www.luogu.com.cn/problem/P5740
- P5744 培训 https://www.luogu.com.cn/problem/P5744
## 提交要求
- 笔记写struct 适合用在什么场景(多个属性属于同一个对象)
',4,'course:cpp-basic:16',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-16-struct');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-16-struct'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-16-struct'),'struct');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-17-sort','C++基础17排序初步sort','# C++基础17排序初步sort
## 学习目标
- 会用 `#include <algorithm>` 和 `sort`
- 排序后做统计/查找会更简单
## 练习
- P1059 明明的随机数 https://www.luogu.com.cn/problem/P1059
- P1093 奖学金选做https://www.luogu.com.cn/problem/P1093
## 提交要求
- 笔记写sort 的区间是 `[begin, end)`end 不包含)
',4,'course:cpp-basic:17',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-17-sort');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-17-sort'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-17-sort'),'sort');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-17-sort'),'algorithm');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-18-binary-search','C++基础18二分查找初步lower_bound','# C++基础18二分查找初步lower_bound
## 学习目标
- 理解“在有序数组里快速找答案”
- 会用 `lower_bound` 找第一个 >= x 的位置
## 练习
- P2249 查找 https://www.luogu.com.cn/problem/P2249
## 提交要求
- 笔记写:二分查找的前提:数组必须有序
',4,'course:cpp-basic:18',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-18-binary-search');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-18-binary-search'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-18-binary-search'),'binary-search');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-19-prefix-sum','C++基础19前缀和区间求和神器','# C++基础19前缀和区间求和神器
## 学习目标
- 会构造前缀和 `s[i]=s[i-1]+a[i]`
- 会算区间和 `sum(l,r)=s[r]-s[l-1]`
## 练习
- P8218 求区间和前缀和基础https://www.luogu.com.cn/problem/P8218
## 提交要求
- 笔记写:下标偏移是怎么处理的(从 1 开始更方便)
',4,'course:cpp-basic:19',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-19-prefix-sum');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-19-prefix-sum'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-19-prefix-sum'),'prefix-sum');
INSERT INTO problems(slug,title,statement_md,difficulty,source,created_at) VALUES('cpp-basic-20-simulation','C++基础20模拟题与综合复盘','# C++基础20模拟题与综合复盘
## 学习目标
- 学会按题意一步步做(模拟)
- 复盘:总结常见错误 + 常用模板
## 练习(从这里选 3~5 题做小测)
- P1957 口算练习题 https://www.luogu.com.cn/problem/P1957
- P1055 ISBN号码 https://www.luogu.com.cn/problem/P1055
- P2433 小学数学N合一回顾https://www.luogu.com.cn/problem/P2433
## 提交要求
- 笔记写:
1) 你最常犯的 3 类错误
2) 你最常用的 5 行代码模板
3) 下周你准备怎么练
',4,'course:cpp-basic:20',1771241843) ON CONFLICT(slug) DO UPDATE SET title=excluded.title, statement_md=excluded.statement_md, difficulty=excluded.difficulty, source=excluded.source;
DELETE FROM problem_tags WHERE problem_id=(SELECT id FROM problems WHERE slug='cpp-basic-20-simulation');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-20-simulation'),'cpp-basic');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-20-simulation'),'simulation');
INSERT OR IGNORE INTO problem_tags(problem_id,tag) VALUES((SELECT id FROM problems WHERE slug='cpp-basic-20-simulation'),'review');
COMMIT;