Skip to content

Commit

Permalink
Merge pull request #1113 from maspypy/composition
Browse files Browse the repository at this point in the history
問題追加:composition of formal power series (Large)
  • Loading branch information
maspypy authored Mar 19, 2024
2 parents bafeacb + bef6719 commit edf316c
Show file tree
Hide file tree
Showing 16 changed files with 2,343 additions and 0 deletions.
62 changes: 62 additions & 0 deletions math/composition_of_formal_power_series_large/checker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// https://github.com/MikeMirzayanov/testlib/blob/master/checkers/wcmp.cpp

// The MIT License (MIT)

// Copyright (c) 2015 Mike Mirzayanov

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "testlib.h"

using namespace std;

int main(int argc, char * argv[])
{
setName("compare sequences of tokens");
registerTestlibCmd(argc, argv);

int n = 0;
string j, p;

while (!ans.seekEof() && !ouf.seekEof())
{
n++;

ans.readWordTo(j);
ouf.readWordTo(p);

if (j != p)
quitf(_wa, "%d%s words differ - expected: '%s', found: '%s'", n, englishEnding(n).c_str(), compress(j).c_str(), compress(p).c_str());
}

if (ans.seekEof() && ouf.seekEof())
{
if (n == 1)
quitf(_ok, "\"%s\"", compress(j).c_str());
else
quitf(_ok, "%d tokens", n);
}
else
{
if (ans.seekEof())
quitf(_wa, "Participant output contains extra tokens");
else
quitf(_wa, "Unexpected EOF in the participants output");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
5
5 4 3 2 1
0 1 2 3 4
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/hack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = N_MAX;
vector<int> f(n),g(n);
for (int i = 0; i < n; i++){
f[i] = gen.uniform(0ll,MOD-1);
}
for (int i = gen.uniform(0,n-1); i < n; i++) {
if(i)g[i] = gen.uniform(0ll,MOD-1);
else g[i]=0;
}

printf("%d\n",n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/hack2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = N_MAX;
vector<int> f(n),g(n);
for (int i = 0; i < n; i++){
f[i] = gen.uniform(0ll,MOD-1);
}
for (int i = gen.uniform(0,10); i < n; i++) {
if(i)g[i] = gen.uniform(0ll,MOD-1);
else g[i]=0;
}

printf("%d\n",n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/max_random.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = N_MAX;
vector<int> f(n), g(n);
for (int i = 0; i < n; i++) { f[i] = gen.uniform(0ll, MOD - 1); }
for (int i = 0; i < n; i++) {
if (i)
g[i] = gen.uniform(0ll, MOD - 1);
else
g[i] = 0;
}

printf("%d\n", n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/mid.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = gen.uniform(1ll, N_MID_MAX);
vector<int> f(n), g(n);
for (int i = 0; i < n; i++) { f[i] = gen.uniform(0ll, MOD - 1); }
for (int i = 0; i < n; i++) {
if (i)
g[i] = gen.uniform(0ll, MOD - 1);
else
g[i] = 0;
}

printf("%d\n", n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/random.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = gen.uniform(1ll, N_MAX);
vector<int> f(n), g(n);
for (int i = 0; i < n; i++) { f[i] = gen.uniform(0ll, MOD - 1); }
for (int i = 0; i < n; i++) {
if (i)
g[i] = gen.uniform(0ll, MOD - 1);
else
g[i] = 0;
}

printf("%d\n", n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
34 changes: 34 additions & 0 deletions math/composition_of_formal_power_series_large/gen/small.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cstdio>
#include "../params.h"
#include "random.h"

using namespace std;

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

int n = gen.uniform(1ll, N_SMALL_MAX);
vector<int> f(n), g(n);
for (int i = 0; i < n; i++) { f[i] = gen.uniform(0ll, MOD - 1); }
for (int i = 0; i < n; i++) {
if (i)
g[i] = gen.uniform(0ll, MOD - 1);
else
g[i] = 0;
}

printf("%d\n", n);

for (int i = 0; i < n; i++) {
printf("%d", f[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < n; i++) {
printf("%d", g[i]);
if (i != n - 1) printf(" ");
}
printf("\n");
return 0;
}
66 changes: 66 additions & 0 deletions math/composition_of_formal_power_series_large/hash.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"example_00.in": "2eb7de1f18b179172d224b4f373ecbb661dd167cb16322b550c32ef9a972fcdd",
"example_00.out": "4b3202ac36cd9062d26063aa07945dbc320715575042bb3ecbcf0077fb40d734",
"hack2_00.in": "ccadf8a5d7c4e7a6e01dfa588c8e2998632c9c96b35e01edf9e84006e3a39991",
"hack2_00.out": "41677c75d3a6f9d68755cabfa6cbbf53459ad86602227a229f26f3ab2ebfc6f7",
"hack2_01.in": "88d13fe1aaf20bae12e26e8782a935860b68b1d8b112bc93e2e15f9d3ccd9810",
"hack2_01.out": "d4ad030cde84df469cefdfe7d76984ac664eb0119e2a7708f361acc109ab8659",
"hack2_02.in": "4a174035d278904d5ed519c534fd5977f3109d36c8d13d8341212d5c046c9855",
"hack2_02.out": "3251b1ae4d93c57b3a220bfded4539e2a8f744c8bdee1a03bd74d7e7c16e2fde",
"hack_00.in": "786b6a019d97a8c13d41e6b7d495451bafc8dcf65450db3b931256b45370f301",
"hack_00.out": "5655df70fdb49a3e426a6ed21b5d6e3ed312c8525afa0ca94d438a71c35e5799",
"hack_01.in": "66a9244b8941adafd268416854e8e202deaebfa3e8a4ff9b69dc6d6d61343608",
"hack_01.out": "78069962c5b9e7dfcfa0b8babcbe45dabe49cf20d12c4ffb419845921b45f09c",
"hack_02.in": "2b274c3a33d2c764cfea13c7042a63fba0f45f73e6be4b412f6edbcdff982648",
"hack_02.out": "8cffad7dac2ff4ef81d435558330feaeb482fe35d783e53e7f7f6e276b35b62e",
"max_random_00.in": "9404320bd03fe869c53cbe50511a45d262f037388dd5d2e41074db1c8a6fffa6",
"max_random_00.out": "2e032a16bc09a8e289e7a2470ec8f70b71904ec433c60df30da260a2fb6fd7dd",
"max_random_01.in": "6329c2e34e70c85d0d57734d742937361bbcb5a3cb36d1f85b919c8544877593",
"max_random_01.out": "361d7ebd0178a95f236eb33f27fbcc192deb7daba88779ed646454876b12f909",
"max_random_02.in": "a50c6b629a04643cc4001ab6b33792975097316f395791fa13576a25e36f8275",
"max_random_02.out": "211146427e5f5c43f315e3bb21cd9d586d539b9df164ec48fe56ed77e985896c",
"max_random_03.in": "d1e9d03fcbec7ac084f01b94c12051536f0d89f148edfca0059850e9925568b6",
"max_random_03.out": "4598aedf372145999617e25a845fe6bfd6895e8fe1be6ac2e42dd4be660c730f",
"max_random_04.in": "cfe035208770b5b22b248d272872896b9fde8edec65646e974ee3cbaf7418ae6",
"max_random_04.out": "927add67f5047b2d214f84df7847d5001bd15b643790a747df9da3fb196ebe44",
"mid_00.in": "5974d2d92af1e6fb8772a352b9ac77a3be932d8210af541d3d98a5435e5e4eec",
"mid_00.out": "d941b589a815e52383ccf9d20328404603ce8b3928ccdbe9ffbe60ceaf3cadb9",
"mid_01.in": "ff53fc06fa315f3862b9d16e576f619a53d0ad357eee42df883e7e58d6799b83",
"mid_01.out": "bd5f65f5ae79bbd6da7af00597551fdfa396d3fc2c201fb0016c48e13aff16e6",
"mid_02.in": "3992571daa5bbd1464533d931006b69a9f68594d9777953f2380b9659dc50a43",
"mid_02.out": "4d3e09d05b44abe8f8b0a740a129de0ce884ace84c9e91feaaa83292c024c86e",
"mid_03.in": "9e1de46c00747ef9bdee5eef1f4edbb6bfca56f37c00463b74c417e5f15a92f4",
"mid_03.out": "7d71c7428994fb3ef14de2971c5156babe499734ef8cbd6bcc657de791826a48",
"mid_04.in": "eb66072ce88bc0a19793fdceeb956622ae5728c9da2ea5fb3b37c4bfe9d7d046",
"mid_04.out": "3c720b376814e917da2dd09513b6e02f04ce234d1e45fbaf1baaff2f02c4f041",
"random_00.in": "8148b655cb81c1114e8f9abb1a5cc488d326ff82ca53774da1b660353de535e5",
"random_00.out": "fd8127c466a06e10ca62583b27be261f4bdf408fd99e5cfb7102378e4bc74cc2",
"random_01.in": "a64521ec14f32af5c1ce0da9fcc9cc59ecfb1c4bef671e9e8505faa10b339900",
"random_01.out": "9f4a7b13b0de679a7bc6c3f3a379c498825f59968524c9366342f1cf3b45496e",
"random_02.in": "383a2eeb79e2d048e78352911b5b69b1e53b4d066e5570ad47d80a4ff66c6957",
"random_02.out": "0f4c3d0e18e72a3d9f9cfeab51df4d9d7d2f7ec709eea8c3cef1c6a8023fd7cb",
"random_03.in": "51d5c90f2eb26b7cce557646722a117b68367bf26d9779411ef6a0e840acd5d0",
"random_03.out": "ffb5f15ab1d014ad1d69e32c271c49d7eadfd6949a195e47fd3fee9987e1f26b",
"random_04.in": "3030c0e8acdf602b27bb87d2d080a8a3b06b2581e2e44574cc4285bdda0e4a9e",
"random_04.out": "27fc3b93d669f832c43ca0de5dfc8b20cdd016d7bb5408acec3565012210d1ce",
"small_00.in": "d018ae901616ea66ba42457bf205efa6106d897ae24862db07ec34272709474c",
"small_00.out": "55cac1e5b3088c32ae2210231f585795e621c439d578a3f622854116901905dc",
"small_01.in": "4b243ec8ac49dd0b54af3035339a470361ed98189dba1bf50f91761b851eedf9",
"small_01.out": "2dd6019379733130e3c0cb7c1d2aa60318e5b6ade39aab875ff3033d0468cb2a",
"small_02.in": "8e1746e2b59b22c1a0f878b1bb6145d49dd583f92d10c56bfa3d7b775d42def6",
"small_02.out": "4598a8610e26a7af95861e836b141048e4529a7064beb373beadb2e603652779",
"small_03.in": "cb91ccacdfa0ef9baa38a29a0b1dfcd7eb2a77188449366f07296b63cff53fea",
"small_03.out": "e11527191c91d06e888ceda99d7257b6f10e6676e0c18bae5418f67a33007ec4",
"small_04.in": "3cb79fa759f604728767c1985bfcd862ff12561cc27699f7fa739ab47e0b13bd",
"small_04.out": "355b7847714ae67e59677ade79b408280f7cd2551bd515d5e78e34a58ff0bf7f",
"small_05.in": "5af9f59362f6a142f3ea4dc09317a20e425ad076d81cba0b184aa243b1337b0f",
"small_05.out": "a4074b02f113d3e411bea15bf6c485faf85fcc5392c98a292aa95d2790708c11",
"small_06.in": "d73255d167f40b2836eb7582a4918d5c606ec152a22d38267700ce2a594c3f13",
"small_06.out": "119c2b97c93980a811107009df1747735629b479518c3b119dc6d11c38b24dcc",
"small_07.in": "8de4fb5f474c0d2ee3c7387159e55f739e4ef3e77e759e30a8b96f5fd4730244",
"small_07.out": "6a631b8c7ec0638305d8b6b073a7a80fecdeff78bf52e4007ee7490cec5014c7",
"small_08.in": "f9c438cdafa47aeffed4f54ccdbaa302ebc46a57950b4855cb010167b2fcdfa5",
"small_08.out": "9a9daa342941a9de5a31da6820f7e5ae92cead46f6231d5fb4b227401a769084",
"small_09.in": "067ad2b7b0ef92d46bf9c6f582414f5435ab63ce2aa57ef268c25e0a178df05e",
"small_09.out": "9393c6c1840811e58610a95083f69ed438a3ef856a91009a3eaa72e5ee2e4e5f"
}
40 changes: 40 additions & 0 deletions math/composition_of_formal_power_series_large/info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title = 'Composition of Formal Power Series (Large)'
timelimit = 10.0
forum = "https://github.com/yosupo06/library-checker-problems/issues/1112"

[[tests]]
name = "example.in"
number = 1
[[tests]]
name = "random.cpp"
number = 5
[[tests]]
name = "mid.cpp"
number = 5
[[tests]]
name = "max_random.cpp"
number = 5
[[tests]]
name = "small.cpp"
number = 10
[[tests]]
name = "hack.cpp"
number = 3
[[tests]]
name = "hack2.cpp"
number = 3
[[solutions]]
name = "small_correct.cpp"
allow_re = true
[[solutions]]
name = "naive.cpp"
allow_re = true
[[solutions]]
name = "wa.cpp"
wrong = true
allow_tle = true
[params]
N_MAX = 131_072
N_MID_MAX = 8_000
N_SMALL_MAX = 10
MOD =998_244_353
Loading

0 comments on commit edf316c

Please sign in to comment.