Skip to content

Commit c990d90

Browse files
author
IsHYuhi
committed
add green and ARC001AB
1 parent 14e5cbd commit c990d90

File tree

4 files changed

+90
-4
lines changed

4 files changed

+90
-4
lines changed

Diff for: ABC/ABC147/C.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
n = int(input())
2+
3+
testimony = []
4+
a_s = []
5+
6+
for _ in range(n):
7+
a = int(input())
8+
a_s.append(a)
9+
test = [list(map(int, input().split())) for _ in range(a)]
10+
testimony.append(test)
11+
12+
def check(testimony, flags):
13+
check_list = [-1]* len(testimony)
14+
for i in range(n):
15+
if not flags[i]:
16+
continue
17+
for j in range(a_s[i]):
18+
if (testimony[i][j][1]==0 and flags[testimony[i][j][0]-1] == True) or (testimony[i][j][1]==1 and flags[testimony[i][j][0]-1] == False):
19+
return False
20+
21+
return True
22+
23+
def dfs(i, testimony, total, flags):
24+
if i == n:
25+
if check(testimony, flags):
26+
return total
27+
else:
28+
return 0
29+
30+
ans_f = dfs(i+1, testimony, total, flags[:])
31+
32+
next_testimony = testimony.copy()
33+
for j in range(a_s[i]):
34+
if next_testimony[i][j][1] == 0:
35+
flags[next_testimony[i][j][0]-1] == False
36+
37+
next_flags = flags.copy()
38+
next_flags[i] = True
39+
ans_t = dfs(i+1, next_testimony, total+1, next_flags)
40+
41+
ans = max(ans_t, ans_f)
42+
43+
return ans
44+
45+
flags = [False]*n
46+
ans = dfs(0, testimony, 0, flags)
47+
print(ans)

Diff for: ARC/ARC001/A.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from collections import Counter
2+
n = int(input())
3+
c = list(input())
4+
c = Counter(list(map(int, c)))
5+
6+
7+
mn = float('inf')
8+
mx = -1
9+
10+
if len(c)!=4:
11+
mn = 0
12+
13+
for v in c.values():
14+
mn = min(v, mn)
15+
mx = max(v, mx)
16+
17+
print(mx, end=' ')
18+
print(mn)

Diff for: ARC/ARC001/B.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
a, b = map(int, input().split())
2+
ans = 0
3+
4+
def select_button(a, b):
5+
ten = abs(abs(b-a)-10)
6+
five = abs(abs(b-a)-5)
7+
one = abs(abs(b-a)-1)
8+
9+
return min(ten, five, one)
10+
11+
def neg(a, b):
12+
if b>a:
13+
return -1
14+
else:
15+
return 1
16+
17+
while abs(b-a)!=0:
18+
ans += 1
19+
a = b+select_button(a, b)
20+
21+
print(ans)

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AtCoderの問題をpython3で解いたものになります。AC確認は行っ
88
## [AtCoder Beginner Contest](ABC)
99
| Problem A | Problem B | Problem C | Problem D | Problem E | Problem F |
1010
|:---:|:---:|:---:|:---:|:---:|:---:|
11-
|179/179 <img align="center" src="https://img.shields.io/badge/Completed!-green?style=for-the-badge"/>|179/179 <img align="center" src="https://img.shields.io/badge/Completed!-green?style=for-the-badge"/>|135/179|29/173|4/54|0/54|
11+
|179/179 <img align="center" src="https://img.shields.io/badge/Completed!-green?style=for-the-badge"/>|179/179 <img align="center" src="https://img.shields.io/badge/Completed!-green?style=for-the-badge"/>|136/179|29/173|4/54|0/54|
1212

1313

1414
### ABC001 - ABC041
@@ -107,7 +107,7 @@ AtCoderの問題をpython3で解いたものになります。AC確認は行っ
107107
|[ABC144](ABC/ABC144)|[&check;](ABC/ABC144/A.py)|[&check;](ABC/ABC144/B.py)|[&check;](ABC/ABC144/C.py)|[&check;](ABC/ABC144/D.py)|||
108108
|[ABC145](ABC/ABC145)|[&check;](ABC/ABC145/A.py)|[&check;](ABC/ABC145/B.py)|[&check;](ABC/ABC145/C.py)||||
109109
|[ABC146](ABC/ABC146)|[&check;](ABC/ABC146/A.py)|[&check;](ABC/ABC146/B.py)|[&check;](ABC/ABC146/C.py)||||
110-
|[ABC147](ABC/ABC147)|[&check;](ABC/ABC147/A.py)|[&check;](ABC/ABC147/B.py)|||||
110+
|[ABC147](ABC/ABC147)|[&check;](ABC/ABC147/A.py)|[&check;](ABC/ABC147/B.py)|[&check;](ABC/ABC147/C.py)||||
111111
|[ABC148](ABC/ABC148)|[&check;](ABC/ABC148/A.py)|[&check;](ABC/ABC148/B.py)|[&check;](ABC/ABC148/C.py)|[&check;](ABC/ABC148/D.py)|||
112112
|[ABC149](ABC/ABC149)|[&check;](ABC/ABC149/A.py)|[&check;](ABC/ABC149/B.py)|[&check;](ABC/ABC149/C.py)|[&check;](ABC/ABC149/D.py)|||
113113
|[ABC150](ABC/ABC150)|[&check;](ABC/ABC150/A.py)|[&check;](ABC/ABC150/B.py)|[&check;](ABC/ABC150/C.py)||||
@@ -132,12 +132,12 @@ AtCoderの問題をpython3で解いたものになります。AC確認は行っ
132132
## [AtCoder Regular Contest](ARC)
133133
| Problem A | Problem B | Problem C | Problem D | Problem E | Problem F |
134134
|:---:|:---:|:---:|:---:|:---:|:---:|
135-
|30/104|1/104|0/104|0/104|0/1|0/1|
135+
|31/104|2/104|0/104|0/104|0/1|0/1|
136136

137137
### ARC001 - ARC103
138138
|コンテスト| A | B | C | D ||コンテスト| A | B | C | D |
139139
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
140-
|[ARC001](ARC/ARC001)| - | - | - | - ||[ARC053](ARC/ARC053)| - | - | - | - |
140+
|[ARC001](ARC/ARC001)|[&check;](ARC/ARC001/A.py)|[&check;](ARC/ARC001/B.py)| - | - ||[ARC053](ARC/ARC053)| - | - | - | - |
141141
|[ARC002](ARC/ARC002)| - | - | - | - ||[ARC054](ARC/ARC054)| - | - | - | - |
142142
|[ARC003](ARC/ARC003)| - | - | - | - ||[ARC055](ARC/ARC055)| - | - | - | - |
143143
|[ARC004](ARC/ARC004)| - | - | - | - ||[ARC056](ARC/ARC056)| - | - | - | - |

0 commit comments

Comments
 (0)