s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s361175317
p00025
u150984829
1516989632
Python
Python3
py
Accepted
20
5556
141
import sys e=iter(map(lambda a:a.split(),sys.stdin)) for a,b in zip(e,e): h=0 for s,t in zip(a,b):h+=s==t print(h,4-len(set(a)-set(b))-h)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,802
s592859844
p00025
u150984829
1516989819
Python
Python3
py
Accepted
20
5564
141
import sys e=iter(sys.stdin) for a,b in zip(e,e): a,b,h=a.split(),b.split(),0 for s,t in zip(a,b):h+=s==t print(h,4-len(set(a)-set(b))-h)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,803
s025620856
p00025
u150984829
1516989849
Python
Python3
py
Accepted
20
5560
141
import sys e=iter(map(lambda a:a.split(),sys.stdin)) for a,b in zip(e,e): h=0 for s,t in zip(a,b):h+=s==t print(h,4-len(set(a)-set(b))-h)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,804
s385941929
p00025
u166871988
1523781342
Python
Python3
py
Accepted
20
5600
247
while True: try: a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] except:break hit=sum([1 for i in range(4) if a[i]==b[i]]) blow=8-len(set(a)|set(b))-hit print("{0} {1}".format(hit,blow))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,805
s035214841
p00025
u553148578
1523841961
Python
Python3
py
Accepted
20
5596
217
while 1: hit = blow = 0 try: a = list(map(int,input().split())) except: break b = list(map(int,input().split())) for i in range(4): if a[i] == b[i]: hit += 1 elif a[i] in b: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,806
s305428199
p00025
u898097781
1525326341
Python
Python3
py
Accepted
20
5560
315
import sys a = [] for line in sys.stdin: a.append(line.strip()) ita = iter(a) for a, b in zip(ita, ita): hit = 0 blow = 0 a = a.split(' ') b = b.split(' ') for a_, b_ in zip(a, b): if a_ == b_: hit += 1 elif a_ in b: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,807
s480809804
p00025
u724548524
1525851995
Python
Python3
py
Accepted
20
5592
371
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = 0 blow = 0 for i in range(4): try: if i == a.index(b[i]): hit += 1 else: blow += 1 except: pass print("{} {}".format(hit, blow))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,808
s165153238
p00025
u306037418
1526549766
Python
Python3
py
Accepted
30
5596
360
import sys count = 0 for line in sys.stdin: if count % 2 == 0: a = list(map(int, line.split())) else: b = list(map(int, line.split())) hit, brow = 0, 0 for i in range(4): if a[i] == b[i]: hit += 1 elif a[i] in b: brow += 1 print(hit, brow) count += 1
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,809
s717650805
p00025
u136916346
1527391326
Python
Python3
py
Accepted
20
5608
354
import sys res=[] for (l,text) in enumerate(sys.stdin): if not l%2: a=list(map(int,text.split())) else: h=0 b=0 for (i,j) in enumerate(map(int,text.split())): if a[i]==j: h=h+1 elif j in a: b=b+1 res.extend([[h,b]]) [print(i[0],i[1]) for i in res]
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,810
s702426423
p00025
u352394527
1527447178
Python
Python3
py
Accepted
30
5560
305
while True: try: alst = input().split() blst = input().split() hit = brow = 0 for i in range(4): for j in range(4): if alst[i] == blst[j]: if i == j: hit += 1 else: brow += 1 print(hit, brow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,811
s382744504
p00025
u847467233
1529126924
Python
Python3
py
Accepted
20
5596
324
# AOJ 0025 Hit and Blow # Python3 2018.6.16 bal4u while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 b[i] = -1 for i in range(4): if b[i] >= 0: if b[i] in a: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,812
s310192054
p00025
u575065019
1345573988
Python
Python
py
Accepted
20
4240
411
ans = [] while True: try: a = map(int,raw_input().split()) except EOFError: break b = map(int,raw_input().split()) n = 0 m = 0 for i in range(4): if a[i] == b[i]: n += 1 for i in range(0,4): for j in range(0,4): if a[i] == b[j]: m += 1 m -= n ans.append(str(n)+' '+str(m)) for i in ans: print i
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,813
s378553302
p00025
u460331583
1346003046
Python
Python
py
Accepted
10
4248
399
while True: try: hit=0 brow=0 a = map(int,raw_input().split()) a1,b1,c1,d1 = a[0],a[1],a[2],a[3] b = map(int,raw_input().split()) a2,b2,c2,d2 = b[0],b[1],b[2],b[3] for c in range(4): if a[c] == b[c]: hit +=1 for d in range(4): if a[c]==b[d]: if c == d: break brow += 1 print hit,brow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,814
s664176285
p00025
u894941280
1346003054
Python
Python
py
Accepted
10
4252
399
while True: try: hit=0 brow=0 a = map(int,raw_input().split()) a1,b1,c1,d1 = a[0],a[1],a[2],a[3] b = map(int,raw_input().split()) a2,b2,c2,d2 = b[0],b[1],b[2],b[3] for c in range(4): if a[c] == b[c]: hit +=1 for d in range(4): if a[c]==b[d]: if c == d: break brow += 1 print hit,brow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,815
s137695408
p00025
u460331583
1346585219
Python
Python
py
Accepted
10
4228
258
while True: try: hit=0 blow =0 a,b = raw_input(),raw_input() for x in range(0,7,2): for y in range(0,7,2): if a[x] == b[y]: if x == y: hit+=1 else: blow +=1 print hit,blow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,816
s821703733
p00025
u894941280
1346585227
Python
Python
py
Accepted
10
4228
258
while True: try: hit=0 blow =0 a,b = raw_input(),raw_input() for x in range(0,7,2): for y in range(0,7,2): if a[x] == b[y]: if x == y: hit+=1 else: blow +=1 print hit,blow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,817
s601192502
p00025
u724947062
1347272388
Python
Python
py
Accepted
20
5396
457
import sys def calc(listA, listB): hit = 0 for i, j in zip(listA, listB): if i == j: hit += 1 brow = len(set(listA) & set(listB)) return (hit, brow-hit) listA = list() listB = list() for i, line in enumerate(sys.stdin.readlines()): line = line.strip() if i % 2 == 0: listA = map(int, line.split()) else: listB = map(int, line.split()) print "{0:d} {1:d}".format(*calc(listA, listB))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,818
s975239913
p00025
u647766105
1355467064
Python
Python
py
Accepted
10
5424
264
import sys line=sys.stdin.readlines() for A,B in zip(line[0::2],line[1::2]): a=map(int,A.strip().split()) b=map(int,B.strip().split()) hit,blow=0,0 for i in xrange(4): if a[i]==b[i]:hit+=1 elif a[i] in b : blow+=1 print hit,blow
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,819
s080158742
p00025
u504990413
1355566007
Python
Python
py
Accepted
10
4236
423
while True: try: listA = map(str,raw_input().split(' ')) listB = map(str,raw_input().split(' ')) hit=0 blw=0 for tB in listB: if (tB in listA) and (listB.index(tB) == listA.index(tB)): hit += 1 elif (tB in listA) and (listB.index(tB) != listA.index(tB)): blw += 1 print hit,blw except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,820
s829768937
p00025
u419407022
1356120707
Python
Python
py
Accepted
10
23000
272
while True: try: a = raw_input().split() b = raw_input().split() hit = reduce(lambda x,y:x+y,map(lambda x,y:x==y,a,b)) blow = reduce(lambda x,y:x+y,map(lambda x:x in b,a)) - hit print hit, blow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,821
s789939670
p00025
u782850731
1362244600
Python
Python
py
Accepted
20
4240
431
from __future__ import (division, absolute_import, print_function, unicode_literals) from sys import stdin while True: a = stdin.readline().strip() if not a: break b = stdin.readline().strip() if a == b: print('4 0') continue hit = sum(int(a[i] == b[i]) for i in xrange(0, 7, 2)) blow = sum(int(b[i] in a) for i in xrange(0, 7, 2)) - hit print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,822
s836431083
p00025
u912237403
1378020111
Python
Python
py
Accepted
10
4224
289
while True: try: a=map(int,raw_input().split()) b=map(int,raw_input().split()) c1=0 c2=0 for i,e in enumerate(b): if e in a: if e==a[i]: c1+=1 else: c2+=1 print c1, c2 except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,823
s109097867
p00025
u813384600
1380542441
Python
Python
py
Accepted
10
4228
391
while True: try: a = map(int, raw_input().split()) b = map(int, raw_input().split()) hit,blow = 0,0 for i in range(4): if a[i] == b[i]: hit += 1 else: for j in range(4): if a[i] == b[j]: blow += 1 print hit, blow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,824
s188693932
p00025
u523886269
1381547479
Python
Python
py
Accepted
20
4228
400
import sys while True: try: a = map(int, raw_input().strip().split()) b = map(int, raw_input().strip().split()) hit = 0 blow = 0 for i in xrange(len(b)): if b[i] in a: blow += 1 if b[i] == a[i]: hit += 1 blow -= hit print "%d %d" % (hit, blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,825
s739962527
p00025
u093607836
1384840189
Python
Python
py
Accepted
20
4212
226
while 1: try: a = map(int,raw_input().split()) b = map(int,raw_input().split()) c,d = 0,0 for i in enumerate(b): if i[1] in a: if a[i[0]] == i[1]: c += 1 else: d += 1 print c,d except: exit()
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,826
s667370717
p00025
u633068244
1393387169
Python
Python
py
Accepted
10
4212
329
while True: try: a = map(int, raw_input().split()) b = map(int, raw_input().split()) hit = 0; brow = 0 for i in range(len(b)) : brow += a.count(b[i]) if a[i] == b[i] : hit += 1 brow -= 1 print hit, brow except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,827
s480718581
p00025
u912237403
1394291493
Python
Python
py
Accepted
20
4204
225
import sys f=0 for s in sys.stdin: f=1-f b=map(int,s.split()) if f: a=b continue c1=0 c2=0 for i,e in enumerate(b): if e==a[i]: c1+=1 elif e in a: c2+=1 print c1, c2
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,828
s509838873
p00025
u912237403
1394291676
Python
Python
py
Accepted
10
4208
235
import sys f=1 for s in sys.stdin: b=map(int,s.split()) if f: a=b f=0 continue c1=0 c2=0 for i,e in enumerate(b): if e==a[i]: c1+=1 elif e in a: c2+=1 print c1, c2 f=1
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,829
s509403977
p00025
u193025715
1395415499
Python
Python
py
Accepted
10
4208
267
while True: try: a = map(int, raw_input().split()) b = map(int, raw_input().split()) hit = 0 blow = 0 for na, nb in zip(a, b): if na == nb: hit += 1 if nb in a: blow += 1 blow = blow - hit print "{} {}".format(hit, blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,830
s962477521
p00025
u491763171
1396400771
Python
Python
py
Accepted
10
4208
248
while 1: try: A = map(int, raw_input().split()) B = map(int, raw_input().split()) hit = sum(1 for i in range(4) if A[i] == B[i]) blow = len(set(A) & set(B)) - hit print hit, blow except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,831
s628954680
p00025
u140201022
1396531745
Python
Python
py
Accepted
10
4564
439
#!/usr/bin/env python # -*- coding:utf-8 -*- #from __future__ import print_function import time import sys import io import re import math start = time.clock() while 1: try: a=map(int, raw_input().split()) b=map(int, raw_input().split()) j=k=0 for i in range(4): if b[i]==a[i]: j+=1 elif b[i] in a: k+=1 print j,k except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,832
s300017033
p00025
u246033265
1396619217
Python
Python
py
Accepted
10
4212
302
try: while True: a = map(int, raw_input().split()) b = map(int, raw_input().split()) p = q = 0 for i in range(len(b)): if a[i] == b[i]: p += 1 elif a.count(b[i]) != 0: q += 1 print p, q except: pass
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,833
s384585718
p00025
u378480414
1397065774
Python
Python
py
Accepted
10
4220
279
import sys lists=[] for str in sys.stdin: lists+=[tuple(str.rstrip().split(' '))] for i in range(0,len(lists),2): hit=0 blow=0 for j in range(4): if lists[i][j]==lists[i+1][j]: hit+=1 for c in lists[i]: if c in lists[i+1]: blow+=1 print '%d %d' % (hit,blow-hit)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,834
s547737796
p00025
u708217907
1398691926
Python
Python
py
Accepted
10
4212
304
import sys lists = [] for str in sys.stdin: lists+=[tuple(str.rstrip().split(' '))] for i in range(0, len(lists), 2): hit = brow = 0 for j in range(4): if lists[i][j] == lists[i+1][j]: hit += 1 for c in lists[i]: if c in lists[i+1]: brow += 1 print "%d %d"%(hit, brow-hit)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,835
s471806877
p00025
u436634575
1401165365
Python
Python3
py
Accepted
30
6720
325
import sys state = True for s in sys.stdin: if state: state = not state a = list(map(int, s.split())) else: state = not state b = list(map(int, s.split())) hit = sum(a[i] == b[i] for i in range(4)) blow = sum(b[i] in a for i in range(4)) - hit print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,836
s062572233
p00025
u695386605
1597761858
Python
Python3
py
Accepted
20
5596
426
while True: try: data1 = list(map(int, input().split())) #print(data1) data2 = list(map(int,input().split())) #print(data2) except: break h = 0 b = 0 for i in range(4): try: if i == data1.index(data2[i]): h = h + 1 else: b = b + 1 except: pass print('{} {}'. format(h, b))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,837
s840647231
p00025
u350481745
1597761326
Python
Python3
py
Accepted
20
5596
548
while True: try: h=0 b=0 a1,a2,a3,a4=map(int,input().split()) b1,b2,b3,b4=map(int,input().split()) if a1==b1: h+=1 if a2==b2: h+=1 if a3==b3: h+=1 if a4==b4: h+=1 if a1==b2 or a1==b3 or a1==b4: b+=1 if a2==b1 or a2==b3 or a2==b4: b+=1 if a3==b1 or a3==b2 or a3==b4: b+=1 if a4==b1 or a4==b2 or a4==b3: b+=1 print(h,b) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,838
s136519606
p00025
u444626963
1597760247
Python
Python3
py
Accepted
20
5600
432
ans = 0 while True: try: a = list(int(x) for x in input().split()) b = list(int(x) for x in input().split()) except EOFError: break hit = 0 brow =0 for i in range(4): if a[i] == b[i]: hit += 1 else: for j in range(4): if(i != j and a[i] == b[j]): brow += 1 print(str(hit)+' '+str(brow))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,839
s612986771
p00025
u140569607
1597759232
Python
Python3
py
Accepted
20
5596
347
while True: try: a = list(map(int,input().split())) b = list(map(int,input().split())) except: break hit = 0 blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 for i in range(4): if a[i] != b[i]: if b[i] in a: blow += 1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,840
s749610862
p00025
u470391435
1597750846
Python
Python3
py
Accepted
20
5592
357
while True: try: a=0 b=0 e1 =list(map(int,input().split())) e2 =list(map(int,input().split())) for i in range(4): if e1[i]==e2[i]: a+=1 for j in range(4): if e1[i]==e2[j]: b+=1 b = b-a print(a,b) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,841
s466147015
p00025
u322947441
1597741358
Python
Python3
py
Accepted
20
5596
360
while True: try: A = list(map(int, input().split())); except EOFError: break; B = list(map(int, input().split())); h = 0; b = 0; for i in range(0,4): if A[i] == B[i]: h += 1; else: for j in range(0,4): if A[j] == B[i]: b += 1; print(h,b);
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,842
s652685724
p00025
u799752967
1597732408
Python
Python3
py
Accepted
20
5604
370
# coding: utf-8 # Your code here! while True: try: a=list(map(int,input().split())) b=list(map(int,input().split())) except: break hit=blow=0 for i in range(4): if a[i]==b[i]: hit+=1 for i in range(4): if a[i]!=b[i]: if b[i] in a: blow+=1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,843
s393785925
p00025
u053015104
1597714216
Python
Python3
py
Accepted
20
5596
409
while 1: try: a = list(map(int, input().split())) b = list(map(int, input().split())) hit = 0 blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 for j in range(4): if a[i] == b[j]: blow += 1 blow -= hit print(hit, blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,844
s840911017
p00025
u988962397
1597681602
Python
Python3
py
Accepted
20
5560
402
while True: try: a=input().split() b=input().split() hit=0 blow=0 for i in range(4): for j in range(4): if(a[i]==b[i]): hit+=1 break if(a[i]==b[j]): blow+=1 break print(hit, blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,845
s376159648
p00025
u257570657
1597679049
Python
Python3
py
Accepted
30
5556
269
while True: try: a=list(map(str,input().split())) b=list(map(str,input().split())) except EOFError: break c,d=0,0 for i in range(4): if a[i]==b[i]: c+=1 elif a[i] in b: d+=1 print(c,d)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,846
s459911405
p00025
u057249340
1597669647
Python
Python3
py
Accepted
20
5592
323
while 1: try: a = list(map(int,input().split())) b = list(map(int,input().split())) hit = 0 blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 elif b[i] in a: blow += 1 print(hit,blow) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,847
s974328958
p00025
u221550784
1597639635
Python
Python3
py
Accepted
20
5596
466
while True: try: a1,a2,a3,a4=map(int,input().split()) b1,b2,b3,b4=map(int,input().split()) A=[a1,a2,a3,a4] B=[b1,b2,b3,b4] b=0 h=0 for i in A: if i in B: b+=1 else: continue for i in range(4): if A[i]==B[i]: h+=1 else: continue print(h,b-h) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,848
s592544866
p00025
u862272701
1597587858
Python
Python3
py
Accepted
20
5592
339
def x(m,n): H = 0 B = 0 for i in range(4): if m[i] == n[i]: H += 1 else: if m[i] in n: B += 1 return(H, B) while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) print(*x(a, b)) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,849
s182314438
p00025
u583329397
1597124349
Python
Python3
py
Accepted
20
5604
536
while True: try: H=0; B=0; a=list(map(int,input().split())) b=list(map(int,input().split())) except: break if a[0]==b[0]: H+=1 if a[1]==b[1]: H+=1 if a[2]==b[2]: H+=1 if a[3]==b[3]: H+=1 if a[0]==b[1] or a[0]==b[2] or a[0]==b[3]: B+=1 if a[1]==b[0] or a[1]==b[2] or a[1]==b[3]: B+=1 if a[2]==b[0] or a[2]==b[1] or a[2]==b[3]: B+=1 if a[3]==b[0] or a[3]==b[1] or a[3]==b[2]: B+=1 print(H, B)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,850
s227245544
p00025
u037263780
1596892014
Python
Python3
py
Accepted
20
5556
305
while True: try: A=list(map(str,input().split())) B=list(map(str,input().split())) h=0 b=0 for i in range(4): if A[i] in B: b+=1 if A[i]==B[i]: h+=1 print(h,b-h) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,851
s785012234
p00025
u826807985
1596798740
Python
Python3
py
Accepted
20
5592
516
try: while True: a1,a2,a3,a4=map(int,input().split()) b1,b2,b3,b4=map(int,input().split()) h=0 b=0 if a1==b1: h+=1 if a2==b2: h+=1 if a3==b3: h+=1 if a4==b4: h+=1 A = [a1,a2,a3,a4] B = [b1,b2,b3,b4] for i in A: for j in B: if i == j: b +=1 b = b - h print(h,b) except EOFError: pass
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,852
s856699136
p00025
u711365732
1596642171
Python
Python3
py
Accepted
20
5560
363
while True: try: A = input().split() B = input().split() h = 0 b = 0 for i in range(4): for j in range(4): if A[i] == B[j]: if i == j: h += 1 else: b += 1 else: pass print(h, b) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,853
s194351766
p00025
u795882061
1596545941
Python
Python3
py
Accepted
20
5600
919
while True: try: A = map(int,input().split()) ls_A = list(A) B = map(int,input().split()) ls_B = list(B) h = 0 b = 0 for i in range(len(ls_A)): if ls_A[i] == ls_B[i]: h += 1 if ls_A[0] == ls_B[1]: b += 1 if ls_A[0] == ls_B[2]: b += 1 if ls_A[0] == ls_B[3]: b += 1 if ls_A[1] == ls_B[0]: b += 1 if ls_A[1] == ls_B[2]: b += 1 if ls_A[1] == ls_B[3]: b += 1 if ls_A[2] == ls_B[0]: b += 1 if ls_A[2] == ls_B[1]: b += 1 if ls_A[2] == ls_B[3]: b += 1 if ls_A[3] == ls_B[0]: b += 1 if ls_A[3] == ls_B[1]: b += 1 if ls_A[3] == ls_B[2]: b += 1 print(h,b) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,854
s243032583
p00025
u555228137
1596519190
Python
Python3
py
Accepted
20
5564
424
while True: try: a=list(input()) b=list(input()) a=[i for i in a if i!=' '] b=[j for j in b if j!=' '] hit=blow=0 for i in range(4): for j in range(4): if a[i]==b[j]: if i==j: hit+=1 else: blow+=1 print(hit,blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,855
s827368514
p00025
u647921435
1596502763
Python
Python3
py
Accepted
20
5596
466
while True: try: a1,a2,a3,a4=map(int,input().split()) b1,b2,b3,b4=map(int,input().split()) A=[a1,a2,a3,a4] B=[b1,b2,b3,b4] b=0 h=0 for i in A: if i in B: b+=1 else: continue for i in range(4): if A[i]==B[i]: h+=1 else: continue print(h,b-h) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,856
s268211413
p00025
u525366883
1596154681
Python
Python3
py
Accepted
20
5592
299
while True: try: A = list(map(int, input().split())) B = list(map(int, input().split())) a = b = 0 for i in range(4): if A[i] == B[i]: a+=1 elif B[i] in A: b+=1 print(a, b) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,857
s711164657
p00025
u350963229
1595995931
Python
Python3
py
Accepted
20
5600
328
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) hit, blow = 0, 0 for i in range(4): if a[i] == b[i]: hit += 1 elif (b[i] in a) == 1: blow += 1 print(hit, blow) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,858
s400890701
p00025
u630948380
1595863684
Python
Python3
py
Accepted
20
5592
376
try: while True: L=0 M=0 A=list(map(int,input().split())) B=list(map(int,input().split())) for i in range(4): if A[i]==B[i]: L+=1 C=A.count(B[i]) if C>=1: M+=1 print(L,M-L) except EOFError: pass
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,859
s486480775
p00025
u511292942
1595555157
Python
Python3
py
Accepted
20
5596
334
while True: try: a = list(map(int,input().split())) b = list (map(int,input().split())) except: break hit = blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 for j in range(4): if i != j and a[i] == b[j]: blow +=1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,860
s183829334
p00025
u192469946
1595412145
Python
Python3
py
Accepted
30
5596
443
#0025 while True: c = 0 d = 0 l = [] m = [] try: a1,a2,a3,a4 = map(int,input().split()) b1,b2,b3,b4 = map(int,input().split()) except: break l.extend([a1,a2,a3,a4]) m.extend([b1,b2,b3,b4]) for i in range(4): for k in range(4): if l[i] == m[k]: if i == k: c += 1 else: d += 1 print(c,d)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,861
s550472041
p00025
u275486335
1595295900
Python
Python3
py
Accepted
20
5564
265
while True: try: a=input().split() b=input().split() except: break hit=0 blow=0 for i in range(4): x=a.count(b[i]) blow+=x if a[i]==b[i]: hit+=1 blow-=1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,862
s335852190
p00025
u395654950
1594615042
Python
Python3
py
Accepted
20
5560
537
# coding: utf-8 # Your code here! while True: try: A = list(input()) B = list(input()) for i in range(A.count(' ')): A.remove(' ') for i in range(B.count(' ')): B.remove(' ') #print(A, B) h = 0 #ブロー数 b = 0 #ヒット数 for i in range(4): for j in range(4): if A[i] == B[j]: if i == j: h += 1 else: b += 1 print(h, b) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,863
s915954442
p00025
u187074069
1594473586
Python
Python3
py
Accepted
20
5596
461
while True: try: Alst = list(map(int, input().split())) Blst = list(map(int, input().split())) H = 0 B = 0 for a, anum in enumerate(Alst): for b, bnum in enumerate(Blst): if anum == bnum: if a == b: H = H + 1 else: B = B + 1 print(str(H) + ' ' + str(B)) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,864
s283041421
p00025
u128671689
1594126063
Python
Python3
py
Accepted
20
5596
388
while True: try: A=list(map(int,input().split())) B=list(map(int,input().split())) C=[] for i in range(4): if B[i]==A[i]: C.append("h") elif B[i] in A: C.append("b") else: pass H=C.count("h") B=C.count("b") print(H,B) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,865
s847314304
p00025
u994684803
1592826074
Python
Python3
py
Accepted
20
5592
318
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break h = 0 bl = 0 for i in range(4): if a[i] == b[i]: h += 1 b[i] = 51 for i in range(4): if a[i] in b: bl += 1 print(h,bl)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,866
s206722517
p00025
u228556128
1592311364
Python
Python3
py
Accepted
20
5592
285
while True: try: A=list(map(int,input().split())) B=list(map(int,input().split())) except: break h=0 for i in range(4): if A[i]==B[i]: h+=1 b=0 for i in A: if i in B: b+=1 b-=h print(h,b)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,867
s466228756
p00025
u814278309
1591882322
Python
Python3
py
Accepted
20
5592
323
while 1: try: a = list(map(int,input().split())) b = list(map(int,input().split())) hit = 0 blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 elif b[i] in a: blow += 1 print(hit,blow) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,868
s472836976
p00025
u747915832
1590261443
Python
Python3
py
Accepted
20
5560
329
while True: try: a = [a for a in input().split()] b = [b for b in input().split()] except: break hit = 0 blow = 0 for i in range(4): if b[i] in a : blow += 1 if b[i]==a[i]: hit += 1 blow = blow-hit print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,869
s880380658
p00025
u037441960
1589625471
Python
Python3
py
Accepted
20
5556
371
while True : try : A = list(input().split()) B = list(input().split()) hit = 0 blow = 0 for i in range(4) : if A[i] == B[i] : hit += 1 elif B[i] in A : blow += 1 print(hit, blow) except : break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,870
s413977908
p00025
u260980560
1589608803
Python
Python3
py
Accepted
20
5604
415
import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): *A, = map(int, readline().split()) *B, = map(int, readline().split()) v1 = v2 = 0 for i in range(4): if A[i] == B[i]: v1 += 1 for j in range(4): if i != j and A[i] == B[j]: v2 += 1 write("%d %d\n" % (v1, v2)) try: while 1: solve() except: ...
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,871
s919338497
p00025
u240091169
1589028179
Python
Python3
py
Accepted
20
5592
601
while True : try : a1, a2, a3, a4 = map(int, input().split()) b1, b2, b3, b4 = map(int, input().split()) except EOFError : break hit = 0 brow = 0 if a1 == b1 : hit += 1 if a2 == b2 : hit += 1 if a3 == b3 : hit += 1 if a4 == b4 : hit += 1 if a1 == b2 or a1 == b3 or a1 == b4 : brow += 1 if a2 == b1 or a2 == b3 or a2 == b4 : brow += 1 if a3 == b1 or a3 == b2 or a3 == b4 : brow += 1 if a4 == b1 or a4 == b2 or a4 == b3 : brow += 1 print(hit, brow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,872
s068462280
p00025
u014861569
1589012989
Python
Python3
py
Accepted
20
5600
280
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 b[i] = -1 for i in range(4): if b[i] >= 0: if b[i] in a: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,873
s515012923
p00025
u842461513
1588924080
Python
Python3
py
Accepted
20
5596
561
try: while True: #標準入力 a_line = list(map(int,input().split())) b_line = list(map(int,input().split())) num1 = 0 num2 = 0 #場所も番号も同じならnum1数字が同じならnum2にいれる for num in range(0,4): if a_line[num] == b_line[num]: num1 += 1 continue else:pass if a_line[num] in b_line:num2 += 1 else:pass print(str(num1) + " " + str(num2)) #EOFErrorをひろう except EOFError: pass
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,874
s570282499
p00025
u808372529
1584064484
Python
Python3
py
Accepted
20
5556
399
while True: try: alist = input().split() blist = input().split() hit = brow = 0 for i in range(4): for j in range(4): if alist[i] == blist[j]: if i == j: hit += 1 else: brow += 1 print(hit,brow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,875
s063587487
p00025
u630911389
1576834629
Python
Python3
py
Accepted
20
5600
429
while True: try: a = list(int(x) for x in input().split()) b = list(int(x) for x in input().split()) except EOFError: break hit = 0 brow = 0 for i in range(4): if a[i] == b[i]: hit += 1 else: for j in range(4): if(i != j and a[i] == b[j]): brow += 1 print(str(hit) + " " + str(brow))
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,876
s082318304
p00025
u803862921
1570862178
Python
Python3
py
Accepted
20
5604
510
c = 0 while True: try: if c % 2 == 0: A = [int(x) for x in input().split()] else: B = [int(x) for x in input().split()] hit = blow = 0 for i in range(len(B)): if A[i] == B[i]: hit += 1 else: if B[i] in A: blow += 1 print(hit,blow) c += 1 except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,877
s721617081
p00025
u595265835
1570537062
Python
Python3
py
Accepted
20
5612
647
"""while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 b[i] = -1 for i in range(4): if b[i] >= 0: if b[i] in a: blow += 1 print(hit, blow) """ while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = blow = 0 for i in range(4): if (a[i] == b[i]): hit += 1 b[i] = -1 for i in range(4): if b[i] >= 0: if b[i] in a: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,878
s085692196
p00025
u472768263
1570525207
Python
Python3
py
Accepted
20
5596
397
while True: try: a=list(map(int, input().split())) #print("a",a) b=list(map(int, input().split())) #print("b",b) hit=0 blow=0 for i in range(len(b)): if b[i] in a: if b[i]==a[i]: hit+=1 else: blow+=1 print(hit,blow,) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,879
s619929101
p00025
u824708460
1566273375
Python
Python3
py
Accepted
20
5596
325
while 1: try: a = list(map(int, input().split())) b = list(map(int, input().split())) hit, blow = 0, 0 for i in range(4): if a[i] == b[i]: hit += 1 elif (b[i] in a) == 1: blow += 1 print(hit, blow) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,880
s849845895
p00025
u250040203
1564930553
Python
Python3
py
Accepted
20
5592
190
while True: try: a=list(map(int,input().split())) except:break b=list(map(int,input().split())) h=0 for i,j in zip(a,b):h+=i==j print(h,len(set(a)&set(b))-h)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,881
s072290534
p00025
u427219397
1564900853
Python
Python3
py
Accepted
20
5596
290
while True : try : a = [int(_) for _ in input().split()] b = [int(_) for _ in input().split()] hit, blow = 0, 0 for _ in range(4) : if a[_] == b[_] : hit += 1 elif b[_] in a : blow += 1 print(hit, blow) except : break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,882
s484539270
p00025
u894015161
1560336411
Python
Python3
py
Accepted
20
5600
318
while True: try: a= list(map(int,input().split())) b= list(map(int, input().split())) hit = sum([1 for i in range(4) if a[i] == b[i]]) blow = sum([1 for i in range(4) for j in range(4) if i != j and a[i] == b[j]]) print(str(hit) + " " + str(blow)) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,883
s071155684
p00025
u548252256
1560181082
Python
Python3
py
Accepted
20
5560
270
if __name__ == '__main__': while True: try: A = input().split() B = input().split() hit = 0 blow = 0 for i in range(4): if A[i] == B[i]: hit += 1 else: if B[i] in A: blow += 1 print(hit,blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,884
s107453262
p00025
u990459103
1559796498
Python
Python3
py
Accepted
20
5556
387
while 1: try: h = 0 b = 0 que=input().split(" ") ans=input().split(" ") for i in range(4): for j in range(4): if que[i] == ans[j] and i != j: b = b + 1 if que[i] == ans[j] and i == j: h = h + 1 print(str(h) + " " + str(b)) except:break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,885
s130789932
p00025
u477023447
1559718630
Python
Python3
py
Accepted
20
5564
270
while 1: try: A = input().split() B = input().split() hit = len([i for i in range(len(A)) if B[i] == A[i]]) blow = len([i for i in range(len(A)) if B[i] in A]) - hit print(str(hit) + " " + str(blow)) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,886
s768421828
p00025
u625806423
1557136380
Python
Python3
py
Accepted
20
5600
344
while True: try: a_set = list(map(int, input().split())) b_set = list(map(int, input().split())) except EOFError: break hit = 0 blow = 0 for i in range(4): if a_set[i] == b_set[i]: hit += 1 for i in range(4): for j in range(4): if a_set[i] == b_set[j] and i != j: blow += 1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,887
s508341233
p00025
u406093358
1555546475
Python
Python
py
Accepted
0
4668
451
import sys alist = [] blist = [] cnt = 0 for line in sys.stdin: if cnt%2 == 0: alist.append(map(int, line.split())) else: blist.append(map(int, line.split())) cnt += 1 for i in range(0, len(alist)): a = alist[i] b = blist[i] hitcount = 0 blowcount = 0 for j in range(0, 4): if a[j] == b[j]: hitcount += 1 for j in range(0, 4): for k in range(0, 4): if a[j] == b[k] and j != k: blowcount += 1 print str(hitcount)+' '+str(blowcount)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,888
s312534796
p00025
u350155409
1553329536
Python
Python3
py
Accepted
20
5596
427
import sys lines = sys.stdin.readlines() n = len(lines)//2 for i in range(n): hit = 0 blow = 0 cache = {} a = list(map(int, lines[i*2].split())) b = list(map(int, lines[i*2+1].split())) for j in range(len(a)): if a[j] == b[j]: hit += 1 else: cache[a[j]] = True for j in range(len(b)): if cache.get(b[j]): blow += 1 print(hit,blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,889
s118178147
p00025
u051394180
1549247614
Python
Python
py
Accepted
10
4648
506
def judge_hit(num1, num2): cnt = 0 for a, b in zip(num1, num2): if a == b: cnt += 1 return cnt def judge_blow(num1, num2, hit): cnt = 0 for b in num2: cnt += (b in num1) return cnt - hit while True: try: A_number = map(int, raw_input().split()) B_number = map(int, raw_input().split()) hit = judge_hit(A_number, B_number) blow = judge_blow(A_number, B_number, hit) print hit, blow except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,890
s911690255
p00025
u869924057
1544607816
Python
Python3
py
Accepted
20
5592
388
while(1): try: alist = list(map(int, input().split())) blist = list(map(int, input().split())) except: break hit = 0 blow = 0 for i in range(4): for j in range(4): if alist[i] == blist[j]: if i == j: hit += 1 else: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,891
s703528554
p00025
u563075864
1542869075
Python
Python3
py
Accepted
20
5600
265
while(1): try: a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] hit = 0 for i,j in zip(a,b): if i == j: hit += 1 sa = set(a) sb = set(b) u = sa & sb blow = len(u) - hit print(hit, blow) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,892
s023004233
p00025
u067299340
1542187473
Python
Python3
py
Accepted
20
5564
369
while True: try: a = [x for x in input().split()] b = [x for x in input().split()] hit_count = 0 blow_count = 0 for i in range(4): if a[i] == b[i]: hit_count += 1 elif(b[i] in a): blow_count += 1 print(hit_count, blow_count) except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,893
s218409267
p00025
u717526540
1541664300
Python
Python3
py
Accepted
20
5596
386
while(1): try: alist = list(map(int, input().split())) blist = list(map(int, input().split())) except: break hit = 0 blow = 0 for i in range(4): for j in range(4): if alist[i] == blist[j]: if i == j: hit += 1 else: blow += 1 print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,894
s015347442
p00025
u219940997
1537457300
Python
Python3
py
Accepted
20
5556
320
def process(A, B): hit, blow = 0, 0 for a, b in zip(A, B): if a == b: hit += 1 elif a in B: blow += 1 return (hit, blow) while True: try: A = input().split() B = input().split() except: break hit, blow = process(A, B) print(hit, blow)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,895
s499593817
p00025
u252700163
1537201856
Python
Python3
py
Accepted
20
5600
517
import sys lines = [] for index, line in enumerate(sys.stdin): line = line.strip() if index%2 == 0: lines.append( [line] ) else: lines[-1].append( line ) #print(lines) lines = iter(lines) for line in lines: i1 = line xs = list(map(int, i1[0].split() )) ys = list(map(int, i1[1].split() )) full_match = 0 spec_match = 0 for x, y in zip(list(xs), list(ys)): #print(x, y, y in xs) if x == y: full_match += 1 elif y in xs: spec_match += 1 print(full_match, spec_match)
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,896
s151851696
p00025
u319725914
1534231859
Python
Python3
py
Accepted
20
5600
247
while(True): try: a = list(map(int, input().split())) b = list(map(int, input().split())) h = [c-d for c,d in zip(a,b)].count(0) v = sum([a.count(d) for d in b]) - h print(h,v) except: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,897
s479583376
p00025
u079141094
1516621389
Python
Python3
py
Accepted
20
5600
623
import sys def solve(): A = [] B = [] for i, line in enumerate(sys.stdin): t = tuple(map(int, line.split())) if i % 2 == 0: A.append(t) else: B.append(t) for a, b in zip(A, B): hit, blow = 0, 0 for i, bb in enumerate(b): for j, aa in enumerate(a): if bb == aa and i == j: hit += 1 break elif bb == aa and i != j: blow += 1 break print(hit, blow) if __name__ == "__main__": solve()
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,898
s113309206
p00025
u197615660
1374948926
Python
Python
py
Accepted
10
4228
294
hoge = 0 while True: try: hit = 0 blow = 0 a = map(int, raw_input().split()) b = map(int, raw_input().split()) for i in range(4): try: if a.index(b[i]) == i: hit += 1 else: blow += 1 except ValueError: continue print hit, blow except EOFError: break
p00025
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>B</i> chose. </p> <p> The input ends with EOF. The number of datasets is less than or equal to 50. </P> <H2>Output</H2> <p> For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. </p> <H2>Sample Input</H2> <pre> 9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2 </pre> <H2>Output for the Sample Input</H2> <pre> 1 1 3 0 </pre>
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
7,899
s984761202
p00026
u647694976
1556020064
Python
Python3
py
Accepted
20
5628
1,295
peper=[[0 for i in range(14)]for j in range(14)] while True: try: x,y,s=map(int,input().split(",")) x +=2 y +=2 if s==3: peper[y][x] +=1 peper[y][x-1] +=1 peper[y][x-2] +=1 peper[y][x+1] +=1 peper[y][x+2] +=1 peper[y-1][x] +=1 peper[y-2][x] +=1 peper[y+1][x] +=1 peper[y+2][x] +=1 peper[y-1][x-1] +=1 peper[y-1][x+1] +=1 peper[y+1][x-1] +=1 peper[y+1][x+1] +=1 elif s==2: peper[y][x] +=1 peper[y][x+1] +=1 peper[y][x-1] +=1 peper[y+1][x] +=1 peper[y+1][x+1] +=1 peper[y+1][x-1] +=1 peper[y-1][x] +=1 peper[y-1][x+1] +=1 peper[y-1][x-1] +=1 elif s==1: peper[y][x] +=1 peper[y+1][x] +=1 peper[y-1][x] +=1 peper[y][x+1] +=1 peper[y][x-1] +=1 except: co=0 ma=0 for i in range(2,12): for j in range(2,12): if peper[i][j]==0: co +=1 else: ma=max(ma,peper[i][j]) print(co) print(ma) break
p00026
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
7,900
s083529398
p00026
u193025715
1408266164
Python
Python3
py
Accepted
30
6776
919
#!/usr/bin/python paper = [[0] * 10 for i in range(10)] def small(x, y): p = [[x, y]] for i, j in zip([-1, 0, 1, 0], [0, -1, 0, 1]): p.append([x + i, y + j]) return p def middle(x, y): p = small(x, y) for i, j in zip([1, -1, 1, -1], [1, 1, -1, -1]): p.append([x + i, y + j]) return p def big(x, y): p = middle(x, y) for i, j in zip([-2, 0, 2, 0], [0, -2, 0, 2]): p.append([x + i, y + j]) return p while True: try: x, y, size = map(int, input().split(',')) except: break if size == 1: bp = small(x, y) elif size == 2: bp = middle(x, y) elif size == 3: bp = big(x, y) for p in bp: if 0 <= p[0] < 10 and 0 <= p[1] < 10: paper[p[1]][p[0]] += 1 print(sum(paper[y][x] == 0 for y in range(10) for x in range(10))) print(max(paper[y][x] for y in range(10) for x in range(10)))
p00026
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
7,901