![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
momomomoy
这个作者很懒,什么都没留下…
展开
-
1076 Forwards on Weibo测试点4
用了queue.size()导致测试点4过不去; int bfs(int root){ queue<int> q; bool visit[1010]={false}; int cnt; visit[root]=true; for(int i=0;i<list[root].size();i++) q.push(list[root][i]); int num=q.size(),templ=0; while(q.empty() != 1 &原创 2020-12-02 20:59:04 · 263 阅读 · 0 评论 -
1154 Vertex Coloring (25分)
定义一个关于边的结构体,在遍历的时候只需要一遍循环就行 struct node{ int a,b; }e[10010];原创 2020-10-05 18:56:20 · 100 阅读 · 0 评论 -
1142 Maximal Clique (25分)函数内部初始化问题
一开始没有将for循环里面的visit初始化,然后一直找不到错误,初始化一下就AC了 #include<iostream> using namespace std; bool a[210][210]; int main(){ int n,m,x,y,k,t,temp,isnotclique,isnotmaxclique; scanf("%d %d",&n,&m); for(int i=0;i<m;i++){ scanf("%d %d"原创 2020-08-25 00:11:40 · 129 阅读 · 0 评论 -
1077 Kuchiguse (20分)
字符串空格处理问题; 当需要读取含有空格的string时 1)使用getline(cin,s); 2)在读取数字的后面加上getchar(); #include<iostream> #include<stdio.h> #include<vector> #include <algorithm> using namespace std; vector <string> v; int main(){ int n,f,pos=0,j,u;原创 2020-08-09 19:47:45 · 71 阅读 · 0 评论 -
1121 Damn Single (25分) 测试点2 和测试点4
测试点2:问题主要是和0是伴侣的时候,可能出错; 测试点4:输出保持5位 #include<iostream> #include<unordered_map> #include<vector> #include<set> using namespace std; unordered_map <int ,int> mpp, mpp2; set <int> st; vector<int> v; int main(){ i原创 2020-08-07 15:22:46 · 257 阅读 · 0 评论 -
1118. Birds in Forest并查集
1118. Birds in Forest 这里会出现的问题主要是当出现3段的时候,例如: ① 1 2 3 ② 4 5 6 ③ 3 7 4 的时候Hash会误将这个当成两棵树,而出现问题。转载 2020-08-05 15:17:31 · 81 阅读 · 0 评论