Startup and Tech
Tuesday, 21 July 2020
Codeforces 1382A - Common Subsequence Problem Solution In Python
Program
t = int(input()) for i in range(t): n,m = [int(j) for j in input().split()[:2]] x = [int(k) for k in input().split()[:n]] y = [int(l) for l in input().split()[:m]] f=0 for j in range(n): if(x[j] in y): p = j f+=1 break else: pass if(f>0): print('YES') print(1,x[p]) else: print('NO')
Output
I/P : 5 4 5 10 8 6 4 1 2 3 4 5 1 1 3 3 1 1 3 2 5 3 1000 2 2 2 3 3 1 5 5 5 1 2 3 4 5 1 2 3 4 5 O/P : YES 1 4 YES 1 3 NO YES 1 3 YES 1 1
Codeforces 1328A - Divisibility Problem Solution In Python
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment