[READ-ONLY] Mirror of https://github.com/shuuji3/competitive-programming. 🛫 Codes submitted to competitive programming platforms
aizu-online-jadge aoj atcoder hackerrank leetcode
0

Configure Feed

Select the types of activity you want to include in your feed.

Create atcoder directory and add ABC192 code.

+477
+12
atcoder/abc192_a/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + X = random.randint(1, 10 ** 9) # TODO: edit here 9 + print(X) 10 + 11 + if __name__ == "__main__": 12 + main()
+17
atcoder/abc192_a/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + 5 + 6 + # def solve(X: int) -> int: 7 + def solve(X): 8 + return 100 - (X % 100) 9 + 10 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 11 + def main(): 12 + X = int(input()) 13 + a = solve(X) 14 + print(a) 15 + 16 + if __name__ == '__main__': 17 + main()
+1
atcoder/abc192_a/test/sample-1.in
··· 1 + 140
+1
atcoder/abc192_a/test/sample-1.out
··· 1 + 60
+1
atcoder/abc192_a/test/sample-2.in
··· 1 + 1000
+1
atcoder/abc192_a/test/sample-2.out
··· 1 + 100
+12
atcoder/abc192_b/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + S = ''.join([random.choice('abcde') for _ in range(random.randint(1, 100))]) # TODO: edit here 9 + print(S) 10 + 11 + if __name__ == "__main__": 12 + main()
+25
atcoder/abc192_b/main.cpp
··· 1 + #include <bits/stdc++.h> 2 + #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) 3 + #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) 4 + #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) 5 + #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) 6 + #define ALL(x) ::std::begin(x), ::std::end(x) 7 + using namespace std; 8 + 9 + const string YES = "Yes"; 10 + const string NO = "No"; 11 + bool solve(string S) { 12 + // TODO: edit here 13 + } 14 + 15 + // generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 16 + int main() { 17 + std::ios::sync_with_stdio(false); 18 + std::cin.tie(nullptr); 19 + constexpr char endl = '\n'; 20 + string S; 21 + cin >> S; 22 + auto ans = solve(S); 23 + cout << (ans ? YES : NO) << endl; 24 + return 0; 25 + }
+32
atcoder/abc192_b/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + YES = 'Yes' 5 + NO = 'No' 6 + 7 + import string 8 + 9 + def is_unreadable(s): 10 + for i, c in enumerate(s): 11 + if i % 2 == 0 and c in string.ascii_lowercase: 12 + continue 13 + if i % 2 == 1 and c in string.ascii_uppercase: 14 + continue 15 + return False 16 + return True 17 + 18 + # def solve(S: str) -> str: 19 + def solve(S): 20 + if is_unreadable(S): 21 + return YES 22 + else: 23 + return NO 24 + 25 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 26 + def main(): 27 + S = input() 28 + a = solve(S) 29 + print(a) 30 + 31 + if __name__ == '__main__': 32 + main()
+1
atcoder/abc192_b/test/sample-1.in
··· 1 + dIfFiCuLt
+1
atcoder/abc192_b/test/sample-1.out
··· 1 + Yes
+1
atcoder/abc192_b/test/sample-2.in
··· 1 + eASY
+1
atcoder/abc192_b/test/sample-2.out
··· 1 + No
+1
atcoder/abc192_b/test/sample-3.in
··· 1 + a
+1
atcoder/abc192_b/test/sample-3.out
··· 1 + Yes
+13
atcoder/abc192_c/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + N = random.randint(1, 10 ** 9) # TODO: edit here 9 + K = random.randint(1, 10 ** 9) # TODO: edit here 10 + print(N, K) 11 + 12 + if __name__ == "__main__": 13 + main()
+24
atcoder/abc192_c/main.cpp
··· 1 + #include <bits/stdc++.h> 2 + #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) 3 + #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) 4 + #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) 5 + #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) 6 + #define ALL(x) ::std::begin(x), ::std::end(x) 7 + using namespace std; 8 + 9 + 10 + int64_t solve(int64_t N, int64_t K) { 11 + // TODO: edit here 12 + } 13 + 14 + // generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 15 + int main() { 16 + std::ios::sync_with_stdio(false); 17 + std::cin.tie(nullptr); 18 + constexpr char endl = '\n'; 19 + int64_t N, K; 20 + cin >> N >> K; 21 + auto ans = solve(N, K); 22 + cout << ans << endl; 23 + return 0; 24 + }
+26
atcoder/abc192_c/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + def g1(n): 5 + return int(''.join(reversed(sorted(str(n))))) 6 + 7 + def g2(n): 8 + return int(''.join(sorted(str(n)))) 9 + 10 + def f(n): 11 + return g1(n) - g2(n) 12 + 13 + # def solve(N: int, K: int) -> int: 14 + def solve(N, K): 15 + for i in range(K): 16 + N = f(N) 17 + return N 18 + 19 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 20 + def main(): 21 + N, K = map(int, input().split()) 22 + a = solve(N, K) 23 + print(a) 24 + 25 + if __name__ == '__main__': 26 + main()
+1
atcoder/abc192_c/test/sample-1.in
··· 1 + 314 2
+1
atcoder/abc192_c/test/sample-1.out
··· 1 + 693
+1
atcoder/abc192_c/test/sample-2.in
··· 1 + 1000000000 100
+1
atcoder/abc192_c/test/sample-2.out
··· 1 + 0
+1
atcoder/abc192_c/test/sample-3.in
··· 1 + 6174 100000
+1
atcoder/abc192_c/test/sample-3.out
··· 1 + 6174
+14
atcoder/abc192_d/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + X = ''.join([random.choice('abcde') for _ in range(random.randint(1, 100))]) # TODO: edit here 9 + M = random.randint(1, 10 ** 9) # TODO: edit here 10 + print(X) 11 + print(M) 12 + 13 + if __name__ == "__main__": 14 + main()
+25
atcoder/abc192_d/main.cpp
··· 1 + #include <bits/stdc++.h> 2 + #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) 3 + #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) 4 + #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) 5 + #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) 6 + #define ALL(x) ::std::begin(x), ::std::end(x) 7 + using namespace std; 8 + 9 + 10 + int64_t solve(string X, int64_t M) { 11 + // TODO: edit here 12 + } 13 + 14 + // generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 15 + int main() { 16 + std::ios::sync_with_stdio(false); 17 + std::cin.tie(nullptr); 18 + constexpr char endl = '\n'; 19 + int64_t X; 20 + int64_t M; 21 + cin >> X >> M; 22 + auto ans = solve(X, M); 23 + cout << ans << endl; 24 + return 0; 25 + }
+23
atcoder/abc192_d/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + # def solve(X: str, M: int) -> int: 5 + def solve(X, M): 6 + base = int(max(list(X))) + 1 7 + count = 0 8 + 9 + while base <= 36 and int(X, base=base) <= M: 10 + count += 1 11 + base += 1 12 + 13 + return count 14 + 15 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 16 + def main(): 17 + X = input() 18 + M = int(input()) 19 + a = solve(X, M) 20 + print(a) 21 + 22 + if __name__ == '__main__': 23 + main()
+2
atcoder/abc192_d/test/sample-1.in
··· 1 + 22 2 + 10
+1
atcoder/abc192_d/test/sample-1.out
··· 1 + 2
+2
atcoder/abc192_d/test/sample-2.in
··· 1 + 999 2 + 1500
+1
atcoder/abc192_d/test/sample-2.out
··· 1 + 3
+2
atcoder/abc192_d/test/sample-3.in
··· 1 + 100000000000000000000000000000000000000000000000000000000000 2 + 1000000000000000000
+1
atcoder/abc192_d/test/sample-3.out
··· 1 + 1
+2
atcoder/abc192_d/wa.txt
··· 1 + https://atcoder.jp/contests/abc192/submissions/20313373 2 +
+26
atcoder/abc192_e/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + N = random.randint(1, 10) # TODO: edit here 9 + M = random.randint(1, 10) # TODO: edit here 10 + A = [None for _ in range(M)] 11 + B = [None for _ in range(M)] 12 + T = [None for _ in range(M)] 13 + K = [None for _ in range(M)] 14 + X = random.randint(1, 10) # TODO: edit here 15 + Y = random.randint(1, 10) # TODO: edit here 16 + for i in range(M): 17 + A[i] = random.randint(1, 10) # TODO: edit here 18 + B[i] = random.randint(1, 10) # TODO: edit here 19 + T[i] = random.randint(1, 10) # TODO: edit here 20 + K[i] = random.randint(1, 10) # TODO: edit here 21 + print(N, M, X, Y) 22 + for i in range(M): 23 + print(A[i], B[i], T[i], K[i]) 24 + 25 + if __name__ == "__main__": 26 + main()
+29
atcoder/abc192_e/main.cpp
··· 1 + #include <bits/stdc++.h> 2 + #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) 3 + #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) 4 + #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) 5 + #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) 6 + #define ALL(x) ::std::begin(x), ::std::end(x) 7 + using namespace std; 8 + 9 + 10 + int64_t solve(auto N, auto M, auto X, auto Y, const vector<auto> & A, const vector<auto> & B, const vector<auto> & T, const vector<auto> & K) { 11 + // TODO: edit here 12 + } 13 + 14 + // generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 15 + int main() { 16 + std::ios::sync_with_stdio(false); 17 + std::cin.tie(nullptr); 18 + constexpr char endl = '\n'; 19 + auto N, M, X, Y; 20 + cin >> N >> M; 21 + vector<auto> A(M), B(M), T(M), K(M); 22 + cin >> X >> Y; 23 + REP (i, M) { 24 + cin >> A[i] >> B[i] >> T[i] >> K[i]; 25 + } 26 + auto ans = solve(N, M, X, Y, A, B, T, K); 27 + cout << ans << endl; 28 + return 0; 29 + }
+23
atcoder/abc192_e/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + 5 + 6 + # def solve(N: str, M: str, X: str, Y: str, A: List[str], B: List[str], T: List[str], K: List[str]) -> int: 7 + def solve(N, M, X, Y, A, B, T, K): 8 + pass # TODO: edit here 9 + 10 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 11 + def main(): 12 + N, M, X, Y = input().split() 13 + A = [None for _ in range(M)] 14 + B = [None for _ in range(M)] 15 + T = [None for _ in range(M)] 16 + K = [None for _ in range(M)] 17 + for i in range(M): 18 + A[i], B[i], T[i], K[i] = input().split() 19 + a = solve(N, M, X, Y, A, B, T, K) 20 + print(a) 21 + 22 + if __name__ == '__main__': 23 + main()
+3
atcoder/abc192_e/test/sample-1.in
··· 1 + 3 2 1 3 2 + 1 2 2 3 3 + 2 3 3 4
+1
atcoder/abc192_e/test/sample-1.out
··· 1 + 7
+3
atcoder/abc192_e/test/sample-2.in
··· 1 + 3 2 3 1 2 + 1 2 2 3 3 + 2 3 3 4
+1
atcoder/abc192_e/test/sample-2.out
··· 1 + 5
+1
atcoder/abc192_e/test/sample-3.in
··· 1 + 3 0 3 1
+1
atcoder/abc192_e/test/sample-3.out
··· 1 + -1
+15
atcoder/abc192_e/test/sample-4.in
··· 1 + 9 14 6 7 2 + 3 1 4 1 3 + 5 9 2 6 4 + 5 3 5 8 5 + 9 7 9 3 6 + 2 3 8 4 7 + 6 2 6 4 8 + 3 8 3 2 9 + 7 9 5 2 10 + 8 4 1 9 11 + 7 1 6 9 12 + 3 9 9 3 13 + 7 5 1 5 14 + 8 2 9 7 15 + 4 9 4 4
+1
atcoder/abc192_e/test/sample-4.out
··· 1 + 26
+17
atcoder/abc192_f/generate.py
··· 1 + #!/usr/bin/env python3 2 + # usage: $ oj generate-input 'python3 generate.py' 3 + # usage: $ oj generate-input --hack-actual=./a.out --hack-expected=./naive 'python3 generate.py' 4 + import random 5 + 6 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 7 + def main(): 8 + N = random.randint(1, 1000) # TODO: edit here 9 + A = [None for _ in range(N)] 10 + X = random.randint(1, 10 ** 9) # TODO: edit here 11 + for i in range(N): 12 + A[i] = random.randint(1, 10 ** 9) # TODO: edit here 13 + print(N, X) 14 + print(*[A[i] for i in range(N)]) 15 + 16 + if __name__ == "__main__": 17 + main()
+30
atcoder/abc192_f/main.cpp
··· 1 + #include <bits/stdc++.h> 2 + #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) 3 + #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) 4 + #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) 5 + #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) 6 + #define ALL(x) ::std::begin(x), ::std::end(x) 7 + using namespace std; 8 + 9 + 10 + int64_t solve(int N, int64_t X, const vector<int64_t> & A) { 11 + // TODO: edit here 12 + } 13 + 14 + // generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 15 + int main() { 16 + std::ios::sync_with_stdio(false); 17 + std::cin.tie(nullptr); 18 + constexpr char endl = '\n'; 19 + int64_t N; 20 + int64_t X; 21 + cin >> N; 22 + vector<int64_t> A(N); 23 + cin >> X; 24 + REP (i, N) { 25 + cin >> A[i]; 26 + } 27 + auto ans = solve(N, X, A); 28 + cout << ans << endl; 29 + return 0; 30 + }
+45
atcoder/abc192_f/main.py
··· 1 + #!/usr/bin/env python3 2 + # from typing import * 3 + 4 + from itertools import chain, combinations 5 + 6 + # ref. 9.7. itertools — Functions creating iterators for efficient looping — Python 2.7.18 documentation 7 + # - https://docs.python.org/2/library/itertools.html#recipes 8 + def powerset(iterable): 9 + "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)" 10 + s = list(iterable) 11 + return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) 12 + 13 + # def solve(N: int, X: int, A: List[int]) -> int: 14 + def solve(N, X, A): 15 + answer_candidates = [] 16 + for s in powerset(range(N)): 17 + if len(s) == 0: 18 + continue # skip () tuple 19 + k = len(s) 20 + init = 0 21 + for i in s: 22 + init += A[i] 23 + 24 + # cross point between the time-power line and target 25 + t = (X - init) / k 26 + if t % 1 == 0: # t should be integer 27 + answer_candidates.append(int(t)) 28 + 29 + return min(answer_candidates) 30 + 31 + # generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator) 32 + def main(): 33 + import sys 34 + tokens = iter(sys.stdin.read().split()) 35 + N = int(next(tokens)) 36 + X = int(next(tokens)) 37 + A = [None for _ in range(N)] 38 + for i in range(N): 39 + A[i] = int(next(tokens)) 40 + assert next(tokens, None) is None 41 + a = solve(N, X, A) 42 + print(a) 43 + 44 + if __name__ == '__main__': 45 + main()
+2
atcoder/abc192_f/test/sample-1.in
··· 1 + 3 9999999999 2 + 3 6 8
+1
atcoder/abc192_f/test/sample-1.out
··· 1 + 4999999994
+2
atcoder/abc192_f/test/sample-2.in
··· 1 + 1 1000000000000000000 2 + 1
+1
atcoder/abc192_f/test/sample-2.out
··· 1 + 999999999999999999
+25
atcoder/abc192_f/wa.txt
··· 1 + > oj test -c "python3 main.py" 2 + [INFO] online-judge-tools 11.1.2 (+ online-judge-api-client 10.8.0) 3 + [INFO] 2 cases found 4 + 5 + [INFO] sample-1 6 + [INFO] time: 0.041757 sec 7 + [SUCCESS] AC 8 + 9 + [INFO] sample-2 10 + [INFO] time: 0.045862 sec 11 + [FAILURE] WA 12 + input: 13 + 1 1000000000000000000 14 + 1 15 + 16 + output: 17 + 1000000000000000000 18 + 19 + expected: 20 + 999999999999999999 21 + 22 + 23 + [INFO] slowest: 0.045862 sec (for sample-2) 24 + [INFO] max memory: 9.332000 MB (for sample-1) 25 + [FAILURE] test failed: 1 AC / 2 cases