from sys import stdin
T=int(stdin.readline())
A=[]
B=[]
for _ in range(T):
n,m=map(int,stdin.readline().split())
A=list(map(int,stdin.readline().split()))
B=list(map(int,stdin.readline().split()))
res=list(set(A) & set(B))
if len(res)==0:
print("NO")
else:
print("YES")
print(1,res[0])
A - Common Subsequence
from sys import stdin
T=int(stdin.readline())
for _ in range(T):
cnt=0
N=int(stdin.readline())
li=list(map(int,stdin.readline().split()))
for i in li:
if i==1:
cnt+=1
else:
break
if cnt%2==0:
if cnt==N:
print("Second")
else:
print("First")
else:
if cnt==N:
print("First")
else:
print("Second")
B - Sequential Nim
'알고리즘 > Codeforces' 카테고리의 다른 글
Codeforces Round #660 (Div. 2) AB (0) | 2020.08.06 |
---|---|
Educational Codeforces Round 92 (Rated for Div. 2) A (0) | 2020.08.06 |
Codeforces Round #661 (Div. 3) ABC (0) | 2020.08.06 |
Codeforces Round #656 (Div. 3) ABC (0) | 2020.08.06 |
Codeforces Round #653 (Div. 3) ABC (0) | 2020.08.06 |
댓글