Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecube8152 committed Feb 24, 2024
1 parent 2468bcb commit 2ca5d92
Show file tree
Hide file tree
Showing 30 changed files with 797 additions and 860 deletions.
68 changes: 67 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,72 @@
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp"
"vector": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"atomic": "cpp",
"barrier": "cpp",
"bit": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"cstdint": "cpp",
"cuchar": "cpp",
"set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ratio": "cpp",
"source_location": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"latch": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"scoped_allocator": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"syncstream": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
Codebook of NTU RngBased forked from 8BQube

[Overview](./codebook/overview.md)
[Codebook](./codebook/codebook.pdf)
[Codebook](./codebook/codebook.pdf)

TODO:
- Treap
- Hopcroft-Karp
- Minkowski Sum
- Line Sorter O(N^2 log N)
- SCC
24 changes: 0 additions & 24 deletions codebook/10_JAVA/Big_number.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion codebook/1_Basic/.vimrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sy on
set ru nu cin cul sc so=3 ts=4 sw=4 bs=2 ls=2 mouse=a
inoremap {<CR> {<CR>}<C-o>O
map <F7> :w<CR>:!g++ "%" -Wall -Wextra -Wshadow -Wconversion -fsanitize=address,=undefined -D_GLIBCXX_DEBUG && ./a.out<CR>
map <F7> :w<CR>:!g++ "%" -std=c++17 -Wall -Wextra -Wshadow -Wconversion -fsanitize=address,undefined -g && ./a.out<CR>
2 changes: 1 addition & 1 deletion codebook/1_Basic/PBDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
__gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq;
__gnu_pbds::priority_queue<int, greater<int>, thin_heap_tag> pq;
37 changes: 4 additions & 33 deletions codebook/2_Graph/MinimumMeanCycle.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
#include "common.h"
ll road[N][N]; // input here
struct MinimumMeanCycle {
ll dp[N + 5][N], n;
pll solve() {
ll a = -1, b = -1, L = n + 1;
for (int i = 2; i <= L; ++i)
for (int k = 0; k < n; ++k)
for (int j = 0; j < n; ++j)
dp[i][j] =
min(dp[i - 1][k] + road[k][j], dp[i][j]);
for (int i = 0; i < n; ++i) {
if (dp[L][i] >= INF) continue;
ll ta = 0, tb = 1;
for (int j = 1; j < n; ++j)
if (dp[j][i] < INF &&
ta * (L - j) < (dp[L][i] - dp[j][i]) * tb)
ta = dp[L][i] - dp[j][i], tb = L - j;
if (ta == 0) continue;
if (a == -1 || a * tb > ta * b) a = ta, b = tb;
}
if (a != -1) {
ll g = __gcd(a, b);
return pll(a / g, b / g);
}
return pll(-1LL, -1LL);
}
void init(int _n) {
n = _n;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) dp[i + 2][j] = INF;
}
};

/* O(V^3)
let dp[i][j] = min length from 1 to j exactly i edges
ans = min (dp[n + 1][u] - dp[i][u]) / (n + 1 - i) */
2 changes: 1 addition & 1 deletion codebook/2_Graph/MinimumSteinerTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct SteinerTree { // 0-base
}
int solve(const vector<int>& ter) {
shortest_path();
int t = SZ(ter), full = (1 << t) - 1;
int t = ter.size(), full = (1 << t) - 1;
for (int i = 0; i <= full; ++i)
fill_n(dp[i], n, INF);
copy_n(vcst, n, dp[0]);
Expand Down
39 changes: 0 additions & 39 deletions codebook/2_Graph/Minimum_Arborescence_fast.cpp

This file was deleted.

66 changes: 0 additions & 66 deletions codebook/3_Data_Structure/KDTree.cpp

This file was deleted.

Loading

0 comments on commit 2ca5d92

Please sign in to comment.