Skip to content

Commit

Permalink
make unionfind to use param
Browse files Browse the repository at this point in the history
  • Loading branch information
yosupo06 committed Nov 8, 2023
1 parent 99487e3 commit 751812a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions datastructure/unionfind/gen/path.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "random.h"
#include "../params.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
Expand All @@ -10,8 +11,8 @@ int main(int, char *argv[]) {
const long long seed = std::atoll(argv[1]);
Random gen(seed);

const int N = 200000;
const int Q = 200000;
const int N = N_MAX;
const int Q = Q_MAX;

assert(N == Q);

Expand Down
5 changes: 3 additions & 2 deletions datastructure/unionfind/gen/random.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>
#include "random.h"
#include "../params.h"

using namespace std;

Expand All @@ -8,8 +9,8 @@ int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);

int n = gen.uniform(1, 200000);
int q = gen.uniform(1, 200000);
int n = gen.uniform<int>(1, N_MAX);
int q = gen.uniform<int>(1, Q_MAX);
printf("%d %d\n", n, q);
for (int i = 0; i < q; i++) {
int ty = gen.uniform_bool();
Expand Down
4 changes: 4 additions & 0 deletions datastructure/unionfind/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ forum = 'https://github.com/yosupo06/library-checker-problems/issues/33'
[[tests]]
name = "path.cpp"
number = 4

[params]
N_MAX = 200_000
Q_MAX = 200_000
4 changes: 2 additions & 2 deletions datastructure/unionfind/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ $N$ 頂点 $0$ 辺の無向グラフに $Q$ 個のクエリが飛んできます

## @{keyword.constraints}

- $1 \leq N \leq 200,000$
- $1 \leq Q \leq 200,000$
- $1 \leq N \leq @{param.N_MAX}$
- $1 \leq Q \leq @{param.Q_MAX}$
- $0 \leq u_i, v_i \lt N$

## @{keyword.input}
Expand Down

0 comments on commit 751812a

Please sign in to comment.