Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 1124
Browse files Browse the repository at this point in the history
  • Loading branch information
maspypy committed May 21, 2024
2 parents 025ed63 + 10d33a1 commit 238f5ce
Show file tree
Hide file tree
Showing 37 changed files with 6,423 additions and 6,206 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/all-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
include:
- os: ubuntu-latest
cxx: g++-12
- os: ubuntu-latest
- os: ubuntu-24.04
cxx: g++-13
- os: macos-latest
cxx: clang++
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cpp-lib-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
util-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: run unittest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Dispatch Problems Deploy
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.JUDGE_REPO_TOKEN }}
repository: yosupo06/library-checker-judge
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/diff-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
include:
- os: ubuntu-latest
cxx: g++-12
- os: ubuntu-latest
- os: ubuntu-24.04
cxx: g++-13
- os: macos-latest
cxx: clang++
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
generate:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -41,7 +41,7 @@ jobs:
pip install --user -r requirements.txt
- name: Restore versions.json
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
if: ${{ !inputs.force-generate }}
with:
path: versions.json
Expand All @@ -60,7 +60,7 @@ jobs:
VERSIONS_CACHE_PATH: versions.json

- name: Save versions.json
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: versions.json
key: ${{ runner.os }}-(${{ inputs.cxx }})-versions-cache-${{ hashFiles('versions.json') }}
4 changes: 2 additions & 2 deletions .github/workflows/util_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
util-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
Expand Down
27 changes: 13 additions & 14 deletions datastructure/range_reverse_range_sum/sol/correct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

using ll = long long;
using u64 = std::uint_fast64_t;
using std::move;
std::mt19937_64 rng(0x1757C90436F3E0B3);

struct node;
Expand Down Expand Up @@ -47,15 +46,15 @@ std::pair<ptr, ptr> split(ptr p, int i) {
push(p);
const int s = size(p->l);
if (s >= i) {
auto [l, r] = split(move(p->l), i);
p->l = move(r);
auto [l, r] = split(std::move(p->l), i);
p->l = std::move(r);
update(p);
return {move(l), move(p)};
return {std::move(l), std::move(p)};
} else {
auto [l, r] = split(move(p->r), i - s - 1);
p->r = move(l);
auto [l, r] = split(std::move(p->r), i - s - 1);
p->r = std::move(l);
update(p);
return {move(p), move(r)};
return {std::move(p), std::move(r)};
}
}

Expand All @@ -66,12 +65,12 @@ ptr merge(ptr l, ptr r) {
return l;
if (l->pri < r->pri) {
push(r);
r->l = merge(move(l), move(r->l));
r->l = merge(std::move(l), std::move(r->l));
update(r);
return r;
} else {
push(l);
l->r = merge(move(l->r), move(r));
l->r = merge(std::move(l->r), std::move(r));
update(l);
return l;
}
Expand All @@ -84,19 +83,19 @@ int main() {
for (int i = 0; i < N; i++) {
int a;
scanf("%d", &a);
root = merge(move(root), std::make_unique<node>(a));
root = merge(std::move(root), std::make_unique<node>(a));
}
for (int j = 0; j < Q; j++) {
int t, l, r;
scanf("%d%d%d", &t, &l, &r);
auto [xy, z] = split(move(root), r);
auto [x, y] = split(move(xy), l);
auto [xy, z] = split(std::move(root), r);
auto [x, y] = split(std::move(xy), l);
if (t == 0) {
rev(y);
} else {
printf("%lld\n", sum(y));
}
xy = merge(move(x), move(y));
root = merge(move(xy), move(z));
xy = merge(std::move(x), std::move(y));
root = merge(std::move(xy), std::move(z));
}
}
32 changes: 32 additions & 0 deletions graph/cycle_detection/gen/long_cycle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <cstdio>
#include <vector>
#include <tuple>
#include <utility>
#include <algorithm>
#include "random.h"
#include "../params.h"

using namespace std;

int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto rnd = Random(seed);

int N = N_MAX;
int M = N;

vector<int> V(N);
for (int i = 0; i < N; ++i) V[i] = i;
rnd.shuffle(V.begin(), V.end());

vector<pair<int, int>> edges;
for (int v = 1; v < N; ++v) { edges.emplace_back(V[v - 1], V[v]); }
auto [i, j] = rnd.uniform_pair<int>(0, N - 1);
edges.emplace_back(V[j], V[i]);

rnd.shuffle(edges.begin(), edges.end());

printf("%d %d\n", N, M);
for (auto&& [a, b]: edges) { printf("%d %d\n", a, b); }
return 0;
}
4 changes: 4 additions & 0 deletions graph/cycle_detection/hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"example_01.out": "ee3aa64bb94a50845d5024cd4bd20202a4567aed5cd5328c0d97e9920775fc28",
"example_02.in": "7fc4e08f0e7caa09d4322952276eec9729d3985cc615b18c25c1f3b84932f784",
"example_02.out": "eaad3a2f70ee8a3f1eb73940351b981e6fdda8543c214c6d6d75fb02fc7c3b18",
"long_cycle_00.in": "a9bcccdba3b7e57b04e1a558e6bfcbf9f89d1f9d42d14ea82553597d321fc371",
"long_cycle_00.out": "8a226b0a04b9e5f195d7ca23c18419a3d07e2a8bb00411527600e5d9a18b708b",
"long_cycle_01.in": "569ba6e5e707b1b6f9b9617f72081879a402d6bfa9ba146cd18329378ab0cad3",
"long_cycle_01.out": "fd25aae90c172a228bdf37d2b65f570004c8388227a6a7904307e17109e05c1c",
"random_00.in": "0078f7d84452260de2f25f770b734fb9aa6bc8d10804c75861311b6c301d7ab7",
"random_00.out": "389f384ff63dd5e29ab49b01846cddf170c5bff6560857925d16fff12133a5c7",
"random_01.in": "63b264b9d4b3868c9c0258a8c566bbfb6edc311f19c49127e358de9115403c0a",
Expand Down
3 changes: 3 additions & 0 deletions graph/cycle_detection/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/534"
[[tests]]
name = "random_dag_dense.cpp"
number = 5
[[tests]]
name = "long_cycle.cpp"
number = 2

