![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT题集
等我学会后缀自动机
侠影之谜
展开
-
1100 Mars Numbers (20 分)
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long longconst int maxn=1e4+10;#define pii pa...原创 2019-09-08 07:24:06 · 151 阅读 · 0 评论 -
1105 Spiral Matrix
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e6+10;int n,a[maxn],b[maxn];int l,r;void solve(int x1,int y1,int x2,int y2){ ...原创 2019-09-04 21:17:58 · 118 阅读 · 0 评论 -
1104 Sum of Number Segments
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e5+10;int n;double a[maxn],ans=0;int main(){ scanf("%d",&n); rep(i,0...原创 2019-09-04 20:21:31 · 111 阅读 · 0 评论 -
1127 ZigZagging on a Tree
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=200;int n;int post[maxn],ind[maxn];vector<int> g[maxn];vector<int> a...原创 2019-09-04 20:03:57 · 106 阅读 · 0 评论 -
1126 Eulerian Path
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e3;int m,n,x,y,flag=1;int d[maxn],vis[maxn];int cnt=0;vector<int> g[maxn]...原创 2019-09-04 19:46:54 · 192 阅读 · 1 评论 -
1125 Chain the Ropes
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e4;int m,n,s;double a[maxn];int main(){ cin>>n; rep(i,0,n) cin>...原创 2019-09-04 19:33:49 · 82 阅读 · 0 评论 -
1124 Raffle for Weibo Followers
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e4;int m,n,s;string a[maxn];int vis[maxn];map<string,int> mp;int main(){...原创 2019-09-04 19:25:54 · 74 阅读 · 0 评论 -
1130 Infix Expression 25
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-04 01:45:16 · 114 阅读 · 0 评论 -
1129 Recommendation System
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-04 01:28:29 · 122 阅读 · 0 评论 -
1128 N Queens Puzzle (20 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-04 00:47:19 · 98 阅读 · 0 评论 -
1103 Integer Factorization (30 分) 搜索+剪枝 好题
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-04 00:27:31 · 126 阅读 · 0 评论 -
1135 Is It A Red-Black Tree (30 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-02 10:38:26 · 103 阅读 · 0 评论 -
1102 Invert a Binary Tree (25 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-09-01 21:02:57 · 87 阅读 · 0 评论 -
1134 Vertex Cover (25 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-08-31 17:07:31 · 159 阅读 · 0 评论 -
1133 Splitting A Linked List (25 分) 重点记录,,,,,,智障了
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-08-31 16:53:02 · 261 阅读 · 1 评论 -
1119 Pre- and Post-order Traversals
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=100+10;int n,a[maxn],b[maxn];int nxt[maxn][...原创 2019-09-05 20:38:06 · 114 阅读 · 0 评论 -
1120 Friend Numbers
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=10000+10;int n,x,a[maxn];set<int> st;...原创 2019-09-05 20:39:05 · 172 阅读 · 0 评论 -
1108 Finding Average
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long longconst int maxn=1e4+10;#define pii pa...原创 2019-09-07 15:49:07 · 142 阅读 · 0 评论 -
1112 Stucked Keyboard
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long longconst int maxn=1e4+10;#define pii pa...原创 2019-09-07 15:25:55 · 131 阅读 · 0 评论 -
1111 Online Map
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long longconst int maxn=1e4+10;#define pii pa...原创 2019-09-07 14:14:27 · 89 阅读 · 0 评论 -
1116 Come on! Let's C
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define ll long longconst int maxn=1e4+10;int n,x;map<int,int> mp;int vis[maxn];int ju...原创 2019-09-07 11:44:41 · 125 阅读 · 0 评论 -
1115 Counting Nodes in a BST二叉排序树
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define ll long longconst int maxn=1e4+10;int n,tot=0,x,dat[maxn],L[maxn],R[maxn];void Insert(...原创 2019-09-07 11:16:44 · 83 阅读 · 0 评论 -
1117 Eddington Number
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);i++)#define ll long longconst int maxn=1e5+10;int n,a[maxn],cnt=0;int main(){ cin>>n; ...原创 2019-09-07 10:59:54 · 141 阅读 · 0 评论 -
1114 Family Property
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)#define fi first#define se second#define mk(x,y) make_pair...原创 2019-09-06 21:21:07 · 92 阅读 · 0 评论 -
1113 Integer Set Partition
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)#define fi first#define se second#define mk(x,y) make_pair...原创 2019-09-06 20:11:43 · 85 阅读 · 0 评论 -
1110 Complete Binary Tree
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)#define fi first#define se second#define mk(x,y) make_pair...原创 2019-09-06 19:38:17 · 199 阅读 · 0 评论 -
1109 Group Photo
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)#define fi first#define se second#define mk(x,y) make_pair...原创 2019-09-06 18:46:32 · 102 阅读 · 0 评论 -
1107 Social Clusters
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e3+10;int n,k,x;int fa[maxn],cnt[maxn];ve...原创 2019-09-06 16:03:33 · 92 阅读 · 0 评论 -
1106 Lowest Price in Supply Chain
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e5+10;int n,dep[maxn],ub=-1,h=maxn,cnt[maxn...原创 2019-09-06 15:25:05 · 96 阅读 · 0 评论 -
1122 Hamiltonian Cycle
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=500;int n,m,x,y,k,tmp;int vis[maxn],rou[max...原创 2019-09-05 21:12:02 · 88 阅读 · 0 评论 -
1121 Damn Single
#include<bits/stdc++.h>using namespace std;#define mst(x,y) memset(x,y,sizeof(x))#define rep(x,y,z) for(int x=(y);(x)<(z);x++)const int maxn=1e5;int a[maxn];int n,x,y;vector<int>...原创 2019-09-05 20:53:03 · 110 阅读 · 0 评论 -
1132 Cut Integer (20 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-08-31 14:52:37 · 99 阅读 · 0 评论 -
1140 Look-and-say Sequence (20 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt in...原创 2019-08-18 10:29:28 · 91 阅读 · 0 评论 -
1154 Vertex Coloring (25 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt in...原创 2019-08-07 20:29:37 · 148 阅读 · 0 评论 -
1010 Radix (25 分) 二分 终于遇到个算法题
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt int...原创 2019-08-13 13:03:37 · 144 阅读 · 0 评论 -
1153 Decode Registration Card of PAT (25 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt in...原创 2019-08-08 11:58:57 · 351 阅读 · 0 评论 -
1155 Heap Paths (30 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define ull unsigned long long#define lrt in...原创 2019-08-05 21:16:08 · 95 阅读 · 0 评论 -
1077 Kuchiguse (20 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l...原创 2019-07-23 19:54:47 · 114 阅读 · 0 评论 -
1076 Forwards on Weibo (30 分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805392092020736#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(...原创 2019-07-23 19:04:12 · 78 阅读 · 0 评论 -
1099 Build A Binary Search Tree (30 分)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l...原创 2019-07-23 18:26:30 · 130 阅读 · 0 评论