摘要: 题目来源:https://www.luogu.com.cn/problem/P4398 两种做法:1动态规划,2哈希 1动态规划:关联题目https://www.luogu.com.cn/problem/P1387(最大正方形) | 1 | 0 | | -- -- | -- -- | | 0 | 1 阅读全文
posted @ 2025-07-16 13:45 yubai111 阅读(10) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P4310 int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int n; cin >> n; int res = 0; for (int i = 1; i 阅读全文
posted @ 2025-07-15 22:16 yubai111 阅读(10) 评论(0) 推荐(0)
摘要: 题集导航:https://codeforces.com/gym/105887 ` define int long long using namespace std; int res = 0; int idx = 0; int usenum[400100]; int copynum[400100]; 阅读全文
posted @ 2025-07-15 22:09 yubai111 阅读(7) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1381 ` define int long long const int P = 131; const int MOD = 9988234; unordered_map<int, int>words; unordered 阅读全文
posted @ 2025-07-15 12:27 yubai111 阅读(8) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1955 ` define int long long int p[1000010]; bool haveans = 0; const int MOD = 998823; int find(int x) { if (x ! 阅读全文
posted @ 2025-07-14 15:47 yubai111 阅读(57) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P13099 ` define int long long typedef pair<int, int> PII; vector poi[200010]; // 邻接表存储树 int deepnum[200010]; // 阅读全文
posted @ 2025-07-11 15:25 yubai111 阅读(12) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P5461 ` int mp[1030][1030]; int k; int k1; void jisuan(int startn,int starn,int k) { if (k < 0) { return; } for 阅读全文
posted @ 2025-05-08 19:21 yubai111 阅读(26) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1106 ` struct NUM { int num; int i; }nums[250]; bool cmp(const NUM& i, const NUM& j) { if (i.num < j.num) { ret 阅读全文
posted @ 2025-05-08 16:43 yubai111 阅读(20) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1162 bfs水题,把1和其包围圈视为一个整体,对其周围“注水”。 第一次提交过了两个测试点,查询后发现在bfs函数中 void bfs(int x, int y) { q.push({ 0,0 }); while (! 阅读全文
posted @ 2025-04-28 19:55 yubai111 阅读(16) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1135 ` typedef pair<int, int>Pi; int N, A, B;bool hs[201]; int K[250];queueq; int bfs(int nown, int fn) { q.pus 阅读全文
posted @ 2025-04-28 19:17 yubai111 阅读(12) 评论(0) 推荐(0)