Skip to content

Commit

Permalink
Merge pull request #1114 from maspypy/compositional_inverse
Browse files Browse the repository at this point in the history
問題追加 compositonal_inverse (Large)
  • Loading branch information
maspypy authored Mar 19, 2024
2 parents 6b11188 + 52c05ae commit bafeacb
Show file tree
Hide file tree
Showing 14 changed files with 2,217 additions and 0 deletions.
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,2 @@
5
0 1 2 3 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2
0 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "../params.h"
#include "random.h"

#include <stdio.h>

int main() {
int n = N_MAX;
printf("%d\n", n);
printf("0 1");
for (int i = 2; i < n; i++) {
printf(" 0");
}
puts("");
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "../params.h"
#include "random.h"

#include <cstdio>

using namespace std;
using ll = long long;

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

int n = N_MAX;
printf("%d\n", n);

printf("0 %d", gen.uniform(1, int(MOD - 1)));
for (int i = 2; i < n; i++) {
printf(" %d", gen.uniform(0, int(MOD - 1)));
}
printf("\n");
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "../params.h"
#include "random.h"

#include <cstdio>

using namespace std;
using ll = long long;

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

int n = gen.uniform<int>(10, N_MID_MAX);
printf("%d\n", n);

printf("0 %d", gen.uniform(1, int(MOD - 1)));
for (int i = 2; i < n; i++) {
printf(" %d", gen.uniform(0, int(MOD - 1)));
}
printf("\n");
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "../params.h"
#include "random.h"

#include <cstdio>

using namespace std;
using ll = long long;

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

int n = gen.uniform(2, int(N_MAX));
printf("%d\n", n);

printf("0 %d", gen.uniform(1, int(MOD - 1)));
for (int i = 2; i < n; i++) {
printf(" %d", gen.uniform(0, int(MOD - 1)));
}
printf("\n");
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "../params.h"
#include "random.h"

#include <cstdio>

using namespace std;
using ll = long long;

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

int n = seed + 2;
printf("%d\n", n);

printf("0 %d", gen.uniform(1, int(MOD - 1)));
for (int i = 2; i < n; i++) {
printf(" %d", gen.uniform(0, int(MOD - 1)));
}
printf("\n");
return 0;
}
58 changes: 58 additions & 0 deletions math/compositional_inverse_of_formal_power_series_large/hash.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"example_00.in": "2a7b2913e67d11f900e3ba5940f907b336be56f7a4b6d2d021955e56e6e100ad",
"example_00.out": "f7926a0bf4d5b6f435675c000de28c58abd4d5ff0e9a04f3836f78855652a1b4",
"identity_00.in": "1e7a4f32fb9185df1c6fd771a5cf931f03681ea1d0ee5e4efb66e78a58277eeb",
"identity_00.out": "a79122992d53d358e6bbbbb98883d64fa0c15df3bcb08ff7b65a0580870af424",
"max_identity_00.in": "93555f790abb07c92f0bd819f53416010c3100d64175ecddb0e52826d8afe8f1",
"max_identity_00.out": "61508a3cd24926ea61b3de87e1bad780696ccc1860f144e7235c65e0a520db02",
"max_random_00.in": "591e42b783095d264cc8d523a94fd53a2b0fd069f0cc7b21bfced85f46c30e55",
"max_random_00.out": "28a86d08c657c50919c1274634a352be8bfb3fcf6ab9b903923725340bfc4009",
"max_random_01.in": "07fd365ddf38b9f4dc1bbcc1c2dcad6ce81331058a5459fc4947fe60ad1d9566",
"max_random_01.out": "85c50b0db5a84ed5275b31dc1f402f2149919e7e7d05c1b6cb616596a9617310",
"max_random_02.in": "4c6bb6fee655441928f39f12c70a16567e543641a94e882fdec5ddfdd2ebb899",
"max_random_02.out": "ad7501c1d1e24debf1e934998bcbca415c6feb5ba3fdade8ffa8a253cdf41109",
"max_random_03.in": "334dfe1c46c92892f4e1f2fa4212cc3e02a6a331bba3a754843f84e5cf50590d",
"max_random_03.out": "eaf0dc1ba9ac3a82026e32e4ee0e37381a52a76f0adb80d6f825aca64dba9bc7",
"max_random_04.in": "101613399448f0fc667a634b78e450cfbfb9951f7bf85c0fd3d5cab4ef2c5847",
"max_random_04.out": "26f6f14509b95e7aa52d8697a6207fa49fb0b70efdcd359aae2ba0c31d0f7209",
"mid_00.in": "c78c36edd6f8231e858fe135c619b3729b04ce446013d8d9c6af36590698e2b3",
"mid_00.out": "c9b055afb14008173705121225d00508c3ba5d4ab7776c891926999351728f38",
"mid_01.in": "1a6ac02fa16f8be4212a8ddd6dc779c56b0e98ffa2a0698bf6a9ab195168dde0",
"mid_01.out": "93c218507b204be359258b8e39224f2115c247b034021e8f4679a43fb365952f",
"mid_02.in": "551bd438471207c9922f7312930054fe0c9794eac150dd767653e3531b8beff6",
"mid_02.out": "4af4269d3d98cd636c90ee83844814d9e478812461f4825480a52877be09a22e",
"mid_03.in": "471c843a2eb7ea58c999d82c4c14d8cf236c55a3df97d4317a4e4d534421624e",
"mid_03.out": "027b5aa68e3f993c8f05d125280abec4e11e86ec18c312de1e7ac588775bf01f",
"mid_04.in": "4275ab4f0c36d61fd07c0d32e9a69cc59b0a0023da60195496bc4fceb9f6f5d5",
"mid_04.out": "7261a30a6f05e13e1fd786e820e4313fdbd8fcf2df999b22a6bbc9e1974c9594",
"random_00.in": "ccb141cf67beb9de4f5ee7ce846d09452f15d9bde38fa595df255f83b6f9bf5b",
"random_00.out": "50df6b9ad89be922ed76c235aff59a7bbf35aef84d378bafbc80723dffb6a12e",
"random_01.in": "7bf3bec20e022a1d43e271cf4ab55c1195ffdedad7438052253a0e43bad84956",
"random_01.out": "865ba1d30e23d49909886b0cd5e72d5e10688c833e8d59de825524804f83fec3",
"random_02.in": "ecdea430219275a80dde70eb1507347a5265cf0be80bb8a8efaeb9ffa9ccc3a7",
"random_02.out": "18f5e96b1f4a3e014efb994442c73c8de904580fd6503b232ef349f789dac7b1",
"random_03.in": "642984fc7724553e1523ef79f9259a474e776506c2e498770deb161de792b399",
"random_03.out": "f162dd9c6bcbcc4c545720b545e4bb2f4947c562a3b69caf055d09b7c4ee58af",
"random_04.in": "f8ab72aea6e6755a6c1dfe2a484326b01e0286912374ee6a724af754e4ee050e",
"random_04.out": "065a288faf36ef9376d925b424ccbe4314275c5034581f87200f1292e63d6ced",
"small_degree_00.in": "8627fcfb9d8d65850f78fa8b74a4d1fe665ecc67d2034aef605501b01a9314f0",
"small_degree_00.out": "4a7970d875144863f878e5a30376b27ed4eee872b2882f17186058f0b5513eb4",
"small_degree_01.in": "6c2116e298f172cafb672e6afff3cc527375d9052ee80a6561745f55d973374c",
"small_degree_01.out": "16c0188df427e76e9be96096a86f8692175d49d11c4d4e0ade35c15ac2c6ae3b",
"small_degree_02.in": "4d3584f1b46da84047777289082acc597b0c3f2847371a63d2155e94fd824e4d",
"small_degree_02.out": "c350adf6ca503d4ea2cafbc8b42bba5da0a02875ef8c800d61614b2206105e95",
"small_degree_03.in": "73088e98c6802733cdf542f668d125244e9faedd1506104f88299257dcbbda91",
"small_degree_03.out": "6ecbb901b9a4a917f55f88ecad87ed50de3056bc72874d876b4741a5cdd82de7",
"small_degree_04.in": "a1b9485788ea0b53242849fae36ba1c375d08b29fb419fd1043dd858be3711bb",
"small_degree_04.out": "32339a1f462195fc612ea77877ccfec8c364a0783eabd825594df193a466caa0",
"small_degree_05.in": "ffde4bfe5f389a1073fcb9f4c096cadf809ae95f043bb04e4166d4dedea41862",
"small_degree_05.out": "00faa173da007764aa96ba5ebd667aa14ae97e7aeec5ea0ee7385a7ae452bea3",
"small_degree_06.in": "5333053e874acccaac77f30ceb38f9602f9b9f4915767633668ca156da38f83a",
"small_degree_06.out": "51d7a404b244d517fcc5b387bd9f3cedc7b277c21e25487212f3c8f25c00d79d",
"small_degree_07.in": "600caee92cda9e4d27cbc9b41ae0669fa3cf554e707d711e3110d1e7aa638dff",
"small_degree_07.out": "6edf2274bae0479ceb91074481a414174288fc74800f7c4152a66117e7dc1d0b",
"small_degree_08.in": "3bb356867ccc1872ea2a53ced640df5898ddf61eb7b3469778192421108500d0",
"small_degree_08.out": "cf56c353dece58dd6061aa66c03e99db71c9caa3e5fdfbe04c48ac787e5e5616",
"small_degree_09.in": "15459a53bb24113dd35f6f76a0b6ac3e304b6d99e20bda3f6715b5cf9ee2f541",
"small_degree_09.out": "6b9f1e89bf5e71937bdb28398726df1757a301d644b21e39961fb9319fdd4cb4"
}
35 changes: 35 additions & 0 deletions math/compositional_inverse_of_formal_power_series_large/info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
title = 'Compositional Inverse 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 = "identity.in"
number = 1
[[tests]]
name = "random.cpp"
number = 5
[[tests]]
name = "mid.cpp"
number = 5
[[tests]]
name = "max_random.cpp"
number = 5
[[tests]]
name = "max_identity.cpp"
number = 1
[[tests]]
name = "small_degree.cpp"
number = 10

[[solutions]]
name = "small_correct.cpp"
wrong = false
allow_re = true

[params]
N_MAX = 131_072
N_MID_MAX = 8_000
MOD = 998_244_353
Loading

0 comments on commit bafeacb

Please sign in to comment.