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 stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s516037516 | p02557 | u144913062 | 1600031618 | Python | PyPy3 (7.3.0) | py | Runtime Error | 455 | 168644 | 1409 | from collections import deque
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cntA = [0] * (N + 1)
cntB = [0] * (N + 1)
for i in range(N):
cntA[A[i]] += 1
cntB[B[i]] += 1
nums = [(cntA[i], cntB[i], i) for i in range(1, N+1)]
nums.so... |
s816240905 | p02557 | u189056821 | 1600031606 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9128 | 515 | c_A = Counter(A)
c_B = Counter(B)
flag = 0
vals_A, cnts_A = zip(*c_A.most_common())
max_cnt_A = cnts_A.count(cnts_A[0])
vals_B, cnts_B = zip(*c_B.most_common())
max_cnt_B = cnts_B.count(cnts_B[0])
for i in range(max_cnt_A):
for j in range(max_cnt_B):
if vals_A[i] == vals_B[j]:
if cnts_A[i] > N... |
s846443388 | p02557 | u922449550 | 1600031431 | Python | Python (3.8.2) | py | Runtime Error | 380 | 41820 | 872 | N = int(input())
A = [0] + list(map(int, input().split())) + [N+1]
B = list(map(int, input().split()))
B_store = B.copy()
def do(A, B):
ans = []
ida = 1
res = True
while ida < N+1:
a = A[ida]
c = 1
while ida+c < N+2 and A[ida+c] == a:
c += 1
ida += ... |
s409199115 | p02557 | u415718506 | 1600031417 | Python | PyPy3 (7.3.0) | py | Runtime Error | 651 | 200616 | 2481 | import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict
# available on Google, not available on Codeforces
# import numpy as np
# import scipy
def solve(arr, brr): # fix inputs here
console(arr)
console(brr)
console("----- solving ------")
c1 ... |
s125325282 | p02557 | u585482323 | 1600031304 | Python | PyPy3 (7.3.0) | py | Runtime Error | 105 | 74576 | 1383 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for ... |
s604465149 | p02557 | u285681431 | 1600031179 | Python | PyPy3 (7.3.0) | py | Runtime Error | 753 | 113076 | 791 | from collections import deque
import sys
import random
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
# B.sort(reverse=True)
B = range.shuffle(B)
C = deque(B)
ans = []
for i in range(N):
p = C.popleft()
if A[i] != p:
ans.a... |
s118062789 | p02557 | u415718506 | 1600031109 | Python | PyPy3 (7.3.0) | py | Runtime Error | 590 | 183436 | 2349 | import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict
# available on Google, not available on Codeforces
# import numpy as np
# import scipy
def solve(arr, brr): # fix inputs here
console(arr)
console(brr)
console("----- solving ------")
c1 ... |
s137561697 | p02557 | u189479417 | 1600031100 | Python | Python (3.8.2) | py | Runtime Error | 222 | 68396 | 282 | from collections import Counter
import sys
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ca = Counter(A)
cb = Counter(B)
if ca.most_common()[0][1] + cb.most_common()[0][1] > N:
print('No')
sys.exit()
print('Yes')
random.shuffle(B) |
s723986413 | p02557 | u693566873 | 1600030976 | Python | PyPy3 (7.3.0) | py | Runtime Error | 359 | 206020 | 1533 | import collections
import sys
def solve(n, A, B):
Ac = {}
ABc = {}
for a in A:
Ac[a] = 1 + Ac.get(a, 0)
ABc[a] = 1 + ABc.get(a, 0)
Bc = {}
for b in B:
Bc[b] = 1 + Bc.get(b, 0)
ABc[b] = 1 + ABc.get(b, 0)
cAB = sorted([(c, ab) for ab, c in ABc.items()])
#print(cAB)
pool = collections.deq... |
s911125625 | p02557 | u792078574 | 1600030891 | Python | PyPy3 (7.3.0) | py | Runtime Error | 782 | 192692 | 957 | from collections import Counter
from heapq import heappush, heappop
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
ctall = Counter(As + Bs)
mcvalue, mccount = ctall.most_common(1)[0]
if mccount > N:
print('No')
exit()
print('Yes')
ctA = Counter(As)
ctB = Counter(Bs)... |
s618202556 | p02557 | u693566873 | 1600030736 | Python | PyPy3 (7.3.0) | py | Runtime Error | 362 | 205916 | 1516 | import collections
import sys
def solve(n, A, B):
Ac = {}
ABc = {}
for a in A:
Ac[a] = 1 + Ac.get(a, 0)
ABc[a] = 1 + ABc.get(a, 0)
Bc = {}
for b in B:
Bc[b] = 1 + Bc.get(b, 0)
ABc[b] = 1 + ABc.get(b, 0)
cAB = sorted([(c, ab) for ab, c in ABc.items()])
#print(cAB)
pool = collections.deq... |
s210956539 | p02557 | u438720156 | 1600030596 | Python | Python (3.8.2) | py | Runtime Error | 128 | 40244 | 568 | flag=0
def permute(p2,l,r):
global flag
if l==r and flag==0:
count=0
for i in range(n):
if p1[i]!=p2[i]:
count+=1
else:
break
if count==n:
flag=1
print("Yes")
for i in range(n):
print(p2[i],end=" ")
else:
for i in range(l,r+1):
p2[l],p2[i]... |
s408615550 | p02557 | u748241164 | 1600030506 | Python | Python (3.8.2) | py | Runtime Error | 334 | 81212 | 707 | import collections
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A1 = collections.Counter(A)
B1 = collections.Counter(B)
A2 = A1.most_common()
B2 = B1.most_common()
for i in range(len(B2)):
if A2[i][1] + B2[i][1] > N:
print("No")
quit()
B.reverse()
s = 0
t = ... |
s305309805 | p02557 | u947664173 | 1600030494 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 105980 | 507 | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=[]
c=a+b
max=0
for i in range(1,n+1):
kazu=c.count(i)
if kazu>max:
max=kazu
if max>n:
print("No")
exit()
else:
for j in range(n):
k=0
while 1:
x=b.pop(k)
if x==a[j]:... |
s537735778 | p02557 | u217732870 | 1600030366 | Python | PyPy3 (7.3.0) | py | Runtime Error | 94 | 74668 | 633 | import copy as cp
import Counter from collections
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cA = Counter(A)
cB = Counter(B)
for i in range(10**9+1):
if cA(i)+cB(i) > n:
print('No')
exit()
s = 0
i = 0
while(1):
#print(i)
#print('B', B)
if i == n:
print(... |
s837108870 | p02557 | u730257868 | 1600030357 | Python | Python (3.8.2) | py | Runtime Error | 534 | 72148 | 857 | import collections
n=int(input())
ax=list(map(int,input().split()))
bx=list(map(int,input().split()))
a=collections.Counter(ax)
b=collections.Counter(bx)
ma=a.most_common()[0][1]
mb=b.most_common()[0][1]
an=a.most_common()[0][0]
bn=b.most_common()[0][0]
mab=ax.count(bn)
mba=bx.count(an)
if ma+mab>n or mb+mba>n:
p... |
s798370467 | p02557 | u730257868 | 1600030276 | Python | PyPy3 (7.3.0) | py | Runtime Error | 533 | 212036 | 857 | import collections
n=int(input())
ax=list(map(int,input().split()))
bx=list(map(int,input().split()))
a=collections.Counter(ax)
b=collections.Counter(bx)
ma=a.most_common()[0][1]
mb=b.most_common()[0][1]
an=a.most_common()[0][0]
bn=b.most_common()[0][0]
mab=ax.count(bn)
mba=bx.count(an)
if ma+mab>n or mb+mba>n:
p... |
s291223829 | p02557 | u784120390 | 1600030022 | Python | PyPy3 (7.3.0) | py | Runtime Error | 573 | 194868 | 3922 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s638481155 | p02557 | u784120390 | 1600029950 | Python | PyPy3 (7.3.0) | py | Runtime Error | 487 | 195232 | 3892 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s260162191 | p02557 | u792078574 | 1600029903 | Python | PyPy3 (7.3.0) | py | Runtime Error | 804 | 190320 | 1577 | from collections import Counter
from heapq import heappush, heappop
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
ctall = Counter(As + Bs)
mcvalue, mccount = ctall.most_common(1)[0]
if mccount > N:
print('No')
exit()
print('Yes')
ctA = Counter(As)
ctB = Counter(Bs)... |
s317290939 | p02557 | u054514819 | 1600029884 | Python | PyPy3 (7.3.0) | py | Runtime Error | 224 | 140132 | 859 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
As = list(mapint())
Bs = list(mapint())
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ac = Counter(As)
bc = Counter(Bs)
from he... |
s479634607 | p02557 | u696684809 | 1600029714 | Python | Python (3.8.2) | py | Runtime Error | 283 | 40272 | 434 | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = [0]*n
d = [0]*n
t = 0
for i in range(n):
c[a[i]] +=1
d[a[i]] +=1
for j in range(n):
c[j] = c[j] + d[j]
if(max(c)>n):
print("No")
else:
print("Yes")
for l in range(n):
if(t==0 and b[n-1-l]!=a[l]):
print(b[n-1... |
s707484949 | p02557 | u784120390 | 1600029670 | Python | PyPy3 (7.3.0) | py | Runtime Error | 579 | 195032 | 3868 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s219262675 | p02557 | u852790844 | 1600029627 | Python | Python (3.8.2) | py | Runtime Error | 789 | 51556 | 1612 | import sys
import numpy as np
from collections import deque, Counter, defaultdict
import sys
import numpy as np
n = int(input())
a = np.array(input().split(), dtype=np.int64)
b = np.array(input().split(), dtype=np.int64)
ac = np.bincount(a, minlength=n+2)
ab = np.bincount(b, minlength=n+2)
if np.max(ac+ab) <= n:
... |
s984452272 | p02557 | u620480037 | 1600029624 | Python | PyPy3 (7.3.0) | py | Runtime Error | 676 | 168344 | 1345 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
DA={}
DB={}
for i in range(N):
if A[i] not in DA:
DA[A[i]]=1
else:
DA[A[i]]+=1
if B[i] not in DB:
DB[B[i]]=1
else:
DB[B[i]]+=1
for k,v in DB.items():
if k not in DA:
pass
... |
s512311207 | p02557 | u627417051 | 1600029622 | Python | PyPy3 (7.3.0) | py | Runtime Error | 526 | 117904 | 1776 | import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")
def getlist():
return list(map(int, input().split()))
class SegmentTree(object):
def __init__(self, N):
self.N = N
self.N0 = 2 ** (N - 1).bit_length()
self.initV... |
s130342241 | p02557 | u692453235 | 1600029611 | Python | PyPy3 (7.3.0) | py | Runtime Error | 103 | 68580 | 883 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = Counter(A+B)
DicB = Counter(B)
if L.most_common(1)[0][1] > N:
print("No")
else:
A.reverse()
Bkey = [x[0] for x in DicB.most_common()]
ans = []
i = 0
for a in A:
if DicB[Bkey[i]... |
s705652021 | p02557 | u825378567 | 1600029610 | Python | Python (3.8.2) | py | Runtime Error | 196 | 56032 | 549 | import collections
def ge():
return map(int,input().split())
def main():
#a,b,c,d=ge()
#N=int(input())
#a=list(map(int,input().split()))
#a=input()
N=int(input())
A=list(ge())
B=list(ge())
tmp=[]
for i in range(N):
if A[i]==B[i]:
tmp.append(B[i])
count=col... |
s773622426 | p02557 | u201387466 | 1600029607 | Python | Python (3.8.2) | py | Runtime Error | 263 | 43052 | 2061 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bise... |
s563181442 | p02557 | u129019798 | 1600029606 | Python | Python (3.8.2) | py | Runtime Error | 516 | 115292 | 1568 | def main():
import sys
from collections import Counter
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
B=list(map(int,sys.stdin.readline().split()))
AC=Counter(A)
BC=Counter(B)
for a in AC:
if a in BC:
if AC[a]+BC[a]>N:
... |
s986683431 | p02557 | u201660334 | 1600029600 | Python | PyPy3 (7.3.0) | py | Runtime Error | 791 | 249316 | 2036 | import collections
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = {}
count_a = {}
count_b = {}
for i in range(n):
count.setdefault(a[i], 0)
count[a[i]] += 1
count_a.setdefault(a[i], set())
count_a[a[i]].add(i)
count.setdefault(b[i], 0)
count[b[i... |
s837747815 | p02557 | u278296307 | 1600029594 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9028 | 1149 | import collections
def shift_l(l)
result = l[1:] + l[:1]
return result
n = int(input())
a_list = [i for i in input().split()]
b_list = [i for i in input().split()]
a_mode_list = collections.Counter(a_list)
b_mode_list = collections.Counter(b_list)
a_mode_max = 0
a_pos_dict = {}
b_pos_dict = {}
a_current_pos ... |
s906436283 | p02557 | u061888329 | 1600029562 | Python | Python (3.8.2) | py | Runtime Error | 335 | 62964 | 475 | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
from collections import defaultdict
x=[]
for i in range(len(b)-1,-1,-1):
x.append(b[i])
b=x
dic=defaultdict(list)
same=[]
ok=0
for i in range(n):
aa=a[i]
bb=b[i]
if aa==bb:
same.append(i,aa)
else:
... |
s733265338 | p02557 | u620480037 | 1600029551 | Python | PyPy3 (7.3.0) | py | Runtime Error | 619 | 171812 | 1337 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
DA={}
DB={}
for i in range(N):
if A[i] not in DA:
DA[A[i]]=1
else:
DA[A[i]]+=1
if B[i] not in DB:
DB[B[i]]=1
else:
DB[B[i]]+=1
for k,v in DB.items():
if k not in DA:
pass
... |
s214496523 | p02557 | u711539583 | 1600029549 | Python | Python (3.8.2) | py | Runtime Error | 385 | 56028 | 818 | import heapq
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
heapq.heapify(b)
heapq.heapify(c)
ans = [0] * n
A = []
for i in range(n):
A.append((a[i],i))
A.sort(reverse=True)
k = 0
for i in range(n):
ai, j = A[i]
bi = -1
if c and c[0] != ai:
bi ... |
s845863467 | p02557 | u761168538 | 1600029547 | Python | PyPy3 (7.3.0) | py | Runtime Error | 272 | 155964 | 806 | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
counta=[0]*n
countb=[0]*n
for i in range(n):
counta[a[i]-1]+=1
countb[b[i]-1]+=1
flag=False
for i in range(n):
if(countb[i]!=0):
if(countb[i]>n-counta[i]):
flag=True
if(flag):
print("No")
else:
print("Yes")
ans=[0]*n
temp=set(b... |
s643502540 | p02557 | u539692012 | 1600029545 | Python | PyPy3 (7.3.0) | py | Runtime Error | 446 | 150184 | 833 | from collections import deque
n = int(input())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ds = [0] * (n+1)
for x in s:
ds[x] += 1
dt = [0] * (n + 1)
for x in t:
dt[x] += 1
a = sorted(range(n+1), key=lambda i: ds[i] + dt[i], reverse=True)
mxi = a[0]
if ds[mxi] + dt[mxi] > n:
prin... |
s061044749 | p02557 | u792078574 | 1600029545 | Python | PyPy3 (7.3.0) | py | Runtime Error | 826 | 189332 | 1070 | from collections import Counter
from heapq import heappush, heappop
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
ctall = Counter(As + Bs)
mcvalue, mccount = ctall.most_common(1)[0]
if mccount > N:
print('No')
exit()
print('Yes')
ctA = Counter(As)
ctB = Counter(Bs)... |
s220496358 | p02557 | u814986259 | 1600029542 | Python | Python (3.8.2) | py | Runtime Error | 603 | 100396 | 676 | import collections
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
flag = True
D1 = dict()
D2 = dict()
for i, x in enumerate(A):
if x in D1:
D1[x].append(i)
else:
D1[x] = [i]
for i, x in enumerate(B):
if x in D2:
D2[x].append(i)
else:
... |
s451876752 | p02557 | u074220993 | 1600029539 | Python | Python (3.8.2) | py | Runtime Error | 160 | 46648 | 587 | from collections import Counter, deque
from itertools import count
def main():
with open(0) as f:
N = int(f.readline())
A = list(map(int, f.readline().split()))
B = list(map(int, f.readline().split()))
counter = Counter(A+B)
if counter.most_common(1)[0][1] > N:
print('No')
... |
s897840050 | p02557 | u354126779 | 1600029538 | Python | Python (3.8.2) | py | Runtime Error | 138 | 41840 | 403 | import sys
import random
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Alis=[0 for i in range(n)]
Blis=[0 for i in range(n)]
Slis=[Alis[i]+Blis[i] for i in range(n)]
if max(Slis)>n:
print("No")
sys.exit()
else:
print("Yes")
rand=[random.random() for i in range(N)]... |
s014103731 | p02557 | u714642969 | 1600029527 | Python | PyPy3 (7.3.0) | py | Runtime Error | 569 | 170428 | 1274 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
from collections import Counter,defaultdict
from... |
s556834320 | p02557 | u065079240 | 1600029525 | Python | Python (3.8.2) | py | Runtime Error | 298 | 41672 | 718 | N=int(input())
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
numofmaxA=0
maxAindex=0
numA=[0]*(N+1)
numB=[0]*(N+1)
for i in range(N):
numA[A[i]]+=1
numB[B[i]]+=1
flag=1
for j in range(N):
if numA[j]>N//2:
flag=0
break
if numA[j]>numofmaxA:
numofmaxA=numA... |
s742692649 | p02557 | u843175622 | 1600029491 | Python | Python (3.8.2) | py | Runtime Error | 256 | 39876 | 360 | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
offset = 0
i = 0
while i + offset < n:
while a[i + offset] == b[i]:
offset += 1
i += 1
c = []
for i in range(offset, n + offset):
c.append(b[i % n])
for i in range(n):
if a[i] == c[i]:
print('No')... |
s719237937 | p02557 | u784120390 | 1600029487 | Python | PyPy3 (7.3.0) | py | Runtime Error | 497 | 195076 | 3811 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s556623759 | p02557 | u408071652 | 1600029485 | Python | PyPy3 (7.3.0) | py | Runtime Error | 224 | 148236 | 797 | import sys
from collections import Counter
import bisect
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
AA = Counter(A)
BB = Counter(B)
max_con = 1
conA = 0
for key, va... |
s438002698 | p02557 | u225388820 | 1600029477 | Python | PyPy3 (7.3.0) | py | Runtime Error | 744 | 170832 | 1783 | from collections import Counter
from heapq import heappush, heapify, heappop
from collections import deque
from bisect import bisect_left, bisect_right
# bisect_left(a,x):a[i]>=xとなるような最小のi.
# 昇順ソートされたリストaに昇順を崩さずxを挿入できる位置s(0-index)を返す.
# a=[1,3,5,7,9,11,13,15,17,19]
#s = bisect_left(a,4)
# s=2
n = int(input())
a = list(... |
s842852078 | p02557 | u133240057 | 1600029467 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2209 | 119640 | 415 | import sys
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = a[n-1]
d = b[n-1]
if c < d:
c = d
for i in range(c):
if a.count(c+1) + b.count(c+1) > n:
print("No")
sys.exit()
e = []
f = 0
for j in range(n):
if a[j-f] != b[j-f]:
e.append(b[j-f])... |
s367053049 | p02557 | u692453235 | 1600029466 | Python | PyPy3 (7.3.0) | py | Runtime Error | 307 | 163404 | 850 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = Counter(A+B)
DicB = Counter(B)
if L.most_common(1)[0][1] > N:
print("No")
else:
A.reverse()
Bkey = [x[0] for x in DicB.most_common()]
ans = []
i = 0
for a in A:
if DicB[Bkey[i]... |
s227953169 | p02557 | u628285938 | 1600029461 | Python | Python (3.8.2) | py | Runtime Error | 307 | 68012 | 684 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 22:25:40 2020
@author: liang
"""
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
dic = dict()
common = dict()
def solve():
for a in A:
if a not in dic.keys():
dic[a] = 1
else:
di... |
s183329691 | p02557 | u711539583 | 1600029459 | Python | Python (3.8.2) | py | Runtime Error | 388 | 55912 | 794 | import heapq
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
heapq.heapify(b)
heapq.heapify(c)
ans = [0] * n
A = []
for i in range(n):
A.append((a[i],i))
A.sort(reverse=True)
k = 0
for i in range(n):
ai, j = A[i]
bi = -1
if c and c[0] != ai:
bi ... |
s995426452 | p02557 | u682672120 | 1600029414 | Python | PyPy3 (7.3.0) | py | Runtime Error | 380 | 159360 | 1465 | from bisect import bisect_left
from collections import Counter
n = int (input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_counter = Counter(a)
b_counter = Counter(b)
any_pos = []
a_dup = []
b_dup = []
for x, m in b_counter.items():
if x in a_counter:
a_dup.append((a_count... |
s635519133 | p02557 | u984960045 | 1600029414 | Python | PyPy3 (7.3.0) | py | Runtime Error | 235 | 166256 | 2894 | import os
from io import BytesIO, IOBase
import sys
from collections import Counter
def main():
n = int(input())
ans='Yes'
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=Counter(a)
d=Counter(b)
for i in c:
if (n-c[i])<d[i]:
ans='No'
break
... |
s991540956 | p02557 | u998769995 | 1600029413 | Python | PyPy3 (7.3.0) | py | Runtime Error | 252 | 176768 | 1270 | import math,sys,bisect,heapq
from collections import defaultdict,Counter,deque
from itertools import groupby,accumulate
#sys.setrecursionlimit(200000000)
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda: map(int,input().split())
alele = lambda: list(map(int... |
s168768616 | p02557 | u367701763 | 1600029403 | Python | PyPy3 (7.3.0) | py | Runtime Error | 233 | 158756 | 409 | from heapq import *
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
P, Q = Counter(A), Counter(B)
R = []
for i in range(N):
if N-P.get(i,0) < Q.get(i,0): print("No"); exit()
print("Yes")
j = 0
res = []
for i in range(N):
while A[i] == B[j]... |
s292341111 | p02557 | u711539583 | 1600029351 | Python | PyPy3 (7.3.0) | py | Runtime Error | 340 | 134000 | 794 | import heapq
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
heapq.heapify(b)
heapq.heapify(c)
ans = [0] * n
A = []
for i in range(n):
A.append((a[i],i))
A.sort(reverse=True)
k = 0
for i in range(n):
ai, j = A[i]
bi = -1
if c and c[0] != ai:
bi ... |
s028216150 | p02557 | u455408345 | 1600029344 | Python | Python (3.8.2) | py | Runtime Error | 522 | 90080 | 1169 | n=int(input(""))
aa=input("").split(" ")
bb=input("").split(" ")
a=[]
b=[]
listab=[]
for i in range(n):
a+=[int(aa[i])]
b+=[int(bb[i])]
listab+=[int(aa[i]),int(bb[i])]
listab.sort()
ta=0
mta=0
mtap=0
atmp=0
for i in listab:
if(atmp==i):
ta+=1
else:
if(mta<ta):
... |
s930202104 | p02557 | u714642969 | 1600029342 | Python | PyPy3 (7.3.0) | py | Runtime Error | 565 | 170100 | 1126 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
from collections import Counter,defaultdict
from... |
s940204550 | p02557 | u998769995 | 1600029338 | Python | PyPy3 (7.3.0) | py | Runtime Error | 273 | 166516 | 1257 | import math,sys,bisect,heapq
from collections import defaultdict,Counter,deque
from itertools import groupby,accumulate
#sys.setrecursionlimit(200000000)
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda: map(int,input().split())
alele = lambda: list(map(int... |
s514342639 | p02557 | u693566873 | 1600029335 | Python | PyPy3 (7.3.0) | py | Runtime Error | 404 | 179848 | 1513 | import collections
import sys
def solve(n, A, B):
Ac = {}
ABc = {}
for a in A:
Ac[a] = 1 + Ac.get(a, 0)
ABc[a] = 1 + ABc.get(a, 0)
Bc = {}
for b in B:
Bc[b] = 1 + Bc.get(b, 0)
ABc[b] = 1 + ABc.get(b, 0)
cAB = sorted([(c, ab) for ab, c in ABc.items()])
#print(cAB)
pool = collections.deq... |
s426219638 | p02557 | u482789362 | 1600029316 | Python | PyPy3 (7.3.0) | py | Runtime Error | 260 | 172264 | 680 | from collections import Counter, deque
(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
freqA = Counter(A)
freqB = Counter(B)
for k in freqA.keys() & freqB.keys():
if freqA[k] + freqB[k] > N:
print("No")
exit()
rotate = 0
for i i... |
s722765984 | p02557 | u191874006 | 1600029292 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 195500 | 1349 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collection... |
s403547734 | p02557 | u852110531 | 1600029272 | Python | PyPy3 (7.3.0) | py | Runtime Error | 993 | 187252 | 3059 | """
pppppppppppppppppppp
ppppp ppppppppppppppppppp
ppppppp ppppppppppppppppppppp
pppppppp pppppppppppppppppppppp
pppppppppppppppppppppppppppppppp
pppppppppppppppppppp... |
s596346391 | p02557 | u455408345 | 1600029255 | Python | Python (3.8.2) | py | Runtime Error | 334 | 72480 | 1170 | n=int(input(""))
aa=input("").split(" ")
bb=input("").split(" ")
a=[]
b=[]
listab=[]
for i in range(n):
a+=[int(aa[i])]
b+=[int(bb[i])]
listab+=[int(aa[i]),int(bb[i])]
listab.sort()
ta=0
mta=0
mtap=0
atmp=0
for i in listab:
if(atmp==i):
ta+=1
else:
if(mta<ta):
... |
s368421373 | p02557 | u784120390 | 1600029230 | Python | PyPy3 (7.3.0) | py | Runtime Error | 555 | 195792 | 3775 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s295576851 | p02557 | u129019798 | 1600029215 | Python | Python (3.8.2) | py | Runtime Error | 534 | 115176 | 1432 | def main():
import sys
from collections import Counter
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
B=list(map(int,sys.stdin.readline().split()))
AC=Counter(A)
BC=Counter(B)
for a in AC:
if a in BC:
if AC[a]+BC[a]>N:
... |
s596491052 | p02557 | u391731808 | 1600029172 | Python | Python (3.8.2) | py | Runtime Error | 233 | 56464 | 1336 | from collections import deque
N=int(input())
*A, = map(int,input().split())
*B, = map(int,input().split())
A_c = {}
B_c = {}
for a in A:
A_c[a] = A_c.get(a,0) + 1
for b in B:
B_c[b] = B_c.get(b,0) + 1
for a,n in A_c.items():
m = B_c.get(a,0)
if n + m > N:
print("No")
exit()
print("Y... |
s353591331 | p02557 | u620480037 | 1600029137 | Python | PyPy3 (7.3.0) | py | Runtime Error | 681 | 167776 | 1260 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
DA={}
DB={}
for i in range(N):
if A[i] not in DA:
DA[A[i]]=1
else:
DA[A[i]]+=1
if B[i] not in DB:
DB[B[i]]=1
else:
DB[B[i]]+=1
for k,v in DB.items():
if k not in DA:
pass
... |
s616450268 | p02557 | u784120390 | 1600029131 | Python | PyPy3 (7.3.0) | py | Runtime Error | 516 | 227364 | 3691 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s620524331 | p02557 | u431573188 | 1600029131 | Python | PyPy3 (7.3.0) | py | Runtime Error | 398 | 124104 | 1420 | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
Table = [None]*N
import heapq
cnt = 1
heap_A = []
h = 0
t = 1
for i in range(1,N):
if A[i-1] != A[i]:
Table[A[i-1]] = (h, t)
heapq.heappush(heap_A, (-1*cnt, A[i-1]))
cnt = 0
h = t
cnt += 1... |
s904906930 | p02557 | u825378567 | 1600029127 | Python | Python (3.8.2) | py | Runtime Error | 196 | 55704 | 537 | import collections
def ge():
return map(int,input().split())
def main():
#a,b,c,d=ge()
#N=int(input())
#a=list(map(int,input().split()))
#a=input()
N=int(input())
A=list(ge())
B=list(ge())
tmp=[]
for i in range(N):
if A[i]==B[i]:
tmp.append(B[i])
count=col... |
s656165607 | p02557 | u104282757 | 1600029125 | Python | Python (3.8.2) | py | Runtime Error | 486 | 95220 | 2874 | from collections import Counter
def solve(n, a_list, b_list):
count_a = Counter(a_list)
count_b = Counter(b_list)
count_ab = dict()
for k in count_a.keys():
if k in count_b.keys():
if count_a[k] + count_b[k] > n:
return ["No"]
count_ab[k] = min(count_a[k... |
s287413801 | p02557 | u189056821 | 1600029103 | Python | Python (3.8.2) | py | Runtime Error | 261 | 56200 | 552 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if N == 1:
if A == B:
print('No')
else:
print('Yes')
else:
c_A = Counter(A)
c_B = Counter(B)
if (c_A.most_common(1)[0][0] == c_B.most_common(1)[0][0] or\
... |
s680784717 | p02557 | u391731808 | 1600029066 | Python | Python (3.8.2) | py | Runtime Error | 229 | 56300 | 1324 |
from collections import deque
N=int(input())
*A, = map(int,input().split())
*B, = map(int,input().split())
A_c = {}
B_c = {}
for a in A:
A_c[a] = A_c.get(a,0) + 1
for b in B:
B_c[b] = B_c.get(b,0) + 1
for a,n in A_c.items():
m = B_c.get(a,0)
if n + m > N:
print("No")
exit()
print("... |
s648561492 | p02557 | u129019798 | 1600029063 | Python | Python (3.8.2) | py | Runtime Error | 509 | 115704 | 1316 | def main():
import sys
from collections import Counter
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
B=list(map(int,sys.stdin.readline().split()))
AC=Counter(A)
BC=Counter(B)
for a in AC:
if a in BC:
if AC[a]+BC[a]>N:
... |
s906715083 | p02557 | u638795007 | 1600029052 | Python | PyPy3 (7.3.0) | py | Runtime Error | 242 | 132956 | 4073 | def main():
examF()
def examA():
N = I()
ans = 1^N
print(ans)
return
def examB():
a, b, c, d = LI()
ans = max(a*c,a*d,b*c,b*d)
print(ans)
return
def examC():
N = I()
if N==1:
ans = 0
else:
ans = pow(10,N,mod) - pow(9,N,mod)*2 + pow(8,N,mod)
ans ... |
s051152131 | p02557 | u784120390 | 1600029038 | Python | PyPy3 (7.3.0) | py | Runtime Error | 516 | 227120 | 3614 | # by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import defaultdict
from heapq import *
class Node:
def __init__(self,ind,val):
self.ind = ind
self.val = val
def __lt__(self, other):
return self.val > other.val
... |
s809997469 | p02557 | u877415670 | 1600029034 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1043 | 151832 | 938 | from collections import Counter, deque
import itertools
import heapq
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
gr = itertools.groupby(a)
cnt = Counter(b)
c = []
for i, m in cnt.items():
heapq.heappush(c, [-m, i])
ans = []
for key, group in gr:
ai, am = key, len... |
s420589323 | p02557 | u046158516 | 1600029026 | Python | PyPy3 (7.3.0) | py | Runtime Error | 184 | 123344 | 1164 | import sys
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
counta=[0]*(200000+1)
countb=[0]*(200000+1)
dic={}
for i in range(n):
counta[a[i]]+=1
countb[b[i]]+=1
for i in range(n+1):
if counta[i]+countb[i]>n:
... |
s246230990 | p02557 | u391731808 | 1600029019 | Python | Python (3.8.2) | py | Runtime Error | 223 | 56376 | 1311 | from collections import deque
N=int(input())
*A, = map(int,input().split())
*B, = map(int,input().split())
A_c = {}
B_c = {}
for a in A:
A_c[a] = A_c.get(a,0) + 1
for b in B:
B_c[b] = B_c.get(b,0) + 1
for a,n in A_c.items():
m = B_c.get(a,0)
if n + m > N:
print("No")
exit()
1/0
pri... |
s850695670 | p02557 | u847923740 | 1600029018 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1123 | 165084 | 1955 | #
import sys
input=sys.stdin.readline
import heapq
def main():
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cntA = dict()
cntB = dict()
for i in range(N):
cntA[A[i]] = cntA.get(A[i], 0) + 1
cntB[B[i]] = cntB.get(B[i], 0) + 1
for i... |
s773892010 | p02557 | u562016607 | 1600029013 | Python | PyPy3 (7.3.0) | py | Runtime Error | 586 | 170928 | 1708 | from collections import deque
import random
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
if 0:
N=2*10**5
A=[random.randrange(1,N+1) for i in range(N)]
B=[random.randrange(1,N+1) for i in range(N)]
A.sort()
B.sort()
a=[0 for i in range(N+1)]
b=[0 for i in ran... |
s239105982 | p02557 | u994988729 | 1600029010 | Python | Python (3.8.2) | py | Runtime Error | 1167 | 120628 | 1184 | from collections import Counter
import heapq
U = 2*10**5
def main():
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ca = Counter(A)
cb = Counter(B)
ha = []
hb = []
for i in range(1, U+1):
if cb[i] > N - ca[i]:
print("No")
... |
s899737446 | p02557 | u873915460 | 1600028992 | Python | PyPy3 (7.3.0) | py | Runtime Error | 153 | 106676 | 1469 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[0]*N
D=[0]*N
for i in range(N):
C[A[i]-1]+=1
D[B[i]-1]+=1
E,F=max(C),max(D)
if min(E,F)>N//2 and C.index(E)==D.index(F):
print('No')
exit()
P=[0]*N... |
s020816946 | p02557 | u167542063 | 1600028962 | Python | Python (3.8.2) | py | Runtime Error | 110 | 40404 | 308 | n=int(input())
a=list(map(int,input().split()))
a.sort()
b=list(map(int,input().split()))
list=[]
for i in range(n):
for k in range(n):
for j in range(n-k+1):
if a[i]!=b[j]:
list.append(list[j])
del list[j]
if i==n:
print("".join(list))
if a[i]!=b[j]:break
|
s496961033 | p02557 | u825378567 | 1600028943 | Python | Python (3.8.2) | py | Runtime Error | 191 | 53848 | 538 | import collections
def ge():
return map(int,input().split())
def main():
#a,b,c,d=ge()
#N=int(input())
#a=list(map(int,input().split()))
#a=input()
N=int(input())
A=list(ge())
B=list(ge())
tmp=[]
for i in range(N):
if A[i]==B[i]:
tmp.append(B[i])
count=col... |
s444421038 | p02557 | u790710233 | 1600028907 | Python | PyPy3 (7.3.0) | py | Runtime Error | 209 | 136960 | 1093 | from collections import Counter, defaultdict, deque
n = int(input())
A = list(map(int, input().split()))
Borigin = list(map(int, input().split()))
Acnt = Counter(A)
NG = defaultdict(int)
for k, v in Acnt.items():
NG[k] = n-v+1
Bcnt = Counter(B)
B = deque(Borigin.copy())
newB = [None]*n
cnt = 0
is_skip = 0
for i, ... |
s859948660 | p02557 | u847923740 | 1600028906 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1106 | 164392 | 1869 | #
import sys
input=sys.stdin.readline
import heapq
def main():
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cntA = dict()
cntB = dict()
for i in range(N):
cntA[A[i]] = cntA.get(A[i], 0) + 1
cntB[B[i]] = cntB.get(B[i], 0) + 1
for i... |
s814956648 | p02557 | u415718506 | 1600028902 | Python | PyPy3 (7.3.0) | py | Runtime Error | 598 | 225876 | 2489 | import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict
# available on Google, not available on Codeforces
# import numpy as np
# import scipy
def solve(arr, brr): # fix inputs here
console(arr)
console(brr)
console("----- solving ------")
c1 ... |
s471517378 | p02557 | u248996551 | 1600028877 | Python | PyPy3 (7.3.0) | py | Runtime Error | 116 | 88820 | 1963 | N=int(input())
X=[]
Y=[]
Z=[]
for i in range(N):
x,y=map(int,input().split())
X.append(x)
Y.append(y)
Z.append([x,y])
def signed_area(p1, p2, p3):
'''符号付き面積を計算 '''
area = (((p2[0] - p1[0]) * (p3[1] - p1[1])) - ((p3[0] - p1[0]) * (p2[1] - p1[1]))) / 2
return area
def convex_hull(p_list)... |
s933360514 | p02557 | u129019798 | 1600028862 | Python | Python (3.8.2) | py | Runtime Error | 550 | 115528 | 1328 | def main():
import sys
from collections import Counter
from bisect import bisect_left
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
B=list(map(int,sys.stdin.readline().split()))
AC=Counter(A)
BC=Counter(B)
for a in AC:
if a in BC:
... |
s712557262 | p02557 | u216928054 | 1600028860 | Python | PyPy3 (7.3.0) | py | Runtime Error | 402 | 148136 | 2328 | #!/usr/bin/env python3
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def debug(*x):
print(*x, file=sys.stderr)
def solve(N, AS, BS):
acount = [0] * (N + 10)
bcount = [0] * (N + 10)
for i in range(N):
... |
s803798859 | p02557 | u703528810 | 1600028858 | Python | Python (3.8.2) | py | Runtime Error | 339 | 55604 | 637 | from collections import deque
from bisect import bisect_right as br
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
dA={}
dB={}
for i in range(N):
if A[i] in dA:
dA[A[i]]+=1
else:
dA[A[i]]=1
if B[i] in dB:
dB[B[i]]+=1
else:
dB[B[i]]=1
a... |
s145570918 | p02557 | u391731808 | 1600028851 | Python | Python (3.8.2) | py | Runtime Error | 228 | 56352 | 1314 | from collections import deque
N=int(input())
*A, = map(int,input().split())
*B, = map(int,input().split())
A_c = {}
B_c = {}
for a in A:
A_c[a] = A_c.get(a,0) + 1
for b in B:
B_c[b] = B_c.get(b,0) + 1
for a,n in A_c.items():
m = B_c.get(a,0)
if n + m > N:
print("No")
exit()
print("Y... |
s357383930 | p02557 | u201660334 | 1600028832 | Python | PyPy3 (7.3.0) | py | Runtime Error | 838 | 250288 | 1747 | import collections
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = {}
count_a = {}
count_b = {}
for i in range(n):
count.setdefault(a[i], 0)
count[a[i]] += 1
count_a.setdefault(a[i], set())
count_a[a[i]].add(i)
count.setdefault(b[i], 0)
count[b[i... |
s963119544 | p02557 | u790710233 | 1600028825 | Python | PyPy3 (7.3.0) | py | Runtime Error | 283 | 177564 | 1075 | from collections import Counter, defaultdict, deque
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
Acnt = Counter(A)
NG = defaultdict(int)
for k, v in Acnt.items():
NG[k] = n-v+1
Bcnt = Counter(B)
B = deque(B.copy())
newB = [None]*n
cnt = 0
is_skip = 0
for i, a in enumera... |
s554105480 | p02557 | u189056821 | 1600028790 | Python | Python (3.8.2) | py | Runtime Error | 255 | 56468 | 429 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c_A = Counter(A)
c_B = Counter(B)
if (c_A.most_common(1)[0][0] == c_B.most_common(1)[0][0] or\
c_A.most_common(2)[1][0] == c_B.most_common(1)[0][0]) and \
(c_A.most_common(1)[0][1] > N//2 or ... |
s258780002 | p02557 | u009348313 | 1600028779 | Python | PyPy3 (7.3.0) | py | Runtime Error | 164 | 128992 | 556 | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
def f(a,b):
l = len(b)
i = 0
j = 0
while(i < len(a) and j < 2*l):
if a[i] != b[j]:
ans.append(b[j])
i += 1
else:
b += [b[j]]
j += 1
if len(ans) != len(a):
return False
else:
for i in... |
s170838515 | p02557 | u595952233 | 1600028774 | Python | Python (3.8.2) | py | Runtime Error | 261 | 41720 | 480 | from collections import Counter
import heapq
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cur = n-1
bit = 1
for i in range(n):
if a[i] == b[i]:
while a[i]==b[cur]:
cur-=bit
if cur == 0:
bit = -1
if bit == -1 an... |
s593851839 | p02557 | u562016607 | 1600028761 | Python | PyPy3 (7.3.0) | py | Runtime Error | 237 | 160568 | 1128 | from collections import deque
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
if 0:
import random
N=2*10**5
A=[random.randrange(1,N+1) for i in range(N)]
B=[random.randrange(1,N+1) for i in range(N)]
A.sort()
B.sort()
a=[0 for i in range(N+1)]
b=[0 for i in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.