Skip to content

Commit

Permalink
Merge branch 'yosupo06:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maspypy authored Aug 1, 2023
2 parents a6dc8ed + 2818383 commit 4d6e298
Show file tree
Hide file tree
Showing 35 changed files with 716 additions and 137 deletions.
2 changes: 1 addition & 1 deletion common/testlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -3049,7 +3049,7 @@ void InStream::xmlSafeWrite(std::FILE *file, const char *msg) {
std::fprintf(file, "%s", """);
continue;
}
if (0 <= msg[i] && msg[i] <= 31) {
if (msg[i] <= 31) { // modified for library-checker
std::fprintf(file, "%c", '.');
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
Expand Down
47 changes: 47 additions & 0 deletions graph/bipartitematching/gen/kuhn_killer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <iostream>
#include <set>

#include "random.h"
#include "../params.h"

using namespace std;

// https://codeforces.com/blog/entry/58048?#comment-417533
int main() {
int n = min(L_MAX, R_MAX);
int k = n / 8 * 2;

using P = pair<int, int>;
vector<P> edges;
for(int i = 0; i < k; i++) {
edges.emplace_back(i, i);
}
for(int i = 0; i < k - 1; i++) {
edges.emplace_back(i+1, i);
}
for(int i = 0; i < k / 2; i++) {
edges.emplace_back(i, k+2*i);
edges.emplace_back(2*k+2*i, k+2*i);
edges.emplace_back(2*k+2*i, 3*k+2*i);
edges.emplace_back(k+2*i, i);
edges.emplace_back(k+2*i, 2*k+2*i);
edges.emplace_back(3*k+2*i, 2*k+2*i);
}
for(int j = 0; j < k / 2; j++) {
int i = k/2-1-j;
edges.emplace_back(k/2+j, k+2*i+1);
edges.emplace_back(2*k+2*i+1, k+2*i+1);
edges.emplace_back(2*k+2*i+1, 3*k+2*i+1);
edges.emplace_back(k+2*i+1, k/2+j);
edges.emplace_back(k+2*i+1, 2*k+2*i+1);
edges.emplace_back(3*k+2*i+1, 2*k+2*i+1);
}

int m = int(edges.size());

printf("%d %d %d\n", n, n, m);
for (auto edge: edges) {
printf("%d %d\n", edge.first, edge.second);
}
return 0;
}
2 changes: 2 additions & 0 deletions graph/bipartitematching/hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"cycle_01.out": "61bf446b23a4128b7939650819761c10e1e111fdf644d440a2a8fc58f923905b",
"example_00.in": "8e14807ee203e49dde929bb92a04f1536a744b10e6dfd233b68fc4f19db57a71",
"example_00.out": "d316870aa467c52e802c0b1c7bbf0a301ee0be2b5f6805859910d36727933338",
"kuhn_killer_00.in": "e8ab878ceaa36de73750dc9599080d7864585c77fd1546cf9431223d7b64e790",
"kuhn_killer_00.out": "c982d8a1164805c36b2bada6b78835990b131177c2344c4be9a4d85edf94dbfe",
"line_00.in": "918e562d05cac133df5f6284b257b04c4edf25ab3c732f49aa11e13b648f9c54",
"line_00.out": "4804e0bade8d81737542707d6229f138a2650064ee1f630266da890d1524914a",
"line_01.in": "4f49760ff181162f05410f1a188b51f4199b0a0fe6a321b266e3430ff6ffb809",
Expand Down
3 changes: 3 additions & 0 deletions graph/bipartitematching/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/37"
[[tests]]
name = "line.cpp"
number = 2
[[tests]]
name = "kuhn_killer.cpp"
number = 1
[[tests]]
name = "many_smalls.cpp"
number = 2
Expand Down
29 changes: 29 additions & 0 deletions math/convolution_mod/gen/signed_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD/2 - 1;
unsigned long long max_ll = numeric_limits<long long>::max();

// Find smallest size n where n * val * val > max_ll
int n = 0;
for (unsigned long long res = 0; res <= max_ll; res += (long long) val * val, ++n);

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}
34 changes: 34 additions & 0 deletions math/convolution_mod/gen/unsigned_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD - 2;

// Find smallest size n where n * val * val > numeric_limits<unsigned long long>::max()
int n = 0;
unsigned long long res = 0;
long long val2 = (long long) val * val;
while (res + val2 >= res) // Check if adding val2 to res will overflow
{
res += val2;
++n;
}

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}
6 changes: 5 additions & 1 deletion math/convolution_mod/hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"random_01.out": "501fb137b66268875f46296bb517b8c60fb9cba1b1819ec7804001e87b69aea6",
"random_02.in": "ee0133be91e17cc3f84550e426c255736746029ba78b178b99d1cb1ee30fcf1c",
"random_02.out": "8830adf5e75c568eb55b03ba14744bec8e8458a5d30dc945999475166422ce3f",
"signed_overflow_00.in": "4224cd34b6f1f3ee6713e3228395c11333c067d6066612e69f3c0489bdee3b70",
"signed_overflow_00.out": "d314fa573547dda0f41b683921221a2549643b231de42cf0f1b7766db3045c73",
"small_00.in": "ac1b0c7c78c8a8de70b5dc028a11fddd30d8de6dd399b0475e0f84deaddc5816",
"small_00.out": "b086d8c94719f50a63743fbba701b852975a768400520b3285f0855ab77882a8",
"small_01.in": "387fe0d406947ba770dcfc76f8285a94c58aae1a0f3c4d5477755c7bae83faae",
Expand Down Expand Up @@ -68,5 +70,7 @@
"small_14.in": "a377535ad3941915624588159bc4b5065f909f93b9bb9766d69b1ab1d6756d43",
"small_14.out": "85c3fd86c69853bf54cccdf37c0a343d14850bdbd6fcefeab6c3a4132c2c0e2e",
"small_15.in": "ccb7c3695a22c9c1afb1dedbbfcc58c29b8d817dd6c74f015a61c8980b5f98db",
"small_15.out": "c10e4f298ec1d47116c30c26e16b48713231fb0456775a235ae146ebf746c865"
"small_15.out": "c10e4f298ec1d47116c30c26e16b48713231fb0456775a235ae146ebf746c865",
"unsigned_overflow_00.in": "9ebbc9ee08996e7a352c1f688574cb0021ecc6e1d02ffbc1515486721452084c",
"unsigned_overflow_00.out": "0229b0cd8035b7b20369a57a10deaab40f8d3826b1816b2142731965a4c3274a"
}
6 changes: 6 additions & 0 deletions math/convolution_mod/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/42"
[[tests]]
name = "max_ans_zero.cpp"
number = 1
[[tests]]
name = "signed_overflow.cpp"
number = 1
[[tests]]
name = "unsigned_overflow.cpp"
number = 1

[[solutions]]
name = "naive.cpp"
Expand Down
29 changes: 29 additions & 0 deletions math/convolution_mod_1000000007/gen/signed_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD/2 - 1;
unsigned long long max_ll = numeric_limits<long long>::max();

// Find smallest size n where n * val * val > max_ll
int n = 0;
for (unsigned long long res = 0; res <= max_ll; res += (long long) val * val, ++n);

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}
34 changes: 34 additions & 0 deletions math/convolution_mod_1000000007/gen/unsigned_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD - 2;

// Find smallest size n where n * val * val > numeric_limits<unsigned long long>::max()
int n = 0;
unsigned long long res = 0;
long long val2 = (long long) val * val;
while (res + val2 >= res) // Check if adding val2 to res will overflow
{
res += val2;
++n;
}

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}
6 changes: 5 additions & 1 deletion math/convolution_mod_1000000007/hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"random_01.out": "50dae1e32c347a6d66f1f11ea0e5181a24e8f986c410cecaec40a794522396e5",
"random_02.in": "23673ac84811977b7f96facd73cc62aa64eb4d06de3f9829e771a6be052ad414",
"random_02.out": "1f5f643b7946386e36ddf2a3653ba7a48f73cff41c7517a66b26424b106cd6be",
"signed_overflow_00.in": "0eb551a4a9fd827ee510e8b13f5f0e3014d5a99cf2fe245626774db33ed29393",
"signed_overflow_00.out": "9c1bb9845ba4d1a57daf170c713d79e07d824aa06db2fd484527b81e2033bfcb",
"small_00.in": "ac1b0c7c78c8a8de70b5dc028a11fddd30d8de6dd399b0475e0f84deaddc5816",
"small_00.out": "5497acdabc7dd59bfc8784550ac6bf1557bdda54727d2ade18776892ab3367d5",
"small_01.in": "387fe0d406947ba770dcfc76f8285a94c58aae1a0f3c4d5477755c7bae83faae",
Expand Down Expand Up @@ -58,5 +60,7 @@
"small_14.in": "a377535ad3941915624588159bc4b5065f909f93b9bb9766d69b1ab1d6756d43",
"small_14.out": "5cff8cd0a73f627b13c0fda14f204eda42d0586452625d9c622e2e8c4cfcbbbf",
"small_15.in": "ccb7c3695a22c9c1afb1dedbbfcc58c29b8d817dd6c74f015a61c8980b5f98db",
"small_15.out": "d1973399c877ddaa31ffe3c60b229a56f6eecdbf3f9b9fc1c9e1813b578c1e26"
"small_15.out": "d1973399c877ddaa31ffe3c60b229a56f6eecdbf3f9b9fc1c9e1813b578c1e26",
"unsigned_overflow_00.in": "3d848cf445935f64c462a92656896e038d5d430be519690f5ed9ee9367478fcc",
"unsigned_overflow_00.out": "0229b0cd8035b7b20369a57a10deaab40f8d3826b1816b2142731965a4c3274a"
}
6 changes: 6 additions & 0 deletions math/convolution_mod_1000000007/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/145"
[[tests]]
name = "max_ans_zero.cpp"
number = 1
[[tests]]
name = "signed_overflow.cpp"
number = 1
[[tests]]
name = "unsigned_overflow.cpp"
number = 1

[[solutions]]
name = "naive.cpp"
Expand Down
29 changes: 29 additions & 0 deletions math/convolution_mod_large/gen/signed_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD/2 - 1;
unsigned long long max_ll = numeric_limits<long long>::max();

// Find smallest size n where n * val * val > max_ll
int n = 0;
for (unsigned long long res = 0; res <= max_ll; res += (long long) val * val, ++n);

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}
35 changes: 35 additions & 0 deletions math/convolution_mod_large/gen/unsigned_overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <iostream>
#include <set>
#include <limits>

#include "random.h"
#include "../params.h"

using namespace std;

int main() {
int val = MOD - 2;

// Find smallest size n where n * val * val > numeric_limits<unsigned long long>::max()
int n = 0;
unsigned long long res = 0;
long long val2 = (long long) val * val;
while (res + val2 >= res) // Check if adding val2 to res will overflow
{
res += val2;
++n;
}

cout << n << ' ' << n << '\n';

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

for (int i = 0; i < n; ++i) {
cout << val << ((i == n - 1) ? '\n' : ' ');
}

return 0;
}

6 changes: 5 additions & 1 deletion math/convolution_mod_large/hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"random_01.out": "d1dcd403e574b14fec1c9eb3d7d6816d6ab7d4c9346a6982630557ae089fed7b",
"random_02.in": "3f6e19c6c09430e4126602e3f8ba990be7e1dd6deef966d957b6a4b3c1874a79",
"random_02.out": "26a50fcccc9b6bcc8de961edd0099bcfc66b9f50026ceb2c1806958369d5f719",
"signed_overflow_00.in": "4224cd34b6f1f3ee6713e3228395c11333c067d6066612e69f3c0489bdee3b70",
"signed_overflow_00.out": "d314fa573547dda0f41b683921221a2549643b231de42cf0f1b7766db3045c73",
"small_00.in": "ac1b0c7c78c8a8de70b5dc028a11fddd30d8de6dd399b0475e0f84deaddc5816",
"small_00.out": "b086d8c94719f50a63743fbba701b852975a768400520b3285f0855ab77882a8",
"small_01.in": "387fe0d406947ba770dcfc76f8285a94c58aae1a0f3c4d5477755c7bae83faae",
Expand Down Expand Up @@ -62,5 +64,7 @@
"small_14.in": "a377535ad3941915624588159bc4b5065f909f93b9bb9766d69b1ab1d6756d43",
"small_14.out": "85c3fd86c69853bf54cccdf37c0a343d14850bdbd6fcefeab6c3a4132c2c0e2e",
"small_15.in": "ccb7c3695a22c9c1afb1dedbbfcc58c29b8d817dd6c74f015a61c8980b5f98db",
"small_15.out": "c10e4f298ec1d47116c30c26e16b48713231fb0456775a235ae146ebf746c865"
"small_15.out": "c10e4f298ec1d47116c30c26e16b48713231fb0456775a235ae146ebf746c865",
"unsigned_overflow_00.in": "9ebbc9ee08996e7a352c1f688574cb0021ecc6e1d02ffbc1515486721452084c",
"unsigned_overflow_00.out": "0229b0cd8035b7b20369a57a10deaab40f8d3826b1816b2142731965a4c3274a"
}
6 changes: 6 additions & 0 deletions math/convolution_mod_large/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/720"
[[tests]]
name = "max_ans_zero.cpp"
number = 1
[[tests]]
name = "signed_overflow.cpp"
number = 1
[[tests]]
name = "unsigned_overflow.cpp"
number = 1

[[solutions]]
name = "naive.cpp"
Expand Down
Loading

0 comments on commit 4d6e298

Please sign in to comment.