随笔分类 -  pat

摘要:#include <bits/stdc++.h> #define LOCAL using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { r 阅读全文
posted @ 2022-02-05 22:21 yys_c 阅读(61) 评论(0) 推荐(0)
摘要:最长连续回文子串,正反匹配最长公共连续子串 #include <bits/stdc++.h> #define LOCAL using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, co 阅读全文
posted @ 2022-02-05 11:01 yys_c 阅读(33) 评论(0) 推荐(0)
摘要:坑:路径后面车站多出来的车不能弥补前面的空缺 #include <bits/stdc++.h> #define LOCAL using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, c 阅读全文
posted @ 2022-02-05 10:27 yys_c 阅读(37) 评论(0) 推荐(0)
摘要:码农题 #include <bits/stdc++.h> #define LOCAL using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) 阅读全文
posted @ 2022-02-04 18:14 yys_c 阅读(22) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #define LOCAL using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { r 阅读全文
posted @ 2022-02-04 13:34 yys_c 阅读(26) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstring> using namespace std; const int N = 20; struct node{ int l, r, p; }tr[N]; int n; int q[N], tt = -1, hh; void trev( 阅读全文
posted @ 2021-08-09 18:59 yys_c 阅读(21) 评论(0) 推荐(0)
摘要:**题意:**给定一个序列A,给定一个序列B,在A中找到满足序列B的最长不下降子序列 **思路:**维护一个B的顺序表,以O(1)得到颜色之间的大小关系,LIS模板 #include<iostream> #include<vector> using namespace std; const int 阅读全文
posted @ 2021-07-02 11:19 yys_c 阅读(56) 评论(0) 推荐(0)
摘要:#include<iostream> #include<string> using namespace std; const int N = 100010; struct student{ string id, name; int grade; bool operator!=(const stude 阅读全文
posted @ 2021-07-01 22:58 yys_c 阅读(21) 评论(0) 推荐(1)
摘要:**题意:**给定起点和终点,给定无向图和每一条边的长度和花费,求出从起点到终点的最短距离,如果路径不唯一输出花费最少的那一条路径,并输出最短距离和花费。 **思路:**dijkstra模板题,在发现两个路径长度相同时,如果一条路的花费更少则需要更新花费和路径,图用邻接矩阵存,邻接表复杂度会高一些 阅读全文
posted @ 2021-06-27 14:32 yys_c 阅读(55) 评论(0) 推荐(0)
摘要:传送门 **题意:**给你一堆车的进出记录共N个(其中包含无效记录),再给K个询问,每一次给一个时间(时间是升序给出),输出此时有多少辆车在学校里,然后最后输出一下停车时间最长的车和它的时间,如果有多个,那么按字典序输出车牌号即可。 坑点: 一辆车可能会有多条进出记录,它的停车时间应该是合法等待时间 阅读全文
posted @ 2021-06-27 10:50 yys_c 阅读(63) 评论(0) 推荐(0)
摘要:开始觉得是个什么两次遍历法,后来发现是RMQ问题,可以选择线段树,树状数组,ST表三种 再看数据范围:\(N <= 10^5\) 线段树/树状数组:\(O(nlogn)\) ST表:\(O(n)\) #include<iostream> #include<cmath> #include<vector 阅读全文
posted @ 2020-10-01 10:13 yys_c 阅读(92) 评论(0) 推荐(0)
摘要:看见顶点涂色,还以为要dfs啥的,没想到就是简单模拟,散列表是手动模拟的没用unordered_map #include<iostream> #include<cstring> using namespace std; const int N = 10010, M = 20003; struct{ 阅读全文
posted @ 2020-09-30 14:25 yys_c 阅读(103) 评论(0) 推荐(0)
摘要:纯模拟,没有注意性质,插入排序的性质:排过序的部分A和为排过序的部分B,A升序,B和原序列一样。 所以可以先简单判断是不是插入排序,然后再求一个下一步就可以了 #include<iostream> using namespace std; const int N = 110; int a[N], b 阅读全文
posted @ 2020-09-30 13:27 yys_c 阅读(129) 评论(0) 推荐(0)
摘要:#include<iostream> #include<vector> using namespace std; const int N = 1010; int heap[N]; int n, flag; int isMax, isMin; vector<int> ans; void dfs(int 阅读全文
posted @ 2020-09-22 13:50 yys_c 阅读(141) 评论(0) 推荐(0)
摘要:之前写的floyd被卡了????? 心态炸裂之dijkstra #include<iostream> #include<cstring> using namespace std; const int N = 510; int g[N][N], cnt[N], nums[N], dist[N], w[ 阅读全文
posted @ 2020-09-08 15:19 yys_c 阅读(133) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> using namespace std; const int N = 200010; int cnt; int n, m; long a[N], b[N]; int main(){ scanf("%d", &n); for(in 阅读全文
posted @ 2020-09-08 12:16 yys_c 阅读(102) 评论(0) 推荐(0)
摘要:高精加 #include<iostream> #include<vector> #include<algorithm> using namespace std; int check(vector<int> &a){ int l = 0, r = a.size() - 1; while(l < r){ 阅读全文
posted @ 2020-08-03 22:32 yys_c 阅读(95) 评论(0) 推荐(0)
摘要:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135 阅读全文
posted @ 2020-08-03 18:06 yys_c 阅读(142) 评论(0) 推荐(0)
摘要:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years 阅读全文
posted @ 2020-08-02 22:10 yys_c 阅读(132) 评论(0) 推荐(0)
摘要:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2020-08-02 09:53 yys_c 阅读(130) 评论(0) 推荐(0)