From a4e02202c0bcbb4a1ad1969746e78510ed66f1d8 Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 10:24:30 +0900 Subject: [PATCH 01/10] test: Move examples/abc207_b.py to examples/abc207_b.py --- examples/{wip => }/abc207_b.py | 2 +- examples/data/abc207_b.large.generator.py | 17 +++++++++++++++ examples/data/abc207_b.sample-1.in | 1 + examples/data/abc207_b.sample-1.out | 1 + examples/data/abc207_b.sample-2.in | 1 + examples/data/abc207_b.sample-2.out | 1 + examples/data/abc207_b.solver.cpp | 26 +++++++++++++++++++++++ 7 files changed, 48 insertions(+), 1 deletion(-) rename examples/{wip => }/abc207_b.py (94%) create mode 100644 examples/data/abc207_b.large.generator.py create mode 100644 examples/data/abc207_b.sample-1.in create mode 100644 examples/data/abc207_b.sample-1.out create mode 100644 examples/data/abc207_b.sample-2.in create mode 100644 examples/data/abc207_b.sample-2.out create mode 100644 examples/data/abc207_b.solver.cpp 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/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..6e8d1766 --- /dev/null +++ b/examples/data/abc207_b.solver.cpp @@ -0,0 +1,26 @@ +#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; +} From 1edc25364799706a74737b696cf11641fa98c0eb Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 10:37:34 +0900 Subject: [PATCH 02/10] test: Move examples/abc208_b.py to examples/abc208_b.py --- examples/{wip => }/abc208_b.py | 2 +- examples/data/abc208_b.large.generator.py | 14 ++++++++++ examples/data/abc208_b.sample-1.in | 1 + examples/data/abc208_b.sample-1.out | 1 + examples/data/abc208_b.sample-2.in | 1 + examples/data/abc208_b.sample-2.out | 1 + examples/data/abc208_b.sample-3.in | 1 + examples/data/abc208_b.sample-3.out | 1 + examples/data/abc208_b.solver.cpp | 34 +++++++++++++++++++++++ 9 files changed, 55 insertions(+), 1 deletion(-) rename examples/{wip => }/abc208_b.py (94%) create mode 100644 examples/data/abc208_b.large.generator.py create mode 100644 examples/data/abc208_b.sample-1.in create mode 100644 examples/data/abc208_b.sample-1.out create mode 100644 examples/data/abc208_b.sample-2.in create mode 100644 examples/data/abc208_b.sample-2.out create mode 100644 examples/data/abc208_b.sample-3.in create mode 100644 examples/data/abc208_b.sample-3.out create mode 100644 examples/data/abc208_b.solver.cpp 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/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..b04f1657 --- /dev/null +++ b/examples/data/abc208_b.solver.cpp @@ -0,0 +1,34 @@ +#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; +} From 2d75c991069df00203cfce13cb0aa6a9f4c76d10 Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 10:53:08 +0900 Subject: [PATCH 03/10] test: Move examples/abc206_b.py to examples/abc206_b.py --- examples/{wip => }/abc206_b.py | 2 +- examples/data/abc206_b.large.generator.py | 14 +++++++++++ examples/data/abc206_b.sample-1.in | 1 + examples/data/abc206_b.sample-1.out | 1 + examples/data/abc206_b.sample-2.in | 1 + examples/data/abc206_b.sample-2.out | 1 + examples/data/abc206_b.solver.cpp | 29 +++++++++++++++++++++++ 7 files changed, 48 insertions(+), 1 deletion(-) rename examples/{wip => }/abc206_b.py (94%) create mode 100644 examples/data/abc206_b.large.generator.py create mode 100644 examples/data/abc206_b.sample-1.in create mode 100644 examples/data/abc206_b.sample-1.out create mode 100644 examples/data/abc206_b.sample-2.in create mode 100644 examples/data/abc206_b.sample-2.out create mode 100644 examples/data/abc206_b.solver.cpp 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/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..6034b0df --- /dev/null +++ b/examples/data/abc206_b.solver.cpp @@ -0,0 +1,29 @@ +#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; +} From d48c0c5baa0509df2d6179614607eea8fb27f3c8 Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 11:16:58 +0900 Subject: [PATCH 04/10] docs: Update examples/README.md --- examples/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/README.md b/examples/README.md index 49e13881..043ccdb1 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,6 +31,18 @@ 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 `abc206_b.py` + - AtCoder Beginner Contest 206 [B - Savings](https://atcoder.jp/contests/abc206/tasks/abc206_b) + - Simple task / 簡単な問題 + - submission at 8d1bbacd3f40a60ae8e2447c2a17a8956c7b0218: +- :heavy_check_mark: AC `abc207_b.py` + - AtCoder Beginner Contest 207 [B - Hydrate](https://atcoder.jp/contests/abc207/tasks/abc207_b) + - Simple task using jikka::floordiv / 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) + - Simple task using jikka::floordiv, reverse / 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 / 両側からの累積和 From 7e4b71e3f47f8d06a88350d6b335f48fd8d62975 Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 11:28:10 +0900 Subject: [PATCH 05/10] fix: format --- examples/data/abc206_b.solver.cpp | 31 +++++++++++----------- examples/data/abc207_b.solver.cpp | 27 +++++++++---------- examples/data/abc208_b.solver.cpp | 43 ++++++++++++++++--------------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/examples/data/abc206_b.solver.cpp b/examples/data/abc206_b.solver.cpp index 6034b0df..e7406761 100644 --- a/examples/data/abc206_b.solver.cpp +++ b/examples/data/abc206_b.solver.cpp @@ -7,23 +7,24 @@ 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; - } + int64_t c = 0; + for (int i = 1; i < 100000; ++i) { + c += i; + if (c >= N) { + return i; } - return 0; // avoid warning + } + return 0; // avoid warning } -// generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) +// 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; + 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.solver.cpp b/examples/data/abc207_b.solver.cpp index 6e8d1766..620a37ff 100644 --- a/examples/data/abc207_b.solver.cpp +++ b/examples/data/abc207_b.solver.cpp @@ -7,20 +7,21 @@ 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; + 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) +// 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; + 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.solver.cpp b/examples/data/abc208_b.solver.cpp index b04f1657..991520b0 100644 --- a/examples/data/abc208_b.solver.cpp +++ b/examples/data/abc208_b.solver.cpp @@ -7,28 +7,29 @@ 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; + 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) +// 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; + 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; } From 88cf7e476fa919b00f612dcb974eee1fc598ff3d Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 14:10:35 +0900 Subject: [PATCH 06/10] docs: Update examples/README.md --- examples/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/README.md b/examples/README.md index 043ccdb1..c4f45020 100644 --- a/examples/README.md +++ b/examples/README.md @@ -33,15 +33,15 @@ Please check also the [gallery](https://kmyk.github.io/Jikka/gallery). - submission at v5.1.0.0: - :heavy_check_mark: AC `abc206_b.py` - AtCoder Beginner Contest 206 [B - Savings](https://atcoder.jp/contests/abc206/tasks/abc206_b) - - Simple task / 簡単な問題 + - 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) - - Simple task using jikka::floordiv / jikka::floordiv を使う簡単な問題 + - 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) - - Simple task using jikka::floordiv, reverse / jikka::floordiv, reverse を使う簡単な問題 + - 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) From d4357ff2f46837aae001ccadf478e8bc13afc6c4 Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 14:16:44 +0900 Subject: [PATCH 07/10] test: Move examples/wip/abc204_b.py to examples/abc204_b.py --- examples/README.md | 4 +++ examples/{wip => }/abc204_b.py | 0 examples/data/abc204_b.large.generator.py | 18 +++++++++++++ examples/data/abc204_b.sample-1.in | 2 ++ examples/data/abc204_b.sample-1.out | 1 + examples/data/abc204_b.sample-2.in | 2 ++ examples/data/abc204_b.sample-2.out | 1 + examples/data/abc204_b.solver.cpp | 31 +++++++++++++++++++++++ 8 files changed, 59 insertions(+) rename examples/{wip => }/abc204_b.py (100%) create mode 100644 examples/data/abc204_b.large.generator.py create mode 100644 examples/data/abc204_b.sample-1.in create mode 100644 examples/data/abc204_b.sample-1.out create mode 100644 examples/data/abc204_b.sample-2.in create mode 100644 examples/data/abc204_b.sample-2.out create mode 100644 examples/data/abc204_b.solver.cpp diff --git a/examples/README.md b/examples/README.md index c4f45020..c6e746c8 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,6 +31,10 @@ 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 `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 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/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..9b61277e --- /dev/null +++ b/examples/data/abc204_b.solver.cpp @@ -0,0 +1,31 @@ +#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; +} From 50d5613228bfac4fa04b5734d0dd5eee25d1f20d Mon Sep 17 00:00:00 2001 From: uta8a Date: Sat, 7 Aug 2021 14:41:52 +0900 Subject: [PATCH 08/10] test: Move examples/wip/abc203_b.py to examples/abc203_b.py --- examples/README.md | 4 ++++ examples/{wip => }/abc203_b.py | 2 +- examples/data/abc203_b.large.generator.py | 15 ++++++++++++ examples/data/abc203_b.sample-1.in | 1 + examples/data/abc203_b.sample-1.out | 1 + examples/data/abc203_b.sample-2.in | 1 + examples/data/abc203_b.sample-2.out | 1 + examples/data/abc203_b.solver.cpp | 29 +++++++++++++++++++++++ 8 files changed, 53 insertions(+), 1 deletion(-) rename examples/{wip => }/abc203_b.py (93%) create mode 100644 examples/data/abc203_b.large.generator.py create mode 100644 examples/data/abc203_b.sample-1.in create mode 100644 examples/data/abc203_b.sample-1.out create mode 100644 examples/data/abc203_b.sample-2.in create mode 100644 examples/data/abc203_b.sample-2.out create mode 100644 examples/data/abc203_b.solver.cpp diff --git a/examples/README.md b/examples/README.md index c6e746c8..a5949f55 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,6 +31,10 @@ 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 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/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..9a07dba6 --- /dev/null +++ b/examples/data/abc203_b.solver.cpp @@ -0,0 +1,29 @@ +#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; +} From ed8539b2e67ffa639b6be99fc2ffbb523ef63254 Mon Sep 17 00:00:00 2001 From: Kimiyuki Onaka Date: Sat, 7 Aug 2021 20:46:45 +0900 Subject: [PATCH 09/10] test: Avoid using `#include ` --- examples/data/abc203_b.solver.cpp | 3 ++- examples/data/abc204_b.solver.cpp | 4 +++- examples/data/abc206_b.solver.cpp | 4 +++- examples/data/abc207_b.solver.cpp | 3 ++- examples/data/abc208_b.solver.cpp | 5 ++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/data/abc203_b.solver.cpp b/examples/data/abc203_b.solver.cpp index 9a07dba6..ee5b5cc0 100644 --- a/examples/data/abc203_b.solver.cpp +++ b/examples/data/abc203_b.solver.cpp @@ -1,4 +1,5 @@ -#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)) diff --git a/examples/data/abc204_b.solver.cpp b/examples/data/abc204_b.solver.cpp index 9b61277e..39bf9093 100644 --- a/examples/data/abc204_b.solver.cpp +++ b/examples/data/abc204_b.solver.cpp @@ -1,4 +1,6 @@ -#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)) diff --git a/examples/data/abc206_b.solver.cpp b/examples/data/abc206_b.solver.cpp index e7406761..67c7ea01 100644 --- a/examples/data/abc206_b.solver.cpp +++ b/examples/data/abc206_b.solver.cpp @@ -1,4 +1,6 @@ -#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)) diff --git a/examples/data/abc207_b.solver.cpp b/examples/data/abc207_b.solver.cpp index 620a37ff..e2fcd8b4 100644 --- a/examples/data/abc207_b.solver.cpp +++ b/examples/data/abc207_b.solver.cpp @@ -1,4 +1,5 @@ -#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)) diff --git a/examples/data/abc208_b.solver.cpp b/examples/data/abc208_b.solver.cpp index 991520b0..8af35a2c 100644 --- a/examples/data/abc208_b.solver.cpp +++ b/examples/data/abc208_b.solver.cpp @@ -1,4 +1,7 @@ -#include +#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)) From 70bed3287248c37b7fa0f5a10fa57f8bd612e855 Mon Sep 17 00:00:00 2001 From: Kimiyuki Onaka Date: Sat, 7 Aug 2021 20:52:44 +0900 Subject: [PATCH 10/10] chore: Fix scripts/add_test_cases.py about bits/stdc++.h --- scripts/add_test_cases.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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