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
s177117405
p03578
u227476288
1559415948
Python
Python (3.4.3)
py
Runtime Error
82
27132
368
N = int(input()) D = [int(i) for i in input().split()] Dlist = [0]*max(D) for d in D: Dlist[d-1] += 1 M = int(input()) T = [int(i) for i in input().split()] Tlist = [0]*max(T) for t in T: Tlist[t-1] += 1 flag = True for i in range(len(Tlist)): if Tlist[i] > Dlist[i]: flag = False break ...
s238562015
p03578
u227476288
1559415756
Python
Python (3.4.3)
py
Runtime Error
78
27100
372
N = int(input()) D = [int(i) for i in input().split()] Dlist = [0]*(max(D)) for d in D: Dlist[d-1] += 1 M = int(input()) T = [int(i) for i in input().split()] Tlist = [0]*(max(T)) for t in T: Tlist[t-1] += 1 flag = True for i in range(len(Tlist)): if Tlist[i] > Dlist[i]: flag = False brea...
s520957554
p03578
u227476288
1559415696
Python
PyPy3 (2.4.0)
py
Runtime Error
290
86484
372
N = int(input()) D = [int(i) for i in input().split()] Dlist = [0]*(max(D)) for d in D: Dlist[d-1] += 1 M = int(input()) T = [int(i) for i in input().split()] Tlist = [0]*(max(T)) for t in T: Tlist[t-1] += 1 flag = True for i in range(len(Tlist)): if Tlist[i] > Dlist[i]: flag = False brea...
s770393309
p03578
u223904637
1558828924
Python
PyPy3 (2.4.0)
py
Runtime Error
414
127572
346
n=int(input()) d=list(map(int,input().split())) m=int(input()) t=list(map(int,input().split())) d.sort() t.sort() di=0 f=0 for ti in range(m): if di<n: while d[di]!=t[ti]: di+=1 if d[di]>t[ti]: f=1 break if f==1: break if f==1: print('N...
s225535155
p03578
u223904637
1558828742
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38256
331
n=int(input()) d=list(map(int,input().split())) m=int(input()) t=list(map(int,input().split())) d.sort() t.sort() di=0 f=0 for ti in range(m): if di<n: while d[di]!=t[ti]: di+=1 if d[di]>t[ti]: f=1 break if f==1: break if f==1: print('NO') else: p...
s199920798
p03578
u798129018
1557549368
Python
Python (3.4.3)
py
Runtime Error
272
35408
259
n = int(input()) d =list(map(int,input().split())) d.sort() m = int(input()) t = list(map(int,input().split())) t.sort() for x in t: while d[i] < x: i += 1 if d[i] == x: i += 1 else: print("NO") exit() print("YES")
s454080631
p03578
u798129018
1557548822
Python
PyPy3 (2.4.0)
py
Runtime Error
491
126280
544
from itertools import accumulate from math import* from collections import deque from collections import defaultdict from itertools import permutations from heapq import* from collections import Counter from itertools import* from bisect import bisect_left,bisect_right from copy import deepcopy inf = 10**18 mod = 10**9...
s425967294
p03578
u798129018
1557548775
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38384
152
input() d = Counter(map(int,input().split())) input() t = Counter(map(int,input().split())) d.subtract(t) if -d: print("NO") else: print("YES")
s448260133
p03578
u565204025
1557545026
Python
Python (3.4.3)
py
Runtime Error
721
59460
756
# -*- coding: utf-8 -*- n = int(input()) d = list(map(int,input().split())) m = int(input()) t = list(map(int,input().split())) d.sort() t.sort() def array_count(arr): arr_target = [[]] cnt = 1 for i in range(1,len(arr)): if arr[i] == arr[i-1]: cnt += 1 else: arr_t...
s475737993
p03578
u565204025
1557544832
Python
PyPy3 (2.4.0)
py
Runtime Error
443
127568
755
# -*- coding: utf-8 -*- n = int(input()) d = list(map(int,input().split())) m = int(input()) t = list(map(int,input().split())) d.sort() t.sort() def array_count(arr): arr_target = [[]] cnt = 1 for i in range(1,len(arr)): if arr[i] == arr[i-1]: cnt += 1 else: arr_t...
s751706489
p03578
u798129018
1557543846
Python
PyPy3 (2.4.0)
py
Runtime Error
2108
122704
222
n = int(input()) d = list(map(int,input().split())) d.sort() m = int(input()) t = list(map(int,input().split())) t.sort() for x in d: if x == t[0]: t.pop(0) if len(t)==0: print("YES") else: print("NO")
s856980565
p03578
u163320134
1556034301
Python
Python (3.4.3)
py
Runtime Error
17
3064
258
n-int(input()) arr1=list(map(int,input().split())) arr1=sorted(arr1) m=int(input()) arr2=list(map(int,input().split())) arr2=sorted(arr2) pos=0 for i in range(n): if arr1[i]==arr2[pos]: pos+=1 if pos==m: print('YES') break else: print('NO')
s417445282
p03578
u859897687
1554896538
Python
Python (3.4.3)
py
Runtime Error
276
67424
287
n=int(input()) d=dict() for a in map(int,input().split()): if a not in d: d[a]=1 else: d[a]+=1 m=int(input()) t=dict() for a in map(int,input().split()): if a not in t: t[a]=1 else: t[a]+=1 ans="YES" for i in t.keys(): if not t[i]==d[i]: ans="NO" print(ans)
s359159013
p03578
u227082700
1553980795
Python
Python (3.4.3)
py
Runtime Error
2105
35284
359
n,d,m,t,ans=int(input()),list(map(int,input().split())),int(input()),list(map(int,input().split())),"YES" dn,tn,dc,tc=[],[],[],[] for i in d: if i in dn:dc[dn.index(i)]+=1 else:dn.append(i);dc.append(1) for i in t: if i in tn:tc[tn.index(i)]+=1 else:tn.append(i);tc.append(1) for i in range(len(tn)): if tc[i]>...
s051801427
p03578
u359856428
1548144412
Python
Python (3.4.3)
py
Runtime Error
118
35420
343
n = int(input()) d = list(map(int,input().split(' '))) m = int(input()) t = list(map(int,input().split(' '))) md = [0] * 1000000001 mt = [0] * 1000000001 for i in d: md[i] += 1 for i in t: mt[i] += 1 flag = True for i in range(1,1000000001): if mt[i] > md[i]: flag = False break print("...
s630783033
p03578
u359856428
1548143843
Python
Python (3.4.3)
py
Runtime Error
2105
35420
256
n = int(input()) d = list(map(int,input().split(' '))) m = int(input()) t = list(map(int,input().split(' '))) if n >= m: for i in d: t.remove(i) if len(t) == 0: break if len(t) == 0: print("YES") else: print("NO")
s830850533
p03578
u099918199
1538185441
Python
Python (3.4.3)
py
Runtime Error
116
35580
1411
def binarySearch(list_a, key): left = 0 right = len(list_a) while left < right: mid = (left + right) // 2 if list_a[mid] == key: return mid break elif key < list_a[mid]: right = mid else: left = mid+1 else: return "N...
s080491654
p03578
u099918199
1538184820
Python
Python (3.4.3)
py
Runtime Error
116
34476
1400
import math def binarySearch(list_a, key): left = 0 right = len(list_a) while left < right: mid = (left + right) // 2 if list_a[mid] == key: return mid break elif key < list_a[mid]: right = mid else: left = mid+1 else: ...
s743846548
p03578
u099918199
1538184432
Python
Python (3.4.3)
py
Runtime Error
115
35548
1387
def binarySearch(list_a, key): left = 0 right = len(list_a) while left < right: mid = (left + right) // 2 if list_a[mid] == key: return mid break elif key < list_a[mid]: right = mid else: left = mid+1 else: return "N...
s622323568
p03578
u099918199
1538184267
Python
Python (3.4.3)
py
Runtime Error
118
34024
1387
def binarySearch(list_a, key): left = 0 right = len(list_a) while left < right: mid = (left + right) // 2 if list_a[mid] == key: return mid break elif key < list_a[mid]: right = mid else: left = mid+1 else: return "N...
s529383180
p03578
u761989513
1536963877
Python
Python (3.4.3)
py
Runtime Error
137
35804
221
n = int(input()) d = list(map(int, input().split())) m = int(input()) t = list(map(int, input().split())) t_ = set(t) for i in range(len(t_)): if t.count(t_[i]) > d.count(t_[i]): print("NO") exit() print("YES")
s479916971
p03578
u761989513
1536963719
Python
Python (3.4.3)
py
Runtime Error
17
2940
220
n = int(input()) d = list(map(int, input().split())) m = int(input()) t = list(map(int, input().split())) t_ = set(t) for i in range(len(t_): if t.count(t_[i]) > d.count(t_[i]): print("NO") exit() print("YES")
s684250368
p03578
u422104747
1529155559
Python
Python (3.4.3)
py
Runtime Error
17
3064
360
input() s=input.split() a=[] for i in s: a.append(int(i)) a.sort() input() s=input.split() b=[] for i in s: b.append(int(i)) b.sort() while len(a)>0: if a[0]==b[0]: del(a[0]) del(b[0]) if len(b)==0: break elif a[0]<b[0]: del(a[0]) else: a=[] if len(b)==0...
s507707930
p03578
u952708174
1527043605
Python
Python (3.4.3)
py
Runtime Error
214
56920
287
import collections N = int(input()) D = [int(i) for i in input().split()] M = int(input()) T = [int(i) for i in input().split()] count_D = collections.Counter(D) count_T = collections.Counter(T) ans = 'YES' for k,v in count_T.items(): if D[k] < v: ans = 'NO' break print(ans)
s670819542
p03578
u417658545
1507962017
Python
Python (3.4.3)
py
Runtime Error
17
3064
294
N = input() D = map(int, raw_input().split()) M = input() T = map(int, raw_input().split()) var = [] result = True for i in range(N): var[D[i]] += 1 for j in range(M): if(var[T[j]] == 0): result = False break else: var[T[j]] -= 1 if(result): print("YES") else: print("NO")
s940337770
p03578
u966601619
1507525784
Python
Python (3.4.3)
py
Runtime Error
137
35324
176
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*MAX print('YES')
s263776067
p03578
u966601619
1507524204
Python
Python (3.4.3)
py
Runtime Error
137
33896
183
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*1000000000 print('YES')
s224946818
p03578
u966601619
1507523975
Python
Python (3.4.3)
py
Runtime Error
137
35420
177
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*MAX print('YES')
s295137765
p03578
u966601619
1507523915
Python
Python (3.4.3)
py
Runtime Error
140
35420
182
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*int(MAX) print('YES')
s217448278
p03578
u966601619
1507523874
Python
Python (3.4.3)
py
Runtime Error
140
34024
185
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*(int(MAX)+1) print('YES')
s322382328
p03578
u966601619
1507523685
Python
Python (3.4.3)
py
Runtime Error
152
35548
180
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*(MAX+1) print('YES')
s947377647
p03578
u966601619
1507523482
Python
Python (3.4.3)
py
Runtime Error
147
35420
304
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else: MAX=max(y) z=[0]*(MAX+1) for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') exit() print('YES')
s934128169
p03578
u966601619
1507523364
Python
Python (2.7.6)
py
Runtime Error
25
8576
298
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*(MAX+1) for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') exit() print('YES')
s138158338
p03578
u966601619
1507523280
Python
Python (3.4.3)
py
Runtime Error
143
35556
298
q=input() x=[int(i) for i in input().split()] cnt=input() y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*(MAX+1) for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') exit() print('YES')
s780053661
p03578
u966601619
1507523113
Python
Python (3.4.3)
py
Runtime Error
147
35420
302
q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*(MAX+1) for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') exit() print('YES')
s574892417
p03578
u966601619
1507522900
Python
Python (3.4.3)
py
Runtime Error
144
35420
304
q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX for k in x : z[k-1] += 1 for i in y : z[i-1] -= 1 if z[i-1] == -1 : print('NO') exit() print('YES')
s997548462
p03578
u966601619
1507522624
Python
Python (3.4.3)
py
Runtime Error
136
35420
172
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX
s528509671
p03578
u966601619
1507522465
Python
Python (3.4.3)
py
Runtime Error
136
35420
319
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX for k in x : z[k-1] += 1 for i in y : z[i-1] -= 1 if z[i-1] == -1 : print('NO') sys.exit() print('YES')
s979542922
p03578
u966601619
1507522279
Python
Python (3.4.3)
py
Runtime Error
154
35556
334
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX for k in x : z[k-1] += 1 j=0 for i in y : z[i-1] -= 1 if z[i-1] == -1 : print('NO') j=1 break if j==0: ...
s620642307
p03578
u966601619
1507522089
Python
Python (3.4.3)
py
Runtime Error
140
35556
310
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX for k in x : z[k-1] += 1 for i in y : z[i-1] -= 1 if z[i-1] == -1 : print('NO') sys.exit() print('YES')
s966438586
p03578
u966601619
1507521863
Python
Python (3.4.3)
py
Runtime Error
146
35420
304
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] if max(x) >= max(y): MAX=max(x) else : MAX=max(y) z=[0]*MAX for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') sys.exit() print('YES')
s332362138
p03578
u966601619
1507521407
Python
Python (3.4.3)
py
Runtime Error
129
35420
256
import sys q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] z=[0]*max(x) for k in x : z[k] += 1 for i in y : z[i] -= 1 if z[i] == -1 : print('NO') sys.exit() print('YES')
s687275870
p03578
u966601619
1507520146
Python
Python (3.4.3)
py
Runtime Error
274
35156
335
q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] x=x.sort() y=y.sort() for k in range(len(y)) : for i in range(len(x)) : if x[i] == y[k] : del x[i] break if i+1 == len(x) : print('NO') j=1 if j == 0 : ...
s648635700
p03578
u966601619
1507520057
Python
Python (3.4.3)
py
Runtime Error
282
35420
337
q=input() x=[int(i) for i in input().split()] cnt=input() j=0 y=[int(i) for i in input().split()] x=x.sort() y=y.sort() for k in range(len(y)) : for i in range(len(x)) : if x[i] == y[k] : del x[i] break if i+1 == len(x) : print('NO') j=1 if j==0 : ...
s663248163
p03578
u422104747
1507517802
Python
Python (3.4.3)
py
Runtime Error
307
33784
220
import bisect s=input() s=input().split() t=input() t=input().split() s.sort() t.sort() f=False for c in t: i=bisect.bisect_left(s,c) if s[i]!=c: print("NO") f=True break else: s.pop[i] if not f: print("YES")
s656217571
p03578
u858136677
1507517059
Python
Python (3.4.3)
py
Runtime Error
2105
35420
291
n = int(input()) d = list(map(int,input().split())) m = int(input()) t = list(map(int,input().split())) for i in range(n): for k in range(len(d)): if len(t) == 0: answer = 1 break elif t[0] == d[k]: del d[k] del t[0] break if answer == 1: print('YES') else: print('NO')
s049650704
p03578
u943004959
1507516947
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38768
1195
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import math import bisect import itertools import numpy as np from collections import OrderedDict from bisect import bisect_left, bisect_right, insort_left, insort_right class EndLoop(Exception): pass def solve(): while 1: try: ...
s620434227
p03578
u175519234
1507516900
Python
Python (3.4.3)
py
Runtime Error
311
42556
299
import numpy as np n = input() d = [int(i) for i in input().split()] n = input() t = [int(i) for i in input().split()] def p2(d,t): arr = np.zeros(10**9) for i in d: arr[i] += 1 for i in t: arr[i] -= 1 if arr[i] < 0: return("NO") return("YES") print(p2(d,t))
s744296243
p03578
u141828885
1507514820
Python
Python (3.4.3)
py
Runtime Error
344
69216
346
from collections import defaultdict input() d_list = input().split(" ") input() t_list = input().split(" ") d_dict = defaultdict(lambda: 0) for d in d_list: d_dict[d] += 1 t_dict = defaultdict(lambda: 0) for t in t_list: t_dict[t] += 1 for k, v in t_dict.items(): if v > d_dict[k]: print("NO") ...
s674146388
p03578
u559996513
1507513439
Python
Python (3.4.3)
py
Runtime Error
121
35156
264
N = int(input()) D = list(map(int, input().split())) M = int(input()) T = list(map(int, input().split())) dictD = [0]*1000000001 for d in D: dictD[d-1] += 1 for t in T: dictD[t-1] -= 1 dictD.sort() if dictD[0] < 0: print("NO") else: print("YES")
s732397318
p03578
u062864034
1507513316
Python
Python (3.4.3)
py
Runtime Error
573
38992
242
N = input() D = [i for i in input()] M = input() T = [i if i in D else "<muri>" for i in input()] if "<muri>" in T: print("NO") quit() for t in T: if d in D: D.remove(t) else: print("NO") else: print("NO")
s963422589
p03578
u559996513
1507513254
Python
Python (3.4.3)
py
Runtime Error
113
35420
264
N = int(input()) D = list(map(int, input().split())) M = int(input()) T = list(map(int, input().split())) dictD = [0]*1000000000 for d in D: dictD[d-1] += 1 for t in T: dictD[t-1] -= 1 dictD.sort() if dictD[0] < 0: print("NO") else: print("YES")
s138875937
p03578
u233747425
1507513236
Python
Python (3.4.3)
py
Runtime Error
407
56672
692
N = int(input()) D = list(map(int, input().split())) M = int(input()) T = list(map(int, input().split())) D_dic = {k: 0 for k in D} T_dic = {k: 0 for k in T} for i in range(N): if D_dic[D[i]]: a = D_dic[D[i]] + 1 D_dic[D[i]] = a else: D_dic[D[i]] = 1 for j in range(M): if T_di...
s622557016
p03578
u062864034
1507513227
Python
Python (3.4.3)
py
Runtime Error
577
38476
242
N = input() D = [i for i in input()] M = input() T = [i if i in D else "<muri>" for i in input()] if "<muri>" in T: print("NO") quit() for t in T: if d in D: D.remove(t) else: print("NO") else: print("NO")
s737492861
p03578
u559996513
1507512910
Python
Python (3.4.3)
py
Runtime Error
113
35556
260
N = int(input()) D = list(map(int, input().split())) M = int(input()) T = list(map(int, input().split())) dictD = [0]*200001 for d in D: dictD[d-1] += 1 for t in T: dictD[t-1] -= 1 dictD.sort() if dictD[0] < 0: print("NO") else: print("YES")
s361470671
p03578
u559996513
1507512581
Python
Python (3.4.3)
py
Runtime Error
124
35556
256
N = int(input()) D = list(map(int, input().split())) M = int(input()) T = list(map(int, input().split())) dictD = [0]*200000 for d in D: dictD[d-1] += 1 for t in T: dictD[t-1] -= 1 dictD.sort() if dictD[0] < 0: print("NO") else: print("YES")
s486522702
p03578
u062864034
1507512511
Python
Python (3.4.3)
py
Runtime Error
156
39632
187
N = input() D = [i for i in input()] M = input() T = [i for i in input()] for d in D: if t in T: T.remove(t) if len(T)==0: print("YES") quit() print("NO")
s849545903
p03578
u840684628
1507512395
Python
Python (3.4.3)
py
Runtime Error
143
35420
331
n = int(input()) D = ([int(_) for _ in input().split()]) m = int(input()) T = ([int(_) for _ in input().split()]) d_cnt = [0 for _ in range(200000)] t_cnt = [0 for _ in range(200000)] for d in D: d_cnt[d] += 1 for t in T: t_cnt[t] += 1 for i in range(len(t_cnt)): if t_cnt[i] > d_cnt[i]: print("NO") exit(0) p...
s096747193
p03578
u172773620
1507512131
Python
Python (3.4.3)
py
Runtime Error
183
36572
381
n = input() d = [int(i) for i in input().split(" ")] m = input() t = [int(i) for i in input().split(" ")] d_set = set(d) d_set = list(d_set) t_set = set(t) t_set = list(t_set) flag =0 if len(t_set != d_set): flag = 1 else: for s in t_set: if d.count(s) < t.count(s): flag = 1 ...
s272108315
p03578
u172773620
1507512094
Python
Python (3.4.3)
py
Runtime Error
186
37460
381
n = input() d = [int(i) for i in input().split(" ")] m = input() t = [int(i) for i in input().split(" ")] d_set = set(d) d_set = list(d_set) t_set = set(t) t_set = list(t_set) flag =0 if len(t_set != d_set): flag = 1 else: for s in t_set: if d.count(s) < t.count(s): flag = 1 ...
s695012474
p03578
u172773620
1507512070
Python
Python (3.4.3)
py
Runtime Error
17
3060
370
n = input() d = [int(i) for i in input().split(" ")] m = input() t = [int(i) for i in input().split(" ")] d_set = set(d) d_set = list(d_set) t_set = set(t) t_set = list(t_set) flag =0 if len(t_set != d_set): flag = 1 else: for s in t_set: if(d.count(s) < t.count(s)): flag = 1 break if...
s364264357
p03578
u855200003
1507512050
Python
Python (3.4.3)
py
Runtime Error
2105
35420
317
import sys N = int(input()) D = [int(i) for i in input().split(" ")] M = int(input()) T = [int(i) for i in input().split(" ")] if len(T) > len(D): print("NO") sys.exit() else: for i in T: if i in T: D.remove(i) else: print("NO") sys.exit() print("YES")
s561991527
p03578
u062864034
1507511855
Python
Python (3.4.3)
py
Runtime Error
21
8820
185
N = input() D = [int(i) for i in input()] M = input() T = [int(i) for i in input()] for t in T: try: D.remove(t) except: print("NO") quit() print("YES")
s990139039
p03578
u667084803
1507511395
Python
Python (3.4.3)
py
Runtime Error
318
35324
291
import sys N=int(input()) D=list(map(int,input().split())) M=int(input()) T=list(map(int,input().split())) D.sort() T.sort() for i in range(M-1,-1,-1): while True: q=D.pop() if T[i]==q: #print(i) break elif T[i]>q: #print(i,"NO") sys.exit() print("YES")
s395291471
p03578
u497285470
1507511305
Python
Python (3.4.3)
py
Runtime Error
328
44684
388
inputs = input() N = int(inputs) inputs = input().split() prob = {} for i in inputs: if not int(i) in prob.keys(): prob[int(i)] = 1 else: prob[int(i)] += 1 inputs = input() M = int(inputs) inputs = input().split() flag = True for i in inputs: prob[int(i)] -= 1 if prob[int(i)] < 0: ...
s013631034
p03578
u497285470
1507511279
Python
Python (3.4.3)
py
Runtime Error
373
44684
388
inputs = input() N = int(inputs) inputs = input().split() prob = {} for i in inputs: if not int(i) in prob.keys(): prob[int(i)] = 1 else: prob[int(i)] += 1 inputs = input() M = int(inputs) inputs = input().split() flag = True for i in inputs: prob[int(i)] -= 1 if prob[int(i)] < 0: ...
s904988796
p03578
u943004959
1507511202
Python
Python (3.4.3)
py
Runtime Error
22
8820
297
def solve(): while 1: N = int(input()) D = list(map(int, input(" "))) M = int(input()) T = list(map(int, input(" "))) for t in T: if t not in D: print("NO") break print("YES") break solve()
s583369837
p03578
u943004959
1507511134
Python
Python (3.4.3)
py
Runtime Error
21
8692
376
def solve(): while 1: N = int(input()) D = list(map(int, input(" "))) M = int(input()) if N < M: print("NO") break T = list(map(int, input(" "))) for t in T: if t not in D: print("NO") bre...
s810859983
p03578
u054957956
1507511111
Python
Python (3.4.3)
py
Runtime Error
17
3064
302
n = int(input()) a = sorted(list(map(int, input().split()))) m = int(input()) b = sorted(list(map(int, input().split()))) i = 0 for x in b: while i < n and a[i] < x: i += 1 if i < n and a[i] == x: i += 1 else: print('NO') exit(0) print('YES') satja@satja:~/k
s508893475
p03579
u137226361
1600361999
Python
Python (3.8.2)
py
Runtime Error
461
32844
819
from collections import deque n, m = map(int, input().split()) connect = [[] for _ in range(n)] for _ in range(m): a, b = map(lambda x: int(x)-1, input().split()) connect[a].append(b) connect[b].append(a) color = [-1]*n color[0] = 0 explored = {0} next = deque(connect[0]) exploring =deque() Yes = True expl...
s672475615
p03579
u137226361
1600361886
Python
Python (3.8.2)
py
Runtime Error
413
33028
811
from collections import deque n, m = map(int, input().split()) connect = [[] for _ in range(n)] for _ in range(m): a, b = map(lambda x: int(x)-1, input().split()) connect[a].append(b) connect[b].append(a) color = [-1]*n color[0] = 0 explored = {0} next = deque(connect[0]) exploring =deque() Yes = True expl...
s949687000
p03579
u383713431
1599100448
Python
Python (3.8.2)
py
Runtime Error
353
28380
639
from collections import deque, defaultdict N, M = map(int, input().split()) graph = [[] for _ in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1; b -= 1; graph[a].append(b) graph[b].append(a) visited = [False for _ in range(N)] color = [0 for _ in range(N)] def dfs(now, c): ...
s515481196
p03579
u923172145
1598411558
Python
PyPy3 (7.3.0)
py
Runtime Error
339
111412
521
N, M = map(int, input().split()) I = [[] for _ in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 I[a].append(b) I[b].append(a) C = [-1 for _ in range(N)] visited = set() def DFS(p, c): C[p] = c flag = True for q in I[p]: #print(p,q) if C[q] == c: return Fal...
s031129909
p03579
u653837719
1596738939
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74840
641
from sys import setrecursionlimit setrecursionlimit(10**10) def dfs(v): flag = True for nxt in edge[v]: if l[v] == l[nxt]: return False elif l[v] + l[nxt] == 1: continue else: l[nxt] = 1 - l[v] cnt[1-l[v]] += 1 flag &= dfs(nx...
s280143840
p03579
u227082700
1596083305
Python
Python (3.8.2)
py
Runtime Error
361
27344
324
n,m=map(int,input().split()) edge=[[]for _ in range(n)] for _ in range(m): a,b=map(int,input().split()) a-=1 b-=1 edge[a].append(b) edge[b].append(a) x=[0]*n x[0]=1 def dfs(r,node): for mode in edge[node]: if r==mode:continue x[mode]=1^x[node] dfs(node,mode) dfs(-1,0) print(x.count(0)*x.count(1)...
s921013878
p03579
u227082700
1596083272
Python
Python (3.8.2)
py
Runtime Error
407
27328
323
n,m=map(int,input().split()) edge=[[]for _ in range(n)] for _ in range(n): a,b=map(int,input().split()) a-=1 b-=1 edge[a].append(b) edge[b].append(a) x=[0]*n x[0]=1 def dfs(r,node): for mode in edge[node]: if r==mode:continue x[mode]=1^x[node] dfs(node,mode) dfs(-1,0) print(x.count(0)*x.count(1)...
s782670170
p03579
u139112865
1594349129
Python
Python (3.8.2)
py
Runtime Error
363
27532
545
from collections import deque n, m = map(int, input().split()) edges = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) edges[a-1].append(b-1) edges[b-1].append(a-1) colors = [0] * n def dfs(v, color): colors[v] = color for to in edges[v]: if colors[to] == color: ...
s018604496
p03579
u935558307
1593210525
Python
Python (3.8.2)
py
Runtime Error
25
9128
1447
""" 奇数本の辺で成り立つ閉路があれば、全ての頂点同士を1本の辺で結ぶことができる。 そうでない場合は、奇数本の辺をたどってたどり着ける頂点同士は全て1本の辺で結ぶことができる。 奇数本の閉路があるかどうかを、どうやって判定するか? 二部グラフ判定を行う。 二部グラフ判定ってどうやるんだっけ?→となりのノードに違う色をつけていって、矛盾がなければ二部グラフ。矛盾があれば二部グラフじゃない。 """ import sys sys.setrecursionlimit(200000) n = len(edges) colors = [-1]*(n+1) def judgeBiGragh(edges): def paint(v,c...
s955859608
p03579
u935558307
1593210213
Python
PyPy3 (7.3.0)
py
Runtime Error
476
121856
1366
""" 奇数本の辺で成り立つ閉路があれば、全ての頂点同士を1本の辺で結ぶことができる。 そうでない場合は、奇数本の辺をたどってたどり着ける頂点同士は全て1本の辺で結ぶことができる。 奇数本の閉路があるかどうかを、どうやって判定するか? 二部グラフ判定を行う。 二部グラフ判定ってどうやるんだっけ?→となりのノードに違う色をつけていって、矛盾がなければ二部グラフ。矛盾があれば二部グラフじゃない。 """ def judgeBiGragh(edges): n = len(edges) colors = [-1]*(n+1) def paint(v,c): if colors[v] == -1: ...
s496689435
p03579
u868982936
1591760415
Python
Python (3.4.3)
py
Runtime Error
294
33828
547
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) N,M = map(int, input().split()) AB = [[int(x) for x in input().split()] for _ in range(M)] graph = [[] for _ in range(N+1)] for a, b in AB: graph[a].append(b) graph[b].append(a) color = [None] * (N+1) color[1] = 0 q = [1] while q: x = q.pop() for...
s413192212
p03579
u829895669
1591323104
Python
Python (3.4.3)
py
Runtime Error
538
22956
1055
# coding:utf-8 class Tree(object): def __init__(self, N): self.tree = [[] for _ in range(N)] self.colors = [0 for _ in range(N)] def add_node(self, a, b): self.tree[a].append(b) # 二部グラフか判定する関数 def is_bipartite_graph(self, v, color): self.colors[v] = color for ...
s360444644
p03579
u829895669
1591322958
Python
Python (3.4.3)
py
Runtime Error
534
22944
1076
# coding:utf-8 class Tree(object): def __init__(self, N): self.tree = [[] for _ in range(N)] self.colors = [0 for _ in range(N)] def add_node(self, a, b): self.tree[a].append(b) # 二部グラフか判定する関数 def is_bipartite_graph(self, v, color): self.colors[v] = color for ...
s821614854
p03579
u829895669
1591322863
Python
Python (3.4.3)
py
Runtime Error
540
22940
1071
# coding:utf-8 class Tree(object): def __init__(self, N): self.tree = [[] for _ in range(N)] self.colors = [0 for _ in range(N)] def add_node(self, a, b): self.tree[a].append(b) # 二部グラフか判定する関数 def is_bipartite_graph(self, v, color): self.colors[v] = color for ...
s875246289
p03579
u723711163
1590765193
Python
PyPy3 (2.4.0)
py
Runtime Error
768
118956
451
N,M = map(int,input().split()) adj = [ [] for _ in range(N) ] for _ in range(M): u,v = map(int,input().split()) u -= 1 v -= 1 adj[u].append(v) adj[v].append(u) color = [None] * N def dfs(n, c): color[n] = c for nei in adj[n]: if color[nei] is not None: if color[nei] == c: return False ...
s828638372
p03579
u723711163
1589998815
Python
PyPy3 (2.4.0)
py
Runtime Error
842
77668
612
import sys sys.setrecursionlimit(100000) N,M = map(int,input().split()) adj_list = { i: [] for i in range(1, N+1) } for i in range(M): a,b = map(int, input().split()) adj_list[a].append(b) adj_list[b].append(a) visited = [False]*(N+1) colors = [None] * (N) def dfs(node, c): colors[node-1] = c visited[node...
s898032422
p03579
u723711163
1589998085
Python
PyPy3 (2.4.0)
py
Runtime Error
846
124132
521
N,M = map(int,input().split()) adj_list = { i: [] for i in range(1, N+1) } for i in range(M): a,b = map(int, input().split()) adj_list[a].append(b) adj_list[b].append(a) visited = [False]*(N+1) colors = [None] * (N) def dfs(node, c): colors[node-1] = c visited[node] = True for nei in adj_list[node]: ...
s557384928
p03579
u541610817
1589860661
Python
Python (3.4.3)
py
Runtime Error
589
40652
688
from collections import defaultdict def Z(): return int(input()) def ZZ(): return [int(_) for _ in input().split()] def main(): N, M = ZZ() edge = [ZZ() for _ in range(M)] E = defaultdict(list) for a, b in edge: E[a].append(b) E[b].append(a) color = [0] * (N+1) def is_bi(v, c...
s090507348
p03579
u935558307
1589855215
Python
PyPy3 (2.4.0)
py
Runtime Error
971
102688
563
N,M = map(int,input().split()) edges = [[]for _ in range(N+1)] for _ in range(M): u,v = map(int,input().split()) edges[u].append(v) edges[v].append(u) colors = [-1]*(N+1) def choose(n,k): import math return math.factorial(n)//(math.factorial(n-k)*math.factorial(k)) def dfs(n,c): if colors[n] ==...
s462621982
p03579
u754022296
1589758022
Python
Python (3.4.3)
py
Runtime Error
337
22932
548
import sys input = sys.stdin.buffer.readline n, m = map(int, input().split()) G = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) C = [-1]*n def is_bipartite(v, color): C[v] = color for nv in G[v]: if C[nv] != -1 and color == C[n...
s061440631
p03579
u935558307
1589754268
Python
Python (3.4.3)
py
Runtime Error
2135
581200
851
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(2000000) N,M = map(int,input().split()) edges = [[]for _ in range(N+1)] for _ in range(M): a,b = map(int,input().split()) edges[a].append(b) edges[b].append(a) colors = [-1]*(N+1) def paint(...
s550110804
p03579
u935558307
1589754219
Python
Python (3.4.3)
py
Runtime Error
2107
244144
850
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(200000) N,M = map(int,input().split()) edges = [[]for _ in range(N+1)] for _ in range(M): a,b = map(int,input().split()) edges[a].append(b) edges[b].append(a) colors = [-1]*(N+1) def paint(n...
s452744732
p03579
u935558307
1589754180
Python
Python (3.4.3)
py
Runtime Error
2107
244144
850
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(200000) N,M = map(int,input().split()) edges = [[]for _ in range(N+1)] for _ in range(M): a,b = map(int,input().split()) edges[a].append(b) edges[b].append(a) colors = [-1]*(N+1) def paint(n...
s927600380
p03579
u935558307
1589753587
Python
PyPy3 (2.4.0)
py
Runtime Error
2110
120224
645
N,M = map(int,input().split()) edges = [[]for _ in range(N+1)] for _ in range(M): a,b = map(int,input().split()) edges[a].append(b) edges[b].append(a) colors = [-1]*(N+1) def paint(n,p,c): ret = 1 if colors[n]!=-1 and colors[n]!=c: ret = 0 else: colors[n] = c for nx in e...
s800534782
p03579
u229156891
1589468217
Python
Python (3.8.2)
py
Runtime Error
438
39004
606
N, M = map(int, input().split()) edges = [list(map(int, input().split())) for i in range(M)] #隣接リストで管理 adj = [[] for j in range(N)] for edge in edges: x, y = edge adj[x-1].append(y) adj[y-1].append(x) color = [0] * N #二部グラフ判定 def dfs(node, c): color[node-1] = c for i in adj[node-1]: if c ...
s021632526
p03579
u197457087
1589121980
Python
Python (3.4.3)
py
Runtime Error
516
23040
547
N, M = map(int,input().split()) michi = [[] for i in range(N)] for i in range(M): tempa, tempb = map(int,input().split()) michi[tempa-1].append(tempb-1) michi[tempb-1].append(tempa-1) #print(michi) colors = [0 for i in range(N)] def dfs(v,color): colors[v] = color for to in michi[v]: if colors[to] ==...
s607121706
p03579
u197457087
1589121924
Python
Python (3.4.3)
py
Runtime Error
515
25824
545
N, M = map(int,input().split()) michi = [[] for i in range(N)] for i in range(M): tempa, tempb = map(int,input().split()) michi[tempa-1].append(tempb-1) michi[tempb-1].append(tempa-1) print(michi) colors = [0 for i in range(N)] def dfs(v,color): colors[v] = color for to in michi[v]: if colors[to] == ...
s130065212
p03579
u743420240
1588636794
Python
Python (3.4.3)
py
Runtime Error
592
32064
1134
def dfs(g: {}, v: int, seen: [], current_color: int): seen[v] = current_color for next_v in g[v]: # next_v が探索済だったらスルー if seen[next_v] != -1: if current_color == seen[next_v]: return False continue seen[next_v] = 1-current_color # 再帰的に探索 ...
s505186302
p03579
u743420240
1588634544
Python
Python (3.4.3)
py
Runtime Error
2104
42488
846
import sys sys.setrecursionlimit(1000000) def triangle(m, g): for i in range(m): nex_ls = g[i] for nex in nex_ls: for nex2 in g[nex]: if nex2 == i: continue if nex2 in nex_ls: return True return False def mai...
s505104413
p03579
u057109575
1587845662
Python
PyPy3 (2.4.0)
py
Runtime Error
788
99544
531
N, M = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(M)] def dfs(u, c): color[u] = c for v in graph[u]: if color[v] == c: return False if color[v] == 0 and not dfs(v, -c): return False return True graph = [[] for _ in range(N...
s508514406
p03579
u219015402
1587089252
Python
Python (3.4.3)
py
Runtime Error
556
31484
793
N,M = map(int,input().split()) graph = {i:[] for i in range(N)} for _ in range(M): x,y = map(int,input().split()) x -= 1 y -= 1 graph[x].append(y) graph[y].append(x) def f(u,c): color[u] = c for v in graph[u]: if color[v] == 0: # まだ塗られていない場合 if not f(v,-c): ...