equal/solve.hpp
2022-10-25 18:36:19 +08:00

32 lines
735 B
C++

#pragma once
#include <bits/stdc++.h>
#include "ipasir.h"
class Graph {
public:
struct Edge {
int from;
int to;
int neg;
};
std::vector<std::vector<Edge>> edge;
std::vector<std::vector<Edge>> redge;
void add(int u, int v, int w) {
edge.resize(std::max(std::max(u, v)+1, (int)edge.size()));
redge.resize(std::max(std::max(u, v)+1, (int)redge.size()));
edge[u].push_back(Edge{u, v, w});
redge[v].push_back(Edge{v, u, w});
}
}graph;
std::map<int, int> topo_index;
std::set<std::pair<int, int>> eqp;
std::set<int> eqn;
std::vector<std::pair<int, int>> eqs;
std::vector<std::vector<int>> classes;
std::vector<std::pair<int, std::pair<int, int>> > pairs;