Skip to content

Commit

Permalink
Add random stuff from ckiseki
Browse files Browse the repository at this point in the history
  • Loading branch information
baluteshih committed Oct 20, 2023
1 parent 80da639 commit 8f2d39f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions codebook/9_Else/BitsetLCS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cin >> n >> m;
for (int i = 1, x; i <= n; ++i)
cin >> x, p[x].set(i);
for (int i = 1, x; i <= m; i++) {
cin >> x, (g = f) |= p[x];
f.shiftLeftByOne(), f.set(0);
((f = g - f) ^= g) &= g;
}
cout << f.count() << '\n';
16 changes: 16 additions & 0 deletions codebook/9_Else/NQueens.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
void solve(vector<int> &ret, int n) { // no sol when n=2,3
if (n % 6 == 2) {
for (int i = 2; i <= n; i += 2) ret.push_back(i);
ret.push_back(3); ret.push_back(1);
for (int i = 7; i <= n; i += 2) ret.push_back(i);
ret.push_back(5);
} else if (n % 6 == 3) {
for (int i = 4; i <= n; i += 2) ret.push_back(i);
ret.push_back(2);
for (int i = 5; i <= n; i += 2) ret.push_back(i);
ret.push_back(1); ret.push_back(3);
} else {
for (int i = 2; i <= n; i += 2) ret.push_back(i);
for (int i = 1; i <= n; i += 2) ret.push_back(i);
}
}
4 changes: 4 additions & 0 deletions codebook/content.tex
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ \subsection{Binary Search On Fraction}
\lstinputlisting{9_Else/BinarySearchOnFraction.cpp}
\subsection{Min Plus Convolution*} % test by Library Checker Min Plus Convolution (Convex and Arbitrary)
\lstinputlisting{9_Else/min_plus_convolution.cpp}
\subsection{Bitset LCS}
\lstinputlisting{9_Else/BitsetLCS.cpp}
\subsection{N Queens Problem}
\lstinputlisting{9_Else/NQueens.cpp}
\section{Python}
\subsection{Misc}
\lstinputlisting[language=Python]{11_Python/misc.py}

0 comments on commit 8f2d39f

Please sign in to comment.