摘要: 关于STL容器的一些技巧 今天写一道题,发现了STL的自定义cmp函数实际上是一个效率很低的东西。如果能够用基本变量的自然顺序作为容器的比较器,就不要写cmp函数。 例如,对于有序序列查询<=x的最大数和<x的最大数,我们可以这样实现: struct cmp{ bool operator()(con 阅读全文
posted @ 2021-04-09 20:56 popozyl 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 字符串构造,思维 - Codeforces Problem 1506 G - Maximize the Remaining String 本题做法相对暴力,但是还是应该学习其STL的用法、构造思路。 count_unique(string s)函数为离散化函数,用于统计字符串s中不重复字符的数量。 阅读全文
posted @ 2021-04-09 19:23 popozyl 阅读(49) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 20+5; int t; int inf; int maxlen; int m, n; char a[N], b[N]; int dp[N][N][N]; // dp[i][j][ 阅读全文
posted @ 2021-04-09 08:16 popozyl 阅读(66) 评论(0) 推荐(0) 编辑