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
s135326811
p02557
u024340351
1600028753
Python
Python (3.8.2)
py
Runtime Error
2207
48492
801
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) maxAB = max(max(A), max(B)) Avec = [0]*maxAB Bvec = [0]*maxAB for i in range (0, N): Avec[A[i]-1]+=1 Bvec[B[i]-1]+=1 for i in range (0, maxAB): if Avec[i]+Bvec[i] > N: print('No') exit() print('Yes') C = [0]*N i...
s447230419
p02557
u620480037
1600028750
Python
PyPy3 (7.3.0)
py
Runtime Error
660
168024
1223
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 ...
s461236790
p02557
u790710233
1600028731
Python
PyPy3 (7.3.0)
py
Runtime Error
262
175908
1062
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) newB = [None]*n cnt = 0 is_skip = 0 for i, a in enumerate(A): ...
s597786629
p02557
u723792785
1600028728
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
142228
756
import random from collections import Counter n = int(input()) a = list(map(int,input().split())) ac = Counter(a) b = list(map(int,input().split())) bc = Counter(b) mode = 1 for i in range(n): if ac[i] > n - bc[i]: mode = 0 break if mode: print("Yes") stack = [] b.reverse() for i in range(n): if a[i] == b[...
s560163689
p02557
u948911484
1600028720
Python
PyPy3 (7.3.0)
py
Runtime Error
170
118164
689
import copy n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) la = [0]*(n+1) lb = [0]*(n+1) for i in range(n): la[a[i]] += 1 lb[b[i]] += 1 for i in range(1,n+1): if la[i] > n//2 and lb[i] > n//2: print("No") quit() print("Yes") b = b[::-1] s = 0 for i in ...
s796135816
p02557
u711539583
1600028700
Python
PyPy3 (7.3.0)
py
Runtime Error
393
133844
752
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 ...
s722479912
p02557
u438720156
1600028692
Python
Python (3.8.2)
py
Runtime Error
110
41332
551
def permute(p2,l,r): 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]=p2[i],p2[l] if...
s575537322
p02557
u353797797
1600028676
Python
PyPy3 (7.3.0)
py
Runtime Error
197
121936
1198
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_n...
s973470827
p02557
u588341295
1600028615
Python
PyPy3 (7.3.0)
py
Runtime Error
203
137372
887
import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)] def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k...
s286418031
p02557
u391731808
1600028608
Python
Python (3.8.2)
py
Runtime Error
303
56404
1303
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...
s555975802
p02557
u415718506
1600028599
Python
PyPy3 (7.3.0)
py
Runtime Error
596
215076
2496
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("----- solving ------") c1 = Counter(arr) c2 = Counter(br...
s627363300
p02557
u711539583
1600028585
Python
PyPy3 (7.3.0)
py
Runtime Error
318
134208
723
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 ...
s487614317
p02557
u711539583
1600028523
Python
PyPy3 (7.3.0)
py
Runtime Error
350
134552
713
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 ...
s640590768
p02557
u225388820
1600028516
Python
PyPy3 (7.3.0)
py
Runtime Error
647
158132
1626
from collections import Counter from heapq import heappush, heapify, heappop 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(map(int, input().split())) b =...
s981619904
p02557
u152417130
1600028515
Python
PyPy3 (7.3.0)
py
Runtime Error
677
168920
1501
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) sa = set(a) sb = set(b) count = [0] * (n + 1) counta = [0] * (n + 1) countb = [0] * (n + 1) for v in a: count[v] += 1 counta[v] += 1 for v in b: count[v] += 1 countb[v] += 1 for v in count: if v > n: ...
s320722038
p02557
u607075479
1600028514
Python
PyPy3 (7.3.0)
py
Runtime Error
174
125460
1338
import sys import math from collections import deque sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, num): return [[int(num)] * w for _ in...
s434614814
p02557
u562016607
1600028500
Python
PyPy3 (7.3.0)
py
Runtime Error
1139
164780
1186
from collections import deque import heapq 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)] ...
s521978006
p02557
u225388820
1600028499
Python
PyPy3 (7.3.0)
py
Runtime Error
710
157952
1632
from collections import Counter from heapq import heappush, heapify, heappop 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(map(int, input().split())) b =...
s779938572
p02557
u873915460
1600028473
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
125944
729
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() C,D=D[:],C[:] P=[0]*N X=[-1]*N for i in range(N): X[A[i]-1]=i P=[-1]*N for i in range(...
s543470159
p02557
u994988729
1600028472
Python
Python (3.8.2)
py
Runtime Error
1044
114612
1164
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") ...
s925775756
p02557
u807772568
1600028462
Python
PyPy3 (7.3.0)
py
Runtime Error
301
183728
2259
import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] if l...
s851635351
p02557
u770293614
1600028456
Python
Python (3.8.2)
py
Runtime Error
65
40204
258
N=int(input()) arr=[] for i in range(N): arr.append([map(int,input().split(' '))]) most=0 for j in range(len(arr)): for k in range(i,len(arr)): x1,y1,x2,y2=arr[j][0],arr[j][1],arr[k][0],arr[k][1] most=max(most,(abs(x1-x2)+abs(y1-y2))) print(most)
s639954426
p02557
u211160392
1600028456
Python
PyPy3 (7.3.0)
py
Runtime Error
321
173948
604
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) AL,AR = {},{} BL,BR = {},{} for i in range(N): if not A[i] in AL: AL[A[i]] = i AR[A[i]] = i for i in range(N): if not B[i] in BL: BL[B[i]] = i BR[B[i]] = i can = [1]*(N) for i in BL.keys(): if n...
s090575671
p02557
u438720156
1600028405
Python
Python (3.8.2)
py
Runtime Error
120
41508
499
def permute(p2,l,r): if l==r and flag==0: count=0 for i in range(n): if p1[i]!=p2[i]: count+=1 break if count==n: flag=1 print("YES") print(p2) else: for i in range(l,r+1): p2[l],p2[i]=p2[i],p2[l] if flag==0: permute(l+1,r) p2[l],p2[i]...
s733421301
p02557
u189479417
1600028405
Python
PyPy3 (7.3.0)
py
Runtime Error
284
148560
643
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) maxA = 0 maxB = 0 for item in ca.values(): maxA = max(maxA, item) for item in cb.values(): maxB = max(maxB, item) if maxA + maxB > N: print('No')...
s925330813
p02557
u740260565
1600028399
Python
PyPy3 (7.3.0)
py
Runtime Error
193
131940
765
import bisect n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ab = [[0 for _ in range(2)] for _ in range(10)] for i in range(n): ab[a[i]][0] += 1 ab[b[i]][1] += 1 flag = 0 for i in range(10): if(ab[i][0] + ab[i][0] > n): flag = 1 if (flag == 1): ...
s884876327
p02557
u167542063
1600028397
Python
Python (3.8.2)
py
Runtime Error
2206
40376
304
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): if a[i]==b[j]: list.append(list[j]) del list[j] if i==n: print("".join(list)) if a[i]==b[j]:break
s421426030
p02557
u391731808
1600028386
Python
Python (3.8.2)
py
Runtime Error
299
56532
1285
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("...
s237627250
p02557
u887152994
1600028382
Python
Python (3.8.2)
py
Runtime Error
230
41864
1012
N=int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) B.sort(reverse=True) Arev=sorted(A, reverse=True) Brev=sorted(B) atai=0 s=0 for i in range(len(A)): if A[i]==B[i]: atai=A[i] s+=1 C=[] for i in range(len(A)): C.append(A[i]-B[i]) if 0 in C =="True": hajime...
s715828546
p02557
u695811449
1600028370
Python
PyPy3 (7.3.0)
py
Runtime Error
424
181452
1641
import sys input = sys.stdin.readline from operator import itemgetter N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) from collections import Counter CA=Counter(A) CB=Counter(B) U=[] for ca in CA: if CA[ca]>0 and CB[ca]>0: if CA[ca]+CB[ca]>N: print("No") ...
s733805575
p02557
u852110531
1600028368
Python
PyPy3 (7.3.0)
py
Runtime Error
304
169700
3091
""" pppppppppppppppppppp ppppp ppppppppppppppppppp ppppppp ppppppppppppppppppppp pppppppp pppppppppppppppppppppp pppppppppppppppppppppppppppppppp pppppppppppppppppppp...
s080097541
p02557
u067983636
1600028359
Python
PyPy3 (7.3.0)
py
Runtime Error
3668
264572
2185
import sys from collections import deque from functools import lru_cache import bisect import copy import heapq import itertools import math input = sys.stdin.readline sys.setrecursionlimit(1000000) mod = 10 ** 9 + 7 def read_values(): return map(int, input().split()) def read_index(): return map(lambda x: int(x) - 1,...
s020851427
p02557
u820087133
1600028355
Python
Python (3.8.2)
py
Runtime Error
2208
80932
747
from collections import Counter import numpy as np N = int(input()) A = np.array([int(s) for s in input().split()]) B = np.array([int(s) for s in input().split()]) A_count = Counter(A) B_count = Counter(B) duplicate_counts = [max(A_count[i], B_count[i]) for i in A_count.keys() if i in B_count.k...
s229142597
p02557
u968166680
1600028354
Python
PyPy3 (7.3.0)
py
Runtime Error
411
159092
2050
import sys from collections import Counter from heapq import heapify, heappush, heappop read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N = int(readline()) A = list(map(int, readline().split())) ...
s041712633
p02557
u740260565
1600028354
Python
PyPy3 (7.3.0)
py
Runtime Error
189
131952
761
import bisect n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ab = [[0 for _ in range(2)] for _ in range(10)] for i in range(n): ab[a[i]][0] += 1 ab[b[i]][1] += 1 flag = 0 for i in range(10): if(ab[i][0] + ab[i][0] > n): flag = 1 if (flag == 1): ...
s307290278
p02557
u807772568
1600028347
Python
PyPy3 (7.3.0)
py
Runtime Error
321
183788
2254
import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] if l...
s877856784
p02557
u800396927
1600028328
Python
PyPy3 (7.3.0)
py
Runtime Error
164
121692
1136
n = int(input()) A = list(map(int,input().split())) B =list(map(int,input().split())) f = True for i in range(n): if A[i]==B[i]: f = False break if f: print('Yes') ans =[str(i) for i in B] print(' '.join(ans)) exit() if A[-1]<B[0]: print('Yes') ans =[str(i) for i in B] p...
s367141804
p02557
u424768586
1600028322
Python
PyPy3 (7.3.0)
py
Runtime Error
1042
188412
3725
import sys sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python import math from copy import copy, deepcopy from copy import deepcopy as dcp from operator import itemgetter from bisect import bisect_left, bisect, bisect_right#2分探索 #bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下 from collection...
s087021278
p02557
u190735555
1600028315
Python
Python (3.8.2)
py
Runtime Error
2206
40244
623
n=int(input()) a=list(map(int, input().split())) b=list(map(int, input().split())) l=[0]*(n+1) for i in range(n): x=a[i] y=b[i] l[x]+=1 l[y]+=1 if max(l)>n: print('No') else: print('Yes') for j in range(n): if l[j]==max(l): M=j for k in range(n): if a[k]=...
s886105721
p02557
u046158516
1600028304
Python
PyPy3 (7.3.0)
py
Runtime Error
188
123404
1163
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]*(n+1) countb=[0]*(n+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: print('...
s164869945
p02557
u875291233
1600028303
Python
Python (3.8.2)
py
Runtime Error
2207
86216
1636
# coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read n, = map(int,readline().split()) *a, = map(int,readline().split()) *b, = map(int,readline().split()) ca = [0]*(n+1) cb = [0]*(n+1) for i in a: ca[i] += 1 for i in b: cb[i] += 1 from heapq import * qa = [] #qb = [] sb ...
s400164145
p02557
u035603241
1600028297
Python
PyPy3 (7.3.0)
py
Runtime Error
156
121668
3216
# ------------------- fast io -------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode...
s554436112
p02557
u391731808
1600028295
Python
Python (3.8.2)
py
Runtime Error
306
56332
1284
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...
s603326349
p02557
u095094246
1600028286
Python
PyPy3 (7.3.0)
py
Runtime Error
166
109348
423
import sys from collections import deque n=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) # A_iでない値を充当していく。 ans = [0]*n B = deque(B) B.rotate() for i,a in enumerate(A): while 1: x = B.popleft() if a != x: ans[i] = x break y = B.pop() if x == y: print('...
s782502361
p02557
u152417130
1600028274
Python
Python (3.8.2)
py
Runtime Error
26
9092
1424
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) n += 5 sa = set(a) sb = set(b) count = [0] * n counta = [0] * n countb = [0] * n for v in a: count[v] += 1 counta[v] += 1 for v in b: count[v] += 1 countb[v] += 1 outA = dict() for v in a: outA[v] = [] impo...
s109446188
p02557
u152417130
1600028259
Python
PyPy3 (7.3.0)
py
Runtime Error
149
68532
1424
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) n += 5 sa = set(a) sb = set(b) count = [0] * n counta = [0] * n countb = [0] * n for v in a: count[v] += 1 counta[v] += 1 for v in b: count[v] += 1 countb[v] += 1 outA = dict() for v in a: outA[v] = [] impo...
s030222783
p02557
u190735555
1600028218
Python
Python (3.8.2)
py
Runtime Error
74
32492
608
a=list(map(int, input().split())) b=list(map(int, input().split())) l=[0]*(n+1) for i in range(n): x=a[i] y=b[i] l[x]+=1 l[y]+=1 if max(l)>n: print('No') else: print('Yes') for j in range(n): if l[j]==max(l): M=j for k in range(n): if a[k]==M and a[(k+1)%...
s599801545
p02557
u648881683
1600028184
Python
Python (3.8.2)
py
Runtime Error
313
81924
1495
import bisect, collections, copy, heapq, itertools, math, string, sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = float('inf') def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [...
s543386736
p02557
u887152994
1600028179
Python
Python (3.8.2)
py
Runtime Error
258
41868
988
N=int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) B.sort(reverse=True) Arev=sorted(A, reverse=True) Brev=sorted(B) atai=0 s=0 for i in range(len(A)): if A[i]==B[i]: atai=A[i] s+=1 C=[] for i in range(len(A)): C.append(A[i]-B[i]) hajime=C.index(0) if s==0: ...
s136907880
p02557
u594803920
1600028167
Python
PyPy3 (7.3.0)
py
Runtime Error
100
92956
552
n = int(input()) l = [] ll = [] for _ in range(n): x, y = map(int, input().split()) l.append((x+y, x, y)) ll.append((x-y, x, y)) l.sort() ll.sort() ans1 = 0 ans2 = 0 cnt = 0 while True: a = l[-cnt] b = l[cnt] if a[1] >= b[1] and a[2] >= b[2]: ans1 = b[0]-a[0] break if cnt >=...
s797524217
p02557
u535803878
1600028150
Python
PyPy3 (7.3.0)
py
Runtime Error
412
200028
1330
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) # 二分探索木の代わり BST HST # 存在しない要素に対するremoveはこないことを仮定している h = [] from collections import Co...
s412019579
p02557
u711539583
1600028134
Python
PyPy3 (7.3.0)
py
Runtime Error
357
133696
609
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) for i in range(n): ai, j = A[i] bi = -1 if c and c[0] != ai: bi = heap...
s822106077
p02557
u820087133
1600028133
Python
Python (3.8.2)
py
Runtime Error
2208
81024
705
from collections import Counter import numpy as np N = int(input()) A = np.array([int(s) for s in input().split()]) B = np.array([int(s) for s in input().split()]) A_count = Counter(A) B_count = Counter(B) duplicate_counts = [max(A_count[i], B_count[i]) for i in A_count.keys() if i in B_count.k...
s466959410
p02557
u852790844
1600028133
Python
Python (3.8.2)
py
Runtime Error
565
51748
832
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: print("Yes") num, count = np.unique(b, return_counts=True) ans = [] for i in range...
s159925609
p02557
u714642969
1600028087
Python
PyPy3 (7.3.0)
py
Runtime Error
194
135488
505
# -*- 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 N=int(input()) ...
s316192537
p02557
u969708690
1600028042
Python
Python (3.8.2)
py
Runtime Error
367
59360
1901
import collections N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) L=A+B c = collections.Counter(L) for i in c: if c[i]>N: print("No") exit() c = collections.Counter(B) K=list(c) M=dict(c) ans=list() for i in range(N): if A[i]==K[-1]: if len(K)==1: break ans.a...
s181001628
p02557
u807772568
1600027892
Python
PyPy3 (7.3.0)
py
Runtime Error
285
176356
2241
import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] if l...
s699184837
p02557
u940831163
1600027871
Python
Python (3.8.2)
py
Runtime Error
394
56636
616
import collections n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = collections.Counter(a) d = collections.Counter(b) k = 1 count = 0 for i in range(n): if c[i+1] + d[i+1] > n: print('No') exit() if c[i+1] + d[i+1] > count: k = i+1 co...
s092227476
p02557
u167542063
1600027869
Python
Python (3.8.2)
py
Runtime Error
45
25084
271
n=int(input()) a=list[map(int,input().split())] a.sort() b=list[map(int,input().split())] list=[] for i in range(n): for j in range(n): if a[i]==b[j]: list.append(list[j]) del list[j] if i==n: print("".join(list)) if a[i]==b[j]:break
s006113564
p02557
u424768586
1600027846
Python
PyPy3 (7.3.0)
py
Runtime Error
1088
188784
3715
import sys sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python import math from copy import copy, deepcopy from copy import deepcopy as dcp from operator import itemgetter from bisect import bisect_left, bisect, bisect_right#2分探索 #bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下 from collection...
s843482736
p02557
u401686269
1600027846
Python
Python (3.8.2)
py
Runtime Error
589
124476
739
from collections import Counter,defaultdict from bisect import bisect_left,bisect_right N=int(input()) *A,=map(int,input().split()) *B,=map(int,input().split()) c1 = Counter(A) c2 = Counter(B) c3 = {} for k in c1.keys(): if c2.get(k): c3[k] = min(c1[k],c2[k]) c = Counter() c.update(c3) mc = c.most_common()[0...
s460751690
p02557
u498487134
1600027796
Python
PyPy3 (7.3.0)
py
Runtime Error
541
173364
2869
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): import heapq from collections import defaultdict dd = defaultdict(int) N=I() A=LI() B=LI() cntA=[0]*(N+1) ...
s596052499
p02557
u187516587
1600027774
Python
Python (3.8.2)
py
Runtime Error
366
41204
1100
import heapq N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) la=[0]*N lb=[0]*N M=0 for i in range(N): la[A[i]-1]+=1 lb[B[i]-1]+=1 B[i]=-B[i] for i in range(N): s=la[i]+lb[i] if s>M: k=i+1 M=s if s>N: print("No") exit() ...
s786960853
p02557
u870761020
1600027765
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
147476
512
n = int(input()) set_a = list(input().split()) set_b = list(input().split()) inters = set(set_a) & set(set_b) set_a, set_b = ''.join(set_a), ''.join(set_b) lst = [] for i in inters: if set_a.count(i) >= set_b.count(i): lst.append(set_b.count(i)) else: lst.append(set_a.count(i)) if max(lst)...
s593859699
p02557
u807772568
1600027749
Python
PyPy3 (7.3.0)
py
Runtime Error
276
176164
2206
import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] if l...
s545524265
p02557
u022979415
1600027736
Python
Python (3.8.2)
py
Runtime Error
222
49620
781
def main(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split()))[::-1] ind = [-1] * (n + 1) for i in range(n): if i == 0: ind[b[i]] = 0 elif b[i] != b[i - 1]: ind[b[i]] = i for i in range(n): if a[i] != b[i]: ...
s919555916
p02557
u498487134
1600027712
Python
PyPy3 (7.3.0)
py
Runtime Error
532
173328
2886
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): import heapq from collections import defaultdict dd = defaultdict(int) N=I() A=LI() B=LI() cntA=[0]*(N+1) ...
s385710181
p02557
u249218427
1600027670
Python
PyPy3 (7.3.0)
py
Runtime Error
2210
149216
874
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) dict_int = dict() dict_b = dict() def insert(dict_, a): if a in dict_.keys(): dict_[a] += 1 else: dict_[a] = 1 for a in A: insert(dict_int,a) for b in B: insert(dict_int,b) insert(dict_b,b) max_int = max(dic...
s165747558
p02557
u940831163
1600027636
Python
Python (3.8.2)
py
Runtime Error
407
56104
454
import collections n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = collections.Counter(a) d = collections.Counter(b) k = 1 count = 0 for i in range(n): if c[i+1] + d[i+1] > n: print('No') exit() if c[i+1] + d[i+1] > count: k = i+1 co...
s116023731
p02557
u498487134
1600027636
Python
PyPy3 (7.3.0)
py
Runtime Error
503
173336
2893
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): import heapq from collections import defaultdict dd = defaultdict(int) N=I() A=LI() B=LI() cntA=[0]*(N+1) ...
s850965159
p02557
u285681431
1600027634
Python
PyPy3 (7.3.0)
py
Runtime Error
201
116692
522
from copy import deepcopy 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())) C = deepcopy(B) C.reverse() C = deque(C) ans = deque([]) for i in range(N): p = C.popleft() if A[i] != p: ans.append(...
s646352064
p02557
u784120390
1600027634
Python
PyPy3 (7.3.0)
py
Runtime Error
534
196276
2897
# 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 ...
s604870864
p02557
u867320886
1600027629
Python
Python (3.8.2)
py
Runtime Error
933
81196
1020
import sys from collections import Counter import heapq n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) a_count = Counter(a) b_count = Counter(b) for i in a_count.keys(): if a_count[i] + b_count[i] > n: print("No") sys.exit() b_can = [] for k,v in b_count.i...
s211187165
p02557
u843175622
1600027626
Python
Python (3.8.2)
py
Runtime Error
202
40284
309
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) offset = 0 while a[0] == b[offset]: offset += 1 c = [] for i in range(offset, offset + n): c.append(b[i % n]) for i in range(n): if a[i] == c[i]: print('No') exit() print('Yes') print(*c)
s801043563
p02557
u852790844
1600027616
Python
Python (3.8.2)
py
Runtime Error
561
52688
843
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+1) ab = np.bincount(b, minlength=n+1) if np.max(ac+ab) <= n: print("Yes") num, count = np.unique(b, return_counts=True) ans = [] for...
s913464737
p02557
u219197917
1600027581
Python
Python (3.8.2)
py
Runtime Error
175
56060
329
from collections import Counter def main(): n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ca = Counter(a) cb = Counter(b) for k in cb.keys(): if cb[k] > n - ca[k]: raise Exception print("No") if __name__ == '__main__': ...
s230053519
p02557
u285681431
1600027505
Python
PyPy3 (7.3.0)
py
Runtime Error
211
113940
486
from copy import deepcopy 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())) C = deepcopy(B) C.reverse() C = deque(C) ans = deque([]) for i in range(N): p = C.popleft() if A[i] != p: ans.append(...
s916094626
p02557
u219197917
1600027478
Python
Python (3.8.2)
py
Runtime Error
196
56212
348
from collections import Counter def main(): n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ca = Counter(a) cb = Counter(b) for k in cb.keys(): if cb[k] > n - ca[k]: print("No") return raise Exception if __name_...
s782736021
p02557
u807772568
1600027442
Python
PyPy3 (7.3.0)
py
Runtime Error
233
176080
2211
import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] if l...
s834409300
p02557
u813297429
1600027427
Python
Python (3.8.2)
py
Runtime Error
28
9112
269
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) if n%2==0: mid = n//2-1 else: mid = n//2 if b[mid+1:] + b[:mid+1] != a: print('Yes') print(" ".join(map(str,b[mid+1:] + b[:mid+1]))) break else: print('no')
s947439232
p02557
u034128150
1600027419
Python
PyPy3 (7.3.0)
py
Runtime Error
381
185500
1027
from collections import Counter N = int(input()) As = list(map(int, input().split())) Bs = list(map(int, input().split())) As_counter = Counter(As) Bs_counter = Counter(Bs) A_indices = dict() for i, A in enumerate(As): if A in A_indices: A_indices[A].append(i) else: A_indices[A] = [i] B_indic...
s686050795
p02557
u556610039
1600027387
Python
Python (3.8.2)
py
Runtime Error
241
49824
722
num = int(input()) a_i = list(map(int, input().split())) b_i = list(map(int, input().split())) ans = [0] * num r = num - 1 l = 0 isSuccess = True for id in range(num): if a_i[id] != b_i[l]: ans[id] += b_i[l] l += 1 elif a_i[id] != b_i[r]: ans[id] += b_i[r] r -= 1 else: ...
s026416496
p02557
u813297429
1600027376
Python
Python (3.8.2)
py
Runtime Error
32
9116
250
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) if n%2==0: mid = n//2-1 else: mid = n//2 if b[mid+1:] + b[:mid+1] != a: print('Yes') print(b[mid+1:] + b[:mid+1]) break else: print('no')
s056647617
p02557
u052499405
1600027339
Python
PyPy3 (7.3.0)
py
Runtime Error
164
116672
908
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(input()) a = [int(item) for item in input().split()] b = [int(item) for item in input().split()] if n == 1: if a[0] == b[0]: print("No") else: print(*b) left = 0 lv = b[0] for i in range(n): if b[i] != lv: ...
s470175786
p02557
u677523557
1600027273
Python
PyPy3 (7.3.0)
py
Runtime Error
175
116828
467
import sys input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) start = 0 ind = 0 for a in A: while start < N and B[(start+ind)%N] == a: start += 1 if start >= N: break ind += 1 if start >= N: print("No") else: print("Yes") ...
s499980126
p02557
u190735555
1600027221
Python
Python (3.8.2)
py
Runtime Error
2207
41304
796
n=int(input()) a=list(map(int, input().split())) b=list(map(int, input().split())) l=[0]*(n+1) la=[0]*(n+1) lb=[0]*(n+1) for i in range(n): x=a[i] y=b[i] l[x]+=1 la[x]+=1 l[y]+=1 lb[y]+=1 if max(l)>n: print('No') else: print('Yes') for j in range(n): if l[j]==max(l): ...
s296805393
p02557
u046158516
1600027216
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
123812
813
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]*(n+1) countb=[0]*(n+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: print('...
s456534739
p02557
u599114793
1600027209
Python
PyPy3 (7.3.0)
py
Runtime Error
134
91124
317
# import sys # input = sys.stdin.readline def mp(): return map(int, input().split()) def lmp(): return list(map(int, input().split())) n = int(input()) point = [] p = [] m = [] for i in range(n): a,b = mp() point.append((a,b)) p.append(a+b) m.append(a-b) print(max(max(p)-min(p), max(m)-min(m)))
s786942446
p02557
u143509139
1600027190
Python
PyPy3 (7.3.0)
py
Runtime Error
173
115556
714
def construct_table(n, s): table = [-1] * (n + 1) j = -1 for i in range(n): while j >= 0 and s[i] != s[j]: j = table[j] j += 1 table[i + 1] = j return table n = int(input()) m = n a = list(map(int, input().split())) t = list(map(int, input().split())) s2 = a + a tb ...
s246962717
p02557
u667084803
1600027157
Python
PyPy3 (7.3.0)
py
Runtime Error
334
173032
607
from collections import Counter, deque N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_cn = Counter(A) B_cn = Counter(B) AB_cn = Counter(A+B) if AB_cn.most_common()[0][1] > N: print("No") else: print("Yes") b = deque(B) ans_dict = {} cntr = 0 while b: ...
s466011187
p02557
u187516587
1600027057
Python
Python (3.8.2)
py
Runtime Error
382
41888
684
import heapq N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) la=[0]*N lb=[0]*N for i in range(N): la[A[i]-1]+=1 lb[B[i]-1]+=1 B[i]=-B[i] for i in range(N): if la[i]+lb[i]>N: print("No") exit() print("Yes") l=[] heapq.heapify(B) c=0 t=0 for i in range(N): ...
s262213267
p02557
u022979415
1600027054
Python
Python (3.8.2)
py
Runtime Error
233
49324
767
def main(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split()))[::-1] ind = [-1] * (n + 1) for i in range(n): if i == 0: ind[b[i]] = 0 elif b[i] != b[i - 1]: ind[b[i]] = i for i in range(n): if a[i] != b[i]: ...
s264632973
p02557
u667084803
1600027023
Python
PyPy3 (7.3.0)
py
Runtime Error
339
196288
615
from collections import Counter, deque N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_cn = Counter(A) B_cn = Counter(B) AB_cn = Counter(A+B) if AB_cn.most_common()[0][1] > N: print("No") else: print("Yes") b = deque(B) ans_dict = {} cntr = 0 while b: ...
s806313177
p02557
u017050982
1600027019
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
141836
565
N = int(input()) A = list(map(int,input().split(" "))) B = list(map(int,input().split(" "))) B.reverse() d = dict() for i in range(1,len(B)): if B[i] != B[i - 1]: d[B[i-1]] = i swap = 0 print(d) for i in range(N): if A[i] == B[i]: for q in range(d[B[i]], len(B)): if B[q] != B[i]: ...
s208006972
p02557
u512007680
1600027013
Python
PyPy3 (7.3.0)
py
Runtime Error
346
144900
596
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) X = [0]*N Y = [0]*N for i in range(N): X[A[i]-1] += 1 Y[B[i]-1] += 1 det = 0 for i in range(N): if X[i]+Y[i] > N: det = -1 break if det == -1: print('No') else: ans = [0]*N P = sorted(list(...
s206238307
p02557
u785989355
1600026961
Python
PyPy3 (7.3.0)
py
Runtime Error
474
222244
1089
from collections import Counter,defaultdict N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) A = Counter(A) B = Counter(B) A = [(c,A[c]) for c in A] B = [(c,B[c]) for c in B] A.sort(key = lambda x:x[1],reverse=True) B.sort(key = lambda x:x[1],reverse=True) i = 0 j = 0 C = de...
s126344253
p02557
u512007680
1600026854
Python
PyPy3 (7.3.0)
py
Runtime Error
323
150824
613
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) X = [0]*N Y = [0]*N for i in range(N): X[A[i]-1] += 1 Y[B[i]-1] += 1 det = 0 for i in range(N): if X[i]+Y[i] > N: det = -1 break if det == -1: print('No') else: ans = [0]*N P = sorted(list(...
s450968407
p02557
u521839937
1600026845
Python
Python (3.8.2)
py
Runtime Error
261
42844
585
n = int(input()) a = [int(x) for x in input().split(' ')] b = [int(x) for x in input().split(' ')] dict = {} for index, a_i in enumerate(a): if a_i == b[index]: dict.setdefault(a_i, 0) dict[a_i] += 1 max_same_number_key = max(dict, key=dict.get) if dict[max_same_number_key] > (n/2): print('No') exit()...
s548267612
p02557
u425184437
1600026666
Python
PyPy3 (7.3.0)
py
Runtime Error
2210
163772
573
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) from collections import Counter a=Counter(A) b=Counter(B) aa=a.most_common() bb=b.most_common() bbb=[[0,0] for i in range(len(bb))] for i in range(len(bb)): bbb[i][0]=bb[i][0] bbb[i][1]=bb[i][1] if aa[0][0]==bb[0][0] and aa[0][1]+bb[0...
s043744425
p02557
u667084803
1600026609
Python
Python (3.8.2)
py
Runtime Error
228
72684
267
from collections import Counter, deque N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_cn = Counter(A) B_cn = Counter(B) AB_cn = Counter(A+B) if AB_cn.most_common()[0][1] > N: print("No") else: print("Yes") 0/0