[[solutions]]
name = 'source_zero.cpp'
Expand Down
8 changes: 4 additions & 4 deletions graph/three_edge_connected_components/gen/random_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char* argv[]) {

const auto pop = [&](auto &v) {
swap(v.back(), v[gen.uniform<int>(0, v.size() - 1)]);
auto res = move(v.back());
auto res = std::move(v.back());
v.pop_back();
return res;
};
Expand Down Expand Up @@ -79,7 +79,7 @@ int main(int, char* argv[]) {
for (int i = 0; i != cn; i += 1) {
add_bb(cycle[i], cycle[(i + 1) % cn]);
}
c.push_back(move(sum));
c.push_back(std::move(sum));
}

const size_t c_lim = pow(c.size(), gen.uniform01()) + 0.5;
Expand All @@ -92,10 +92,10 @@ int main(int, char* argv[]) {
cat(sum, top);
}
add_bb(bridge[0], bridge[1]);
c.push_back(move(sum));
c.push_back(std::move(sum));
}

edges = move(edge_buf);
edges = std::move(edge_buf);
edge_buf.clear();

for (int i = 0; i != size; i += 1) {
Expand Down
8 changes: 4 additions & 4 deletions graph/three_edge_connected_components/gen/small_random_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char* argv[]) {

const auto pop = [&](auto &v) {
swap(v.back(), v[gen.uniform<int>(0, v.size() - 1)]);
auto res = move(v.back());
auto res = std::move(v.back());
v.pop_back();
return res;
};
Expand Down Expand Up @@ -82,7 +82,7 @@ int main(int, char* argv[]) {
for (int i = 0; i != cn; i += 1) {
add_bb(cycle[i], cycle[(i + 1) % cn]);
}
c.push_back(move(sum));
c.push_back(std::move(sum));
}

const size_t c_lim = pow(c.size(), gen.uniform01()) + 0.5;
Expand All @@ -95,10 +95,10 @@ int main(int, char* argv[]) {
cat(sum, top);
}
add_bb(bridge[0], bridge[1]);
c.push_back(move(sum));
c.push_back(std::move(sum));
}

edges = move(edge_buf);
edges = std::move(edge_buf);
edge_buf.clear();

for (int i = 0; i != size; i += 1) {
Expand Down
8 changes: 4 additions & 4 deletions graph/two_edge_connected_components/gen/random_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char* argv[]) {

const auto pop = [&](auto &v) {
swap(v.back(), v[gen.uniform<int>(0, v.size() - 1)]);
auto res = move(v.back());
auto res = std::move(v.back());
v.pop_back();
return res;
};
Expand Down Expand Up @@ -79,7 +79,7 @@ int main(int, char* argv[]) {
for (int i = 0; i != cn; i += 1) {
add_bb(cycle[i], cycle[(i + 1) % cn]);
}
c.push_back(move(sum));
c.push_back(std::move(sum));
}

const size_t c_lim = pow(c.size(), gen.uniform01()) + 0.5;
Expand All @@ -92,10 +92,10 @@ int main(int, char* argv[]) {
cat(sum, top);
}
add_bb(bridge[0], bridge[1]);
c.push_back(move(sum));
c.push_back(std::move(sum));
}

edges = move(edge_buf);
edges = std::move(edge_buf);
edge_buf.clear();

for (int i = 0; i != size; i += 1) {
Expand Down
8 changes: 4 additions & 4 deletions graph/two_edge_connected_components/gen/small_random_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char* argv[]) {

const auto pop = [&](auto &v) {
swap(v.back(), v[gen.uniform<int>(0, v.size() - 1)]);
auto res = move(v.back());
auto res = std::move(v.back());
v.pop_back();
return res;
};
Expand Down Expand Up @@ -82,7 +82,7 @@ int main(int, char* argv[]) {
for (int i = 0; i != cn; i += 1) {
add_bb(cycle[i], cycle[(i + 1) % cn]);
}
c.push_back(move(sum));
c.push_back(std::move(sum));
}

const size_t c_lim = pow(c.size(), gen.uniform01()) + 0.5;
Expand All @@ -95,10 +95,10 @@ int main(int, char* argv[]) {
cat(sum, top);
}
add_bb(bridge[0], bridge[1]);
c.push_back(move(sum));
c.push_back(std::move(sum));
}

edges = move(edge_buf);
edges = std::move(edge_buf);
edge_buf.clear();

for (int i = 0; i != size; i += 1) {
Expand Down
Loading

0 comments on commit 238f5ce

Please sign in to comment.