Skip to content

Commit b1209d1

Browse files
committed
🥺chore
1 parent 7098805 commit b1209d1

File tree

6 files changed

+265
-1
lines changed

6 files changed

+265
-1
lines changed

abc124/a/main.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!usr/bin/env python3
2+
from collections import defaultdict, deque, Counter, OrderedDict
3+
from bisect import bisect_left, bisect_right
4+
from functools import reduce, lru_cache
5+
from heapq import heappush, heappop, heapify
6+
7+
from itertools import *
8+
import math, fractions
9+
import sys, copy
10+
11+
def L(): return sys.stdin.readline().split()
12+
def I(): return int(sys.stdin.readline().rstrip())
13+
def SL(): return list(sys.stdin.readline().rstrip())
14+
def LI(): return [int(x) for x in sys.stdin.readline().split()]
15+
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
16+
def LS(): return [list(x) for x in sys.stdin.readline().split()]
17+
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
18+
def LR(n): return [L() for _ in range(n)]
19+
def IR(n): return [I() for _ in range(n)]
20+
def LIR(n): return [LI() for _ in range(n)]
21+
def LIR1(n): return [LI1() for _ in range(n)]
22+
def SLR(n): return [SL() for _ in range(n)]
23+
def LSR(n): return [LS() for _ in range(n)]
24+
25+
def perm(n, r): return math.factorial(n) // math.factorial(r)
26+
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
27+
def powerset(iterable):
28+
s = list(iterable)
29+
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
30+
31+
def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if args else [default for _ in range(n)]
32+
33+
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
34+
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
35+
alphabets = "abcdefghijklmnopqrstuvwxyz"
36+
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
37+
MOD = 1000000007
38+
INF = float("inf")
39+
40+
sys.setrecursionlimit(1000000)
41+
42+
def main():
43+
N = I()
44+
45+
if __name__ == '__main__':
46+
main()

abc124/b/main.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!usr/bin/env python3
2+
from collections import defaultdict, deque, Counter, OrderedDict
3+
from bisect import bisect_left, bisect_right
4+
from functools import reduce, lru_cache
5+
from heapq import heappush, heappop, heapify
6+
7+
from itertools import *
8+
import math, fractions
9+
import sys, copy
10+
11+
def L(): return sys.stdin.readline().split()
12+
def I(): return int(sys.stdin.readline().rstrip())
13+
def SL(): return list(sys.stdin.readline().rstrip())
14+
def LI(): return [int(x) for x in sys.stdin.readline().split()]
15+
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
16+
def LS(): return [list(x) for x in sys.stdin.readline().split()]
17+
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
18+
def LR(n): return [L() for _ in range(n)]
19+
def IR(n): return [I() for _ in range(n)]
20+
def LIR(n): return [LI() for _ in range(n)]
21+
def LIR1(n): return [LI1() for _ in range(n)]
22+
def SLR(n): return [SL() for _ in range(n)]
23+
def LSR(n): return [LS() for _ in range(n)]
24+
25+
def perm(n, r): return math.factorial(n) // math.factorial(r)
26+
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
27+
def powerset(iterable):
28+
s = list(iterable)
29+
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
30+
31+
def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if args else [default for _ in range(n)]
32+
33+
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
34+
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
35+
alphabets = "abcdefghijklmnopqrstuvwxyz"
36+
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
37+
MOD = 1000000007
38+
INF = float("inf")
39+
40+
sys.setrecursionlimit(1000000)
41+
42+
def main():
43+
N = I()
44+
45+
if __name__ == '__main__':
46+
main()

abc124/c/main.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!usr/bin/env python3
2+
from collections import defaultdict, deque, Counter, OrderedDict
3+
from bisect import bisect_left, bisect_right
4+
from functools import reduce, lru_cache
5+
from heapq import heappush, heappop, heapify
6+
7+
from itertools import *
8+
import math, fractions
9+
import sys, copy
10+
11+
def L(): return sys.stdin.readline().split()
12+
def I(): return int(sys.stdin.readline().rstrip())
13+
def SL(): return list(sys.stdin.readline().rstrip())
14+
def LI(): return [int(x) for x in sys.stdin.readline().split()]
15+
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
16+
def LS(): return [list(x) for x in sys.stdin.readline().split()]
17+
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
18+
def LR(n): return [L() for _ in range(n)]
19+
def IR(n): return [I() for _ in range(n)]
20+
def LIR(n): return [LI() for _ in range(n)]
21+
def LIR1(n): return [LI1() for _ in range(n)]
22+
def SLR(n): return [SL() for _ in range(n)]
23+
def LSR(n): return [LS() for _ in range(n)]
24+
25+
def perm(n, r): return math.factorial(n) // math.factorial(r)
26+
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
27+
def powerset(iterable):
28+
s = list(iterable)
29+
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
30+
31+
def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if args else [default for _ in range(n)]
32+
33+
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
34+
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
35+
alphabets = "abcdefghijklmnopqrstuvwxyz"
36+
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
37+
MOD = 1000000007
38+
INF = float("inf")
39+
40+
sys.setrecursionlimit(1000000)
41+
42+
def main():
43+
N = I()
44+
45+
if __name__ == '__main__':
46+
main()

