diff --git a/examples/README.md b/examples/README.md index 49e13881..a5949f55 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,6 +31,26 @@ Please check also the [gallery](https://kmyk.github.io/Jikka/gallery). - :heavy_check_mark: AC `dp_z-kubaru.py` - The Kubaru DP version of `dp_z-morau.py`. - submission at v5.1.0.0: +- :heavy_check_mark: AC `abc203_b.py` + - AtCoder Beginner Contest 203 [B - AtCoder Condominium](https://atcoder.jp/contests/abc203/tasks/abc203_b) + - AC with a naive solution using `sum(List[int])` / 愚直解が AC `sum(List[int])`を使用 + - submission at d2be3858a1ec3b65a8cdb6228e81c85dd976a5bc: +- :heavy_check_mark: AC `abc204_b.py` + - AtCoder Beginner Contest 204 [B - Nuts](https://atcoder.jp/contests/abc204/tasks/abc204_b) + - AC with a naive solution / 愚直解が AC + - submission at d2be3858a1ec3b65a8cdb6228e81c85dd976a5bc: +- :heavy_check_mark: AC `abc206_b.py` + - AtCoder Beginner Contest 206 [B - Savings](https://atcoder.jp/contests/abc206/tasks/abc206_b) + - AC with a naive solution / 愚直解が AC + - submission at 8d1bbacd3f40a60ae8e2447c2a17a8956c7b0218: +- :heavy_check_mark: AC `abc207_b.py` + - AtCoder Beginner Contest 207 [B - Hydrate](https://atcoder.jp/contests/abc207/tasks/abc207_b) + - AC with a naive solution using jikka::floordiv / 愚直解が AC jikka::floordiv を使う + - submission at 8d1bbacd3f40a60ae8e2447c2a17a8956c7b0218: +- :heavy_check_mark: AC `abc208_b.py` + - AtCoder Beginner Contest 208 [B - Factorial Yen Coin](https://atcoder.jp/contests/abc208/tasks/abc208_b) + - AC with a naive solution using jikka::floordiv, reverse / 愚直解が AC jikka::floordiv, reverse を使う簡単な問題 + - submission at 8d1bbacd3f40a60ae8e2447c2a17a8956c7b0218: - :hourglass: TLE `abc134_c.py` - AtCoder Beginner Contest 134 [C - Exception Handling](https://atcoder.jp/contests/abc134/tasks/abc134_c) - Cumulative sums from both sides / 両側からの累積和 diff --git a/examples/wip/abc203_b.py b/examples/abc203_b.py similarity index 93% rename from examples/wip/abc203_b.py rename to examples/abc203_b.py index bfa29ebe..728abff3 100644 --- a/examples/wip/abc203_b.py +++ b/examples/abc203_b.py @@ -1,6 +1,6 @@ # https://atcoder.jp/contests/abc203/tasks/abc203_b -from typing import * +# from typing import * def solve(n: int, k: int) -> int: a = [] diff --git a/examples/wip/abc204_b.py b/examples/abc204_b.py similarity index 100% rename from examples/wip/abc204_b.py rename to examples/abc204_b.py diff --git a/examples/wip/abc206_b.py b/examples/abc206_b.py similarity index 94% rename from examples/wip/abc206_b.py rename to examples/abc206_b.py index 3f6e1670..77ec5bc3 100644 --- a/examples/wip/abc206_b.py +++ b/examples/abc206_b.py @@ -1,6 +1,6 @@ # https://atcoder.jp/contests/abc206/tasks/abc206_b -from typing import * +# from typing import * def solve(n: int) -> int: c = 0 diff --git a/examples/wip/abc207_b.py b/examples/abc207_b.py similarity index 94% rename from examples/wip/abc207_b.py rename to examples/abc207_b.py index 4249edc4..1ec51e70 100644 --- a/examples/wip/abc207_b.py +++ b/examples/abc207_b.py @@ -1,6 +1,6 @@ # https://atcoder.jp/contests/abc207/tasks/abc207_b -from typing import * +# from typing import * def solve(a: int, b: int, c: int, d: int) -> int: ans = -1 diff --git a/examples/wip/abc208_b.py b/examples/abc208_b.py similarity index 94% rename from examples/wip/abc208_b.py rename to examples/abc208_b.py index 819a72ca..2bfb23e8 100644 --- a/examples/wip/abc208_b.py +++ b/examples/abc208_b.py @@ -1,6 +1,6 @@ # https://atcoder.jp/contests/abc208/tasks/abc208_b -from typing import * +# from typing import * def solve(p: int) -> int: e = 1 diff --git a/examples/data/abc203_b.large.generator.py b/examples/data/abc203_b.large.generator.py new file mode 100644 index 00000000..81285dc3 --- /dev/null +++ b/examples/data/abc203_b.large.generator.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# usage: $ oj generate-input 'python3 generate.py' +# usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' +import random + + +# generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +def main(): + N = random.randint(1, 9) + K = random.randint(1, 9) + print(N, K) + + +if __name__ == "__main__": + main() diff --git a/examples/data/abc203_b.sample-1.in b/examples/data/abc203_b.sample-1.in new file mode 100644 index 00000000..8d04f961 --- /dev/null +++ b/examples/data/abc203_b.sample-1.in @@ -0,0 +1 @@ +1 2 diff --git a/examples/data/abc203_b.sample-1.out b/examples/data/abc203_b.sample-1.out new file mode 100644 index 00000000..bb2ee191 --- /dev/null +++ b/examples/data/abc203_b.sample-1.out @@ -0,0 +1 @@ +203 diff --git a/examples/data/abc203_b.sample-2.in b/examples/data/abc203_b.sample-2.in new file mode 100644 index 00000000..ac81dc6c --- /dev/null +++ b/examples/data/abc203_b.sample-2.in @@ -0,0 +1 @@ +3 3 diff --git a/examples/data/abc203_b.sample-2.out b/examples/data/abc203_b.sample-2.out new file mode 100644 index 00000000..179dea5c --- /dev/null +++ b/examples/data/abc203_b.sample-2.out @@ -0,0 +1 @@ +1818 diff --git a/examples/data/abc203_b.solver.cpp b/examples/data/abc203_b.solver.cpp new file mode 100644 index 00000000..ee5b5cc0 --- /dev/null +++ b/examples/data/abc203_b.solver.cpp @@ -0,0 +1,30 @@ +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) +#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) +#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) +#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i)) +#define ALL(x) ::std::begin(x), ::std::end(x) +using namespace std; + +int64_t solve(int64_t N, int64_t K) { + uint64_t ans = 0; + for (int i = 1; i <= N; ++i) { + for (int j = 1; j <= K; ++j) { + ans += 100 * i + j; + } + } + return ans; +} + +// generated by oj-template v4.8.1 +// (https://github.com/online-judge-tools/template-generator) +int main() { + std::ios::sync_with_stdio(false); + std::cin.tie(nullptr); + int64_t N, K; + std::cin >> N >> K; + auto ans = solve(N, K); + std::cout << ans << '\n'; + return 0; +} diff --git a/examples/data/abc204_b.large.generator.py b/examples/data/abc204_b.large.generator.py new file mode 100644 index 00000000..68810b0f --- /dev/null +++ b/examples/data/abc204_b.large.generator.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# usage: $ oj generate-input 'python3 generate.py' +# usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' +import random + + +# generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +def main(): + N = random.randint(1, 1000) + A = [None for _ in range(N)] + for i in range(N): + A[i] = random.randint(1, 1000) + print(N) + print(*[A[i] for i in range(N)]) + + +if __name__ == "__main__": + main() diff --git a/examples/data/abc204_b.sample-1.in b/examples/data/abc204_b.sample-1.in new file mode 100644 index 00000000..98c7628b --- /dev/null +++ b/examples/data/abc204_b.sample-1.in @@ -0,0 +1,2 @@ +3 +6 17 28 diff --git a/examples/data/abc204_b.sample-1.out b/examples/data/abc204_b.sample-1.out new file mode 100644 index 00000000..7273c0fa --- /dev/null +++ b/examples/data/abc204_b.sample-1.out @@ -0,0 +1 @@ +25 diff --git a/examples/data/abc204_b.sample-2.in b/examples/data/abc204_b.sample-2.in new file mode 100644 index 00000000..03389b3e --- /dev/null +++ b/examples/data/abc204_b.sample-2.in @@ -0,0 +1,2 @@ +4 +8 9 10 11 diff --git a/examples/data/abc204_b.sample-2.out b/examples/data/abc204_b.sample-2.out new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/examples/data/abc204_b.sample-2.out @@ -0,0 +1 @@ +1 diff --git a/examples/data/abc204_b.solver.cpp b/examples/data/abc204_b.solver.cpp new file mode 100644 index 00000000..39bf9093 --- /dev/null +++ b/examples/data/abc204_b.solver.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) +#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) +#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) +#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i)) +#define ALL(x) ::std::begin(x), ::std::end(x) +using namespace std; + +int64_t solve(int N, const std::vector &A) { + int64_t ans = 0; + for (const auto &e : A) { + if (e > 10) { + ans += e - 10; + } + } + return ans; +} + +// generated by oj-template v4.8.1 +// (https://github.com/online-judge-tools/template-generator) +int main() { + std::ios::sync_with_stdio(false); + std::cin.tie(nullptr); + int N; + std::cin >> N; + std::vector A(N); + REP(i, N) { std::cin >> A[i]; } + auto ans = solve(N, A); + std::cout << ans << '\n'; + return 0; +} diff --git a/examples/data/abc206_b.large.generator.py b/examples/data/abc206_b.large.generator.py new file mode 100644 index 00000000..89b9b76e --- /dev/null +++ b/examples/data/abc206_b.large.generator.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# usage: $ oj generate-input 'python3 generate.py' +# usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' +import random + + +# generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +def main(): + N = random.randint(1, 10**9) + print(N) + + +if __name__ == "__main__": + main() diff --git a/examples/data/abc206_b.sample-1.in b/examples/data/abc206_b.sample-1.in new file mode 100644 index 00000000..48082f72 --- /dev/null +++ b/examples/data/abc206_b.sample-1.in @@ -0,0 +1 @@ +12 diff --git a/examples/data/abc206_b.sample-1.out b/examples/data/abc206_b.sample-1.out new file mode 100644 index 00000000..7ed6ff82 --- /dev/null +++ b/examples/data/abc206_b.sample-1.out @@ -0,0 +1 @@ +5 diff --git a/examples/data/abc206_b.sample-2.in b/examples/data/abc206_b.sample-2.in new file mode 100644 index 00000000..f9b9bc7a --- /dev/null +++ b/examples/data/abc206_b.sample-2.in @@ -0,0 +1 @@ +100128 diff --git a/examples/data/abc206_b.sample-2.out b/examples/data/abc206_b.sample-2.out new file mode 100644 index 00000000..e9b7520b --- /dev/null +++ b/examples/data/abc206_b.sample-2.out @@ -0,0 +1 @@ +447 diff --git a/examples/data/abc206_b.solver.cpp b/examples/data/abc206_b.solver.cpp new file mode 100644 index 00000000..67c7ea01 --- /dev/null +++ b/examples/data/abc206_b.solver.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) +#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) +#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) +#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i)) +#define ALL(x) ::std::begin(x), ::std::end(x) +using namespace std; + +int64_t solve(int64_t N) { + int64_t c = 0; + for (int i = 1; i < 100000; ++i) { + c += i; + if (c >= N) { + return i; + } + } + return 0; // avoid warning +} + +// generated by oj-template v4.8.1 +// (https://github.com/online-judge-tools/template-generator) +int main() { + std::ios::sync_with_stdio(false); + std::cin.tie(nullptr); + int64_t N; + std::cin >> N; + auto ans = solve(N); + std::cout << ans << '\n'; + return 0; +} diff --git a/examples/data/abc207_b.large.generator.py b/examples/data/abc207_b.large.generator.py new file mode 100644 index 00000000..e52c4859 --- /dev/null +++ b/examples/data/abc207_b.large.generator.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +# usage: $ oj generate-input 'python3 generate.py' +# usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' +import random + + +# generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +def main(): + A = random.randint(1, 10**5) + B = random.randint(1, 10**5) + C = random.randint(1, 10**5) + D = random.randint(1, 10**5) + print(A, B, C, D) + + +if __name__ == "__main__": + main() diff --git a/examples/data/abc207_b.sample-1.in b/examples/data/abc207_b.sample-1.in new file mode 100644 index 00000000..56a6a65e --- /dev/null +++ b/examples/data/abc207_b.sample-1.in @@ -0,0 +1 @@ +5 2 3 2 diff --git a/examples/data/abc207_b.sample-1.out b/examples/data/abc207_b.sample-1.out new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/examples/data/abc207_b.sample-1.out @@ -0,0 +1 @@ +2 diff --git a/examples/data/abc207_b.sample-2.in b/examples/data/abc207_b.sample-2.in new file mode 100644 index 00000000..5c1d4c71 --- /dev/null +++ b/examples/data/abc207_b.sample-2.in @@ -0,0 +1 @@ +6 9 2 3 diff --git a/examples/data/abc207_b.sample-2.out b/examples/data/abc207_b.sample-2.out new file mode 100644 index 00000000..3a2e3f49 --- /dev/null +++ b/examples/data/abc207_b.sample-2.out @@ -0,0 +1 @@ +-1 diff --git a/examples/data/abc207_b.solver.cpp b/examples/data/abc207_b.solver.cpp new file mode 100644 index 00000000..e2fcd8b4 --- /dev/null +++ b/examples/data/abc207_b.solver.cpp @@ -0,0 +1,28 @@ +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) +#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) +#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) +#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i)) +#define ALL(x) ::std::begin(x), ::std::end(x) +using namespace std; + +int64_t solve(int64_t A, int64_t B, int64_t C, int64_t D) { + int64_t ans = -1; + if (D * C - B > 0) { + ans = (A + D * C - B - 1) / (D * C - B); + } + return ans; +} + +// generated by oj-template v4.8.1 +// (https://github.com/online-judge-tools/template-generator) +int main() { + std::ios::sync_with_stdio(false); + std::cin.tie(nullptr); + int64_t A, B, C, D; + std::cin >> A >> B >> C >> D; + auto ans = solve(A, B, C, D); + std::cout << ans << '\n'; + return 0; +} diff --git a/examples/data/abc208_b.large.generator.py b/examples/data/abc208_b.large.generator.py new file mode 100644 index 00000000..352a6c9a --- /dev/null +++ b/examples/data/abc208_b.large.generator.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# usage: $ oj generate-input 'python3 generate.py' +# usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' +import random + + +# generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +def main(): + P = random.randint(1, 10**7) + print(P) + + +if __name__ == "__main__": + main() diff --git a/examples/data/abc208_b.sample-1.in b/examples/data/abc208_b.sample-1.in new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/examples/data/abc208_b.sample-1.in @@ -0,0 +1 @@ +9 diff --git a/examples/data/abc208_b.sample-1.out b/examples/data/abc208_b.sample-1.out new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/examples/data/abc208_b.sample-1.out @@ -0,0 +1 @@ +3 diff --git a/examples/data/abc208_b.sample-2.in b/examples/data/abc208_b.sample-2.in new file mode 100644 index 00000000..078fa0fe --- /dev/null +++ b/examples/data/abc208_b.sample-2.in @@ -0,0 +1 @@ +119 diff --git a/examples/data/abc208_b.sample-2.out b/examples/data/abc208_b.sample-2.out new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/examples/data/abc208_b.sample-2.out @@ -0,0 +1 @@ +10 diff --git a/examples/data/abc208_b.sample-3.in b/examples/data/abc208_b.sample-3.in new file mode 100644 index 00000000..825319e1 --- /dev/null +++ b/examples/data/abc208_b.sample-3.in @@ -0,0 +1 @@ +10000000 diff --git a/examples/data/abc208_b.sample-3.out b/examples/data/abc208_b.sample-3.out new file mode 100644 index 00000000..a45fd52c --- /dev/null +++ b/examples/data/abc208_b.sample-3.out @@ -0,0 +1 @@ +24 diff --git a/examples/data/abc208_b.solver.cpp b/examples/data/abc208_b.solver.cpp new file mode 100644 index 00000000..8af35a2c --- /dev/null +++ b/examples/data/abc208_b.solver.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) +#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) +#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) +#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i)) +#define ALL(x) ::std::begin(x), ::std::end(x) +using namespace std; + +int64_t solve(int64_t P) { + vector cs; + int64_t e = 1; + int64_t ans = 0; + for (int i = 1; i <= 10; ++i) { + e *= i; + cs.push_back(e); + } + reverse(cs.begin(), cs.end()); + for (const auto &c : cs) { + ans += P / c; + P -= P / c * c; + } + return ans; +} + +// generated by oj-template v4.8.1 +// (https://github.com/online-judge-tools/template-generator) +int main() { + std::ios::sync_with_stdio(false); + std::cin.tie(nullptr); + int64_t P; + std::cin >> P; + auto ans = solve(P); + std::cout << ans << '\n'; + return 0; +} diff --git a/scripts/add_test_cases.py b/scripts/add_test_cases.py index cedef9a6..8f5a85fa 100644 --- a/scripts/add_test_cases.py +++ b/scripts/add_test_cases.py @@ -52,7 +52,7 @@ def main() -> None: plan[examples_dir / 'data' / '{}.sample-{}.out'.format(name, i + 1)] = testcase['output'].encode() if not args.only_sample_cases: plan[examples_dir / '{}.py'.format(name)] = subprocess.check_output(['oj-template', '-t', 'main.py', args.url]) - plan[examples_dir / 'data' / '{}.solver.cpp'.format(name)] = subprocess.check_output(['oj-template', '-t', 'main.cpp', args.url]) + plan[examples_dir / 'data' / '{}.solver.cpp'.format(name)] = subprocess.check_output(['oj-template', '-t', 'main.cpp', args.url]).replace(b'#include \n', b'#include \n#include \n#include \n') # Replace bits/stdc++.h to compile the solver on Windows. plan[examples_dir / 'data' / '{}.large.generator.py'.format(name)] = subprocess.check_output(['oj-template', '-t', 'generate.py', args.url]) # check files