Ai
1 Star 0 Fork 0

水兵/cpu-code

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
Your Name 提交于 2021-10-18 10:55 +08:00 . analysize
#include<bits/stdc++.h>
#include"graph.h"
#include"BFC-VP++/BFC-VP++.h"
using namespace std;
#define For(i, l, r) for(int i = l; i <= r; i++)
void check(graph& g, int nodeBegin, int nodeEnd) {
//upBound = 2;
printf("----------check------------\n");
if (nodeEnd == -1) nodeEnd = g.vertexCount - 1;
long long ds = 0;
For(node, 0, nodeEnd) {
vector<int> lst;
For(i, g.beginPos[node], g.beginPos[node + 1] - 1) {
int v = g.edgeList[i];
int vv = min(node, v);
For(j, g.beginPos[v], g.beginPos[v + 1] - 1) {
if (g.edgeList[j] < vv) lst.push_back(g.edgeList[j]);
else break;
}
}
sort(lst.begin(), lst.end());
int tmp = -1;
int n = lst.size();
long long s = 0;
For(i, 0, n - 1) {
if (lst[i] != tmp) {
//if (tmp != -1) printf("%d %d\n", tmp, s);
tmp = lst[i];
ds += s * (s - 1) / 2;
s = 1;
}else{
s++;
}
}
if (node == 23141){
printf("%d\n", s * (s - 1) / 2);
}
ds += s * (s - 1) / 2;
}
printf("total butterfly is %lld\n", ds);
printf("-----------------------\n");
}
int main(int argc, char* argv[]){
if (strcmp("run", argv[2]) == 0){
res re = test(argv[1], atoi(argv[3]), atoi(argv[5]));
fstream fp = fstream("ans.out", ios::app);
fp << argv[4] << "," << re.ans << "," << re.totalTime << "," << re.calcTime << endl;
fp.close();
}
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Shbinging/cpu-code.git
git@gitee.com:Shbinging/cpu-code.git
Shbinging
cpu-code
cpu-code
master

搜索帮助