abc124/contest.acc.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"contest": {
3+
"id": "abc124",
4+
"title": "AtCoder Beginner Contest 124",
5+
"url": "https://atcoder.jp/contests/abc124"
6+
},
7+
"tasks": [
8+
{
9+
"id": "abc124_a",
10+
"label": "A",
11+
"title": "Buttons",
12+
"url": "https://atcoder.jp/contests/abc124/tasks/abc124_a",
13+
"directory": {
14+
"path": "a",
15+
"testdir": "test",
16+
"submit": "main.py"
17+
}
18+
},
19+
{
20+
"id": "abc124_b",
21+
"label": "B",
22+
"title": "Great Ocean View",
23+
"url": "https://atcoder.jp/contests/abc124/tasks/abc124_b",
24+
"directory": {
25+
"path": "b",
26+
"testdir": "test",
27+
"submit": "main.py"
28+
}
29+
},
30+
{
31+
"id": "abc124_c",
32+
"label": "C",
33+
"title": "Coloring Colorfully",
34+
"url": "https://atcoder.jp/contests/abc124/tasks/abc124_c",
35+
"directory": {
36+
"path": "c",
37+
"testdir": "test",
38+
"submit": "main.py"
39+
}
40+
},
41+
{
42+
"id": "abc124_d",
43+
"label": "D",
44+
"title": "Handstand",
45+
"url": "https://atcoder.jp/contests/abc124/tasks/abc124_d",
46+
"directory": {
47+
"path": "d",
48+
"testdir": "test",
49+
"submit": "main.py"
50+
}
51+
}
52+
]
53+
}

abc124/d/main.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!usr/bin/env python3
2+
from collections import defaultdict, deque, Counter, OrderedDict
3+
from bisect import bisect_left, bisect_right
4+
from functools import reduce, lru_cache
5+
from heapq import heappush, heappop, heapify
6+
7+
from itertools import *
8+
import math, fractions
9+
import sys, copy
10+
11+
def L(): return sys.stdin.readline().split()
12+
def I(): return int(sys.stdin.readline().rstrip())
13+
def SL(): return list(sys.stdin.readline().rstrip())
14+
def LI(): return [int(x) for x in sys.stdin.readline().split()]
15+
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
16+
def LS(): return [list(x) for x in sys.stdin.readline().split()]
17+
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
18+
def LR(n): return [L() for _ in range(n)]
19+
def IR(n): return [I() for _ in range(n)]
20+
def LIR(n): return [LI() for _ in range(n)]
21+
def LIR1(n): return [LI1() for _ in range(n)]
22+
def SLR(n): return [SL() for _ in range(n)]
23+
def LSR(n): return [LS() for _ in range(n)]
24+
25+
def perm(n, r): return math.factorial(n) // math.factorial(r)
26+
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
27+
def powerset(iterable):
28+
s = list(iterable)
29+
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
30+
31+
def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if args else [default for _ in range(n)]
32+
33+
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
34+
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
35+
alphabets = "abcdefghijklmnopqrstuvwxyz"
36+
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
37+
MOD = 1000000007
38+
INF = float("inf")
39+
40+
sys.setrecursionlimit(1000000)
41+
42+
def main():
43+
N, K = LI()
44+
S = SL()
45+
46+
tmp = []
47+
cnt = 1
48+
for i in range(1, N):
49+
if S[i-1] == S[i]:
50+
cnt += 1
51+
else:
52+
tmp.append((cnt, abs(int(S[i-1]) - 1)))
53+
cnt = 1
54+
tmp.append((cnt, abs(int(S[-1]) - 1)))
55+
56+
ans = 0
57+
left = 0
58+
now = 0
59+
k = 0
60+
for right in range(len(tmp)):
61+
now += tmp[right][0]
62+
k += tmp[right][1]
63+
while k > K:
64+
now -= tmp[left][0]
65+
k -= tmp[left][1]
66+
left += 1
67+
ans = max(ans, now)
68+
print(ans)
69+
70+
71+
72+
if __name__ == '__main__':
73+
main()

abc180/d/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def main():
4040
X, Y, A, B = LI()
4141
ans = 0
4242
C = X * (A - 1)
43-
while C <= B:
43+
while C <= B and X * A < Y:
4444
X *= A
4545
C = X * (A - 1)
4646
ans += 1

0 commit comments

Comments
 (0)