summaryrefslogtreecommitdiff
path: root/test/math/minMod.cpp
AgeCommit message (Expand)Author
2024-09-08add min mod (mimumum of linear function modulo m)Lucas Schwebler
n16' href='#n16'>16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#include "../util.h"
constexpr ll INF = LL::INF;
struct edge {
	int from, to;
	ll cost;
};
#include <graph/bellmannFord.cpp>
namespace floydWarshall {
#include <graph/floydWarshall.cpp>
}

void stress_test() {
	ll queries = 0;
	for (int tries = 0; tries < 100'000; tries++) {
		int n = Random::integer<int>(2, 30);
		int m = Random::integer<int>(n-1, max<int>(n, min<int>(500, n*(n-1) / 2 + 1)));
		vector<ll> potential = Random::integers<ll>(n, 0, 1'000'000'000'000ll);

		vector<edge> edges;
		floydWarshall::dist.assign(n, vector<ll>(n, INF));