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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s682565125 | p03800 | u077291787 | 1566904315 | Python | Python (3.4.3) | py | Runtime Error | 120 | 3956 | 772 | # ARC069D - Menagerie (ABC055D)
def check(a: int, b: int) -> list:
ret, cur, prev = [], a, b
for i in S:
ret += [cur]
if cur ^ (i == "o"): # oSo or oWx
prev, cur = cur, prev ^ 1 # both neighbors are different
else: # oSx or oWo
prev, cur = cur, prev # both are the same
flg = cur == a and prev == b # check the consistency of input and result
return ret if flg else []
def main():
global S
N = int(input())
S = input().rstrip()
for a in range(2):
for b in range(2):
x = check(a, b)
if x:
ans = "".join("S" if i else "W" for i in ans)
print(ans)
return
print(-1)
if __name__ == "__main__":
main() |
s718998562 | p03800 | u785578220 | 1557149106 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 502 | a = int(input())
b = input()
t = ["SS","SW","WS","WW"]
for j in range(4):
for i in range(1,a):
if t[j][i] == "S" and b[i] == "o":
t[j]+="S" if t[j][i-1] == "S" else "W"
elif t[j][i] == "S" and b[i] == "x":
t[j]+="S" if t[j][i-1] == "W" else "W"
elif t[j][i] == "W" and b[i] == "x":
t[j]+="S" if t[j][i-1] == "S" else "W"
elif t[j][i] == "W" and b[i] == "o":
t[j]+="S" if t[j][i-1] == "W" else "W"
else:
t[j] = -1
break
s = -1
if all(i == -1 f |
s922404791 | p03800 | u816631826 | 1553542019 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 607 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def gen(start, s):
for i in xrange(1, len(s)+1):
c = start[i]
h = s[i] if i < len(s) else s[0]
if h == 'o':
if c == 'S':
start += start[i-1]
else:
start += 'S' if start[i-1] == 'W' else 'W'
else:
if c == 'S':
start += 'S' if start[i-1] == 'W' else 'W'
else:
start += start[i-1]
if start[:2] == start[-2:]:
return start[:-2]
return ''
def main():
n = int(raw_input())
s = raw_input()
for x in ('SS', 'SW', 'WW', 'WS'):
ans = gen(x, s)
if ans:
print ans
return
print -1
if __name__ == '__main__':
main() |
s201384356 | p03800 | u388927326 | 1548594942 | Python | Python (3.4.3) | py | Runtime Error | 71 | 4108 | 885 | #!/usr/bin/env python3
def main():
n = int(input())
s = input()
for d0 in ["S", "W"]:
for d1 in ["S", "W"]:
pat = wrap(n, s, d0, d1)
if pat[0] == pat[n] and pat[1] == pat[n + 1]:
res = "".join(pat[:n])
print(res)
return
print("-1")
def wrap(n, s, d0, d1):
ds = [d0, d1]
for i in range(2, n + 2):
d = get_dnext(ds[i - 2], ds[i - 1], s[i - 1])
ds.append(d)
assert len(ds) == n + 2
return ds
def get_dnext(dpre, di, si):
if di == "S" and si == "o":
dnext = dpre
elif di == "S" and si == "x":
dnext = inv(dpre)
elif di == "W" and si == "o":
dnext = inv(dpre)
elif di == "W" and si == "x":
dnext = dpre
else:
raise Exception
return dnext
def inv(d):
return "W" if d == "S" else "S"
main()
|
s446845906 | p03800 | u928667792 | 1491043245 | Python | PyPy2 (5.6.0) | py | Runtime Error | 35 | 27884 | 1737 | #include <cstdio>
constexpr int MAX_N = 100100;
using namespace std;
int n;
char arr[MAX_N];
char opt[4][MAX_N];
int main() {
scanf(" %d", &n);
for (int i = 0; i < n; i++) {
scanf(" %c", &arr[i]);
}
opt[0][0] = 'S';
opt[0][1] = 'S';
opt[1][0] = 'S';
opt[1][1] = 'W';
opt[2][0] = 'W';
opt[2][1] = 'S';
opt[3][0] = 'W';
opt[3][1] = 'W';
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
if (opt[j][i] == 'S' && opt[j][i + 1] == 'S') {
if (arr[i] == 'o') {
opt[j][i + 2] = 'S';
} else {
opt[j][i + 2] = 'W';
}
} else if (opt[j][i] == 'S' && opt[j][i + 1] == 'W') {
if (arr[i] == 'o') {
opt[j][i + 2] = 'W';
} else {
opt[j][i + 2] = 'S';
}
} else if (opt[j][i] == 'W' && opt[j][i + 1] == 'S') {
if (arr[i] == 'o') {
opt[j][i + 2] = 'W';
} else {
opt[j][i + 2] = 'S';
}
} else {
if (arr[i] == 'o') {
opt[j][i + 2] = 'S';
} else {
opt[j][i + 2] = 'W';
}
}
}
}
int which = -1;
for (int i = 0; i < 4; i++) {
if (opt[i][0] == opt[i][n] && opt[i][1] == opt[i][n + 1]) {
which = i;
break;
}
}
if (which == -1) {
printf("-1\n");
} else {
for (int i = 1; i <= n; i++) {
printf("%c", opt[which][i]);
}
printf("\n");
}
return 0;
}
|
s207974276 | p03800 | u369752439 | 1487482992 | Python | Python (2.7.6) | py | Runtime Error | 14 | 6660 | 708 | try:
while True:
n = raw_input().strip().upper()
oxList = raw_input().strip().lower()
ans = -1
for s0 in ["S", "W"]:
for s1 in ["S","W"]:
swList = [0]*int(n)
swList[0] = s0
swList[1] = s1
for i in range(2, int(n)):
nextAnimal = findNextAnimal(oxList, swList, i-1)
swList[i] = nextAnimal
flag = checkList(oxList, swList)
if(flag == 1):
ans = ""
for s in swList:
ans += s
print ans
except EOFError:
pass |
s123098093 | p03800 | u019058731 | 1487473865 | Python | Python (3.4.3) | py | Runtime Error | 2103 | 3796 | 877 | N = int(input())
s_in = input()
ans = 'S'*N
ind = 0
for s in s_in:
if ind>0:
# print(ans)
# print(s_in)
if s_in[ind-1]=='x':
ans = ans[0:ind]+'W'+ans[ind+1:len(ans)]
if s_in[ind-1]=='o':
s_in = s_in[0:(ind-1)]+'x'+s_in[ind:len(s_in)]
elif s_in[ind-1]=='x':
s_in = s_in[0:(ind-1)]+'o'+s_in[ind:len(s_in)]
if s_in[ind]=='o':
s_in = s_in[0:ind]+'x'+s_in[ind+1:len(s_in)]
elif s_in[ind]=='x':
s_in = s_in[0:ind]+'o'+s_in[ind+1:len(s_in)]
if s_in[ind+1]=='o':
s_in = s_in[0:ind+1]+'x'+s_in[ind+2:len(s_in)]
elif s_in[ind+1]=='x':
s_in = s_in[0:ind+1]+'o'+s_in[ind+2:len(s_in)]
# print(s_in[ind])
ind += 1
if s_in.count('x')>0:
print('-1')
else:
print(ans) |
s524000150 | p03801 | u972591645 | 1600828977 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 22916 | 296 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
d = Counter(a)
k = list(d.keys())[::-1]
for i in range(len(k)-1):
ind = a.index(k[i])
ans[ind] += d[k[i]]*(k[i]-k[i+1])
d[k[i+1]] += d[k[i]]
ans[k[-1]-1] += n
for i in ans:
print(i) |
s606878387 | p03801 | u536034761 | 1600827143 | Python | PyPy3 (7.3.0) | py | Runtime Error | 201 | 126784 | 617 | from collections import Counter
n = int(input())
A = tuple(map(int, input().split()))
C = Counter(A)
ans = [0 for _ in range(n)]
D = dict()
S = set(A)
X = sorted(S, reverse=True)
for i, x in enumerate(X):
D[x] = i
index = [n + 1 for _ in range(len(S))]
for i, a in enumerate(A):
index[D[a]] = min(index[D[a]], i)
cnt = 0
x = n + 1
for i in range(1, len(S)):
tmp = X[i - 1]
nxt = X[i]
cnt += C[tmp]
x = min(x, index[D[tmp]])
ans[x] += (tmp - nxt) * cnt
for i, a in enumerate(A):
if a != 0:
cnt += C[nxt]
ans[i] += nxt * cnt
break
for a in ans:
print(a)
|
s403138146 | p03801 | u998633108 | 1594915659 | Python | Python (3.8.2) | py | Runtime Error | 2210 | 214968 | 331 | n = int(input())
a = [int(v) for v in input().split()]
mx = max(a)
b = [0]*mx
for i in range(n): b[a[i]-1]+=1
c = [-1]*mx
for i in range(n):
if c[a[i]-1]==-1: c[a[i]-1]=i
for i in range(mx-2, -1, -1):
b[i] += b[i+1]
if c[i]==-1: c[i] = c[i+1]
res = [0]*n
for i in range(mx): res[c[i]] += b[i]
for i in range(n): print(res[i]) |
s934122373 | p03801 | u998633108 | 1594915462 | Python | Python (3.8.2) | py | Runtime Error | 2210 | 214992 | 331 | n = int(input())
a = [int(v) for v in input().split()]
mx = max(a)
b = [0]*mx
for i in range(n): b[a[i]-1]+=1
c = [-1]*mx
for i in range(n):
if c[a[i]-1]==-1: c[a[i]-1]=i
for i in range(mx-2, -1, -1):
b[i] += b[i-1]
if c[i]==-1: c[i] = c[i+1]
res = [0]*n
for i in range(mx): res[c[i]] += b[i]
for i in range(n): print(res[i]) |
s999903849 | p03801 | u754022296 | 1591062538 | Python | Python (3.4.3) | py | Runtime Error | 200 | 31556 | 456 | import sys
read = sys.stdin.read
from itertools import accumulate
n, *A = map(int, read().split())
S = []
now = 0
for a in A:
if now < a:
now = a
S.append(a)
l = len(S)
C = [0]*l
D = {e:i for i, e in enumerate(S)}
K = [-1]*l
for i, a in enumerate(A):
idx = D[a]
if K[idx] == -1:
K[idx] = i
C[idx] += 1
S = [0] + S
C = list(accumulate(C[::-1]))[::-1]
L = [0]*n
for i, k in enumerate(K):
L[k] = (S[i+1]-S[i]) * C[i]
print(*L, sep="\n") |
s721666685 | p03801 | u222668979 | 1590609501 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 189 | n, m = map(int, input().split())
cnt =0
for i in range(n):
if m >= 2:
m -= 2
cnt += 1
for j in range(m // 4):
if m >=4:
m -= 4
cnt += 1
print(cnt) |
s857744836 | p03801 | u476604182 | 1584749851 | Python | Python (3.4.3) | py | Runtime Error | 863 | 37452 | 849 | class BIT:
def __init__(self, n):
self.N = n+1
self.bit = [0]*self.N
def bit_sum(self, i):
s = 0
i += 1
while i>0:
s += self.bit[i]
i -= i & -i
return s
def bit_add(self, i, n):
i += 1
while i<self.N:
self.bit[i] += n
i += i & -i
N, *A = map(int, open(0).read().split())
inf = [(a,i) for i, a in enumerate(A)]
n = A[0]
ls = [0]
for i in range(1,N):
if A[i]>n:
n = A[i]
ls.append(i)
B = BIT(N)
inf.sort(reverse=True)
cnt = [0]*N
for a,i in inf:
B.bit_add(i,1)
cnt[i] = B.bit_sum(N-1)-B.bit_sum(i-1)
s = sum(A)
ans = [0]*N
n = A[ls[-2]]
for i in range(ls[-1],N):
if A[i]>n:
ans[ls[-1]] += A[i]-n
s -= A[i]-n
for i in range(len(ls)-2,0,-1):
a = ls[i]
b = ls[i-1]
m = A[a]-A[b]
ans[a] = m*cnt[a]
s -= m*cnt[a]
ans[0] = s
print('\n'.join(map(str,ans))) |
s457827852 | p03801 | u476604182 | 1584746140 | Python | Python (3.4.3) | py | Runtime Error | 850 | 37452 | 755 | class BIT:
def __init__(self, n):
self.N = n+1
self.bit = [0]*self.N
def bit_sum(self, i):
s = 0
i += 1
while i>0:
s += self.bit[i]
i -= i & -i
return s
def bit_add(self, i, n):
i += 1
while i<=self.N:
self.bit[i] += n
i += i & -i
N, *A = map(int, open(0).read().split())
inf = [(a,i) for i, a in enumerate(A)]
n = A[0]
ls = [0]
for i in range(1,N):
if A[i]>n:
n = A[i]
ls.append(i)
B = BIT(N)
inf.sort(reverse=True)
cnt = [0]*N
for a,i in inf:
B.bit_add(i,1)
cnt[i] = B.bit_sum(N-1)-B.bit_sum(i-1)
s = sum(A)
ans = [0]*N
for i in range(len(ls)-1,0,-1):
a = ls[i]
b = ls[i-1]
m = A[a]-A[b]
ans[a] = m*cnt[a]
s -= m*cnt[a]
ans[0] = s
print('\n'.join(map(str,ans))) |
s981493828 | p03801 | u819048695 | 1580850567 | Python | PyPy3 (2.4.0) | py | Runtime Error | 280 | 66404 | 431 | N=int(input())
A=list(map(int,input().split()))
num=A[0]
data=[[A[0],0]]
for i in range(1,N):
if A[i]>num:
data.append([A[i],i])
num=A[i]
B=sorted(A,reverse=True)
ans=[0]*N
kkk=0
for i in range(len(data)-1,0,-1):
zzz=data[i][0]
while kkk<N and B[kkk]>=zzz:
kkk+=1
ans[data[i][1]]=(zzz-data[i-1][0])*kkk
cnt+=1
ans[0]=sum(A)-sum(ans)
for u in ans:
print(u) |
s738202563 | p03801 | u969190727 | 1580268332 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 155172 | 1014 | import collections
import heapq
n=int(input())
A=[int(i) for i in input().split()]
Ans=[0]*n
M=[0]#่ชๅใใๅใฎๆๅคงๅคใใกใขใใใไปฅไธใ ใจ็พใใชใ
for i in range(n):
M.append(max(M[-1],A[i]))
D=collections.defaultdict(int)
H=[]
for i in range(n):
j=n-1-i
if A[j]<=M[j]:
heapq.heappush(H,-A[j])#ๅบ็พใใชใใคใณใใใฏในใฎๆฐใ็ฎก็ใๅคงใใใปใใใๅใๅบใใ
else:
Ans[j]=(A[j]-M[j])*(D[A[j]]+1)#่ชๅใใๅใฎๆๅคงๅคใจ่ชๅใฎๅทฎใใใ่ชๅ่ช่บซใจๅใๆฐใฎใใใพใงใฎๅบ็พๅๆฐ
D[M[j]]+=D[A[j]]+1#่ชๅ่ช่บซใใๅพใใฎ่ชๅใจๅใๆฐๅ
จใฆใ่ชๅใใๅใฎๆๅคงๅคใพใงๆธใใใใจใงๅขใใๅ
ct=0
while H:#่ชๅใใๅพใใง่ชๅใใๅฐใใใใ่ชๅใฎๅใฎๆๅคงๅคใใๅคงใใใใฎใๅ
จใฆ่ฆใ
a=heapq.heappop(H)
a=-a
if a<=M[j]:
heapq.heappush(H,-a)
break
else:
Ans[j]+=a-M[j]
D[M[j]]+=1
for a in Ans:
print(Ans)
|
s189921679 | p03801 | u511965386 | 1573703472 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 547 | from collections import defaultdict
N = int(input())
a = [int(i) for i in input().split()]
b = defaultdict(lambda : [float('inf'), 0])
for i in range(N) :
b[a[i]][0] = min(b[a[i]][0], i)
b[a[i]][1] += 1
# [value, first_appearance, count]
c = [(0, 0, 0)]
for k, v in b.items() :
c.append((k, *v))
c.sort()
ret = [0] * N
pre_v, pre_i, pre_c = c.pop()
while c :
cur_v, cur_i, cur_c = c.pop()
ret[pre_i] = (pre_v - cur_v) * pre_c
cur_c += pre_c
pre_v, pre_i, pre_c = cur_v, cur_i, cur_c
for r in ret :
print(r) |
s029700846 | p03801 | u729133443 | 1571035665 | Python | Python (3.4.3) | py | Runtime Error | 241 | 31272 | 228 | n,a=open(0)
*a,=map(int,a.split())
c,d={},{}
m=0
for j,i in enumerate(a):
if i>m:d[i],m=j,i
c[i]=c.get(i,0)+1
i=sorted(d)[::-1]
a=[0]*int(n)
for i,j in zip(i,i[1:]):
a[d[i]]=(i-j)*c[i]
c[j]+=c[i]
a[d[j]]=j*c[j]
print(*a) |
s466352228 | p03801 | u392319141 | 1570796937 | Python | Python (3.4.3) | py | Runtime Error | 145 | 24140 | 277 | N = int(input())
A = [(a, i) for i, a in enumerate(map(int, input().split()))]
A.sort(reverse=True)
A.append((0, 0))
ans = [0] * N
now = float('inf')
for j, (a, i) in enumerate(A[:N], start=1):
now = min(now, a)
ans[now] += j * (now - A[j][0])
print(*ans, sep='\n')
|
s546916586 | p03801 | u426108351 | 1559234769 | Python | Python (3.4.3) | py | Runtime Error | 325 | 26288 | 347 | N = int(input())
a = list(map(int, input().split()))
b = []
for i in range(N):
b.append([a[i], i+1])
b.sort(reverse = True)
ans = [0]*(N+1)
mini = N+1
for i in range(N-1):
mini = min(mini, b[i][1])
if b[i+1][0] - b[i][0] < 0:
ans[mini] += (b[i][0] - b[i+1][0])*(i+1)
ans[1] += N*min(b)
for i in range(N):
print(ans[i+1])
|
s463731720 | p03801 | u651925006 | 1525400272 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 609 | #include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
typedef pair<lint,int>pli;
#define rep(i,n)for(int i=0;i<(int)(n);++i)
int main(){
int n;
cin>>n;
vector<lint>a(n);
rep(i,n)cin>>a[i];
vector<pli>b(n);
rep(i,n)b[i]=pli(a[i],i);
sort(b.rbegin(),b.rend());
vector<lint>ans(n);
int mi=n;
rep(i,n){
if(i==n-1||b[i].first!=b[i+1].first){
mi=min(b[i].second,mi);
lint diff=b[i].first-(i==n-1?0:b[i+1].first);
ans[mi]+=diff*(i+1);
}
}
rep(i,n)cout<<ans[i]<<endl;
}
|
s360023364 | p03801 | u281303342 | 1525385364 | Python | Python (3.4.3) | py | Runtime Error | 310 | 23880 | 424 | from collections import Counter
N = int(input())
S = list(map(int,input().split()))
T = []
for i in range(N):
T.append((i,S[i]))
U = sorted(T,key=lambda x:x[1], reverse=True)
Ans = [0]*N
c,v = 0,10**10
for i in range(N-1):
c+=1
v = min(v,U[i][0])
if U[i][1]==U[i+1][1]:
continue
else:
Ans[v] += (U[i][1] - U[i+1][1])*c
else:
Ans[0] += U[i+1][1]
for i in range(N):
print(Ans[i]) |
s519118842 | p03801 | u667024514 | 1525378390 | Python | Python (3.4.3) | py | Runtime Error | 288 | 24812 | 536 | n = int(input())
lis = list(map(int, input().split()))
key = lis[0]
num = [0]
li = [key]
for i in range(1,n):
if lis[i] > key:
line = lis[i]
num.append(i)
li.append(line)
m = len(li)
nu = [li[0]]+[li[i+1]-li[i] for i in range(m-1)]
he = [0]*m
cou = [0]*m
from bisect import bisect_left
for k in lis:
sen = bisect_left(li,k)
cou[sen] += k -li[sen]
he[sen] += 1
t = 0
for i in reversed(range(m)):
t += he[i]
he[i] = t
for i in range(m):cou[i] += he[i]*nu[i]
ans = [0]*n
for i,c in zip(num,cou):ans[i] = c
for r in ans:print(r) |
s758792101 | p03801 | u711574130 | 1488567272 | Python | Python (2.7.6) | py | Runtime Error | 2169 | 2012380 | 423 | # -*- coding:utf-8 -*-
from operator import itemgetter
n = int(raw_input())
a = [[int(k),i+1] for i,k in enumerate(raw_input().split())]
a.sort(key=itemgetter(0),reverse=True)
u = []
s=[0]*n
a.append([0,0])
for i,p in enumerate(a[:-1]):
if not p[0] == a[i+1][0]:
q = p[0] - a[i+1][0]
y = [z[1] for z in a[:i+1]]
s[min(y)-1] += (i+1)*q
u.extend([min(y)]*(i+1)*q)
for t in s:
print(t) |
s784724510 | p03801 | u711574130 | 1488565524 | Python | Python (2.7.6) | py | Runtime Error | 2168 | 2011612 | 421 | # -*- coding:utf-8 -*-
from operator import itemgetter
n = int(raw_input())
a = [[int(k),i+1] for i,k in enumerate(raw_input().split())]
a.sort(key=itemgetter(0),reverse=True)
s = []
b = []
a.append([0,0])
for i,p in enumerate(a[:-1]):
if not p[0] == a[i+1][0]:
q = a[i][0] - a[i+1][0]
y = [z[1] for z in a[:i+1]]
s.extend([min(y)]*(i+1)*q)
for i in xrange(1,int(n)+1):
print(s.count(i))
|
s037999932 | p03801 | u711574130 | 1488565003 | Python | Python (2.7.6) | py | Runtime Error | 2167 | 2012500 | 676 | # -*- coding:utf-8 -*-
from operator import itemgetter
n = int(raw_input())
a = [[int(k),i+1] for i,k in enumerate(raw_input().split())]
a.sort(key=itemgetter(0),reverse=True)
s = []
b = []
a.append([0,0])
while (True):
if a[-2][0]==0:break
a.sort(key=itemgetter(1),reverse=True)
a.sort(key=itemgetter(0),reverse=True)
b=[]
for i,p in enumerate(a[:-1]):
if not p[0] == a[i+1][0]:
q = p[0] - a[i+1][0]
s.extend([p[1]]*(i+1)*q)
for j in range(i):
a[j][0] = a[i+1][0]
a[i][0] = a[i+1][0]
break
else:
pass
for i in xrange(1,int(n)+1):
print(s.count(i)) |
s095920337 | p03801 | u332385682 | 1487821546 | Python | Python (3.4.3) | py | Runtime Error | 270 | 26844 | 928 |
def BS(th, a):
top = len(th)
btm = 0
while top > btm:
mid = (top + btm)//2
if th[mid] <= a < th[mid + 1]:
return mid
elif a <= th[mid]:
top = mid
else:
btm = mid
N = int(input())
A = [int(i) for i in input().split()]
th = [0]
num_th = []
rem = []
max_i = 0
nonzeros = dict()
for i, a in enumerate(A):
if a > th[-1]:
th.append(a)
num_th.append(1)
rem.append(0)
nonzeros[i] = max_i
max_i += 1
else:
j = BS(th, a)
if j - 1 >= 0:
num_th[j - 1] += 1
rem[j] += a - th[j]
for i in range(len(num_th) - 1, 0, -1):
num_th[i - 1] += num_th[i]
'''
print(th)
print(num_th)
print(rem)
'''
for i in range(N):
if i in nonzeros:
ans = (th[nonzeros[i] + 1] - th[nonzeros[i]])*num_th[nonzeros[i]] + rem[nonzeros[i]]
print(ans)
else:
print(0) |
s073116990 | p03802 | u692782635 | 1531642688 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 536 | from functools import cmp_to_key
n = int(input())
a = list(map(int, input().split()))
def group(a):
d = {}
for i, x in enumerate(a):
d.setdefault(x, []).append(i)
s = sorted(d.items(), key=cmp_to_key(lambda x, y: x[0] - y[0]),
reverse=True)
return list(map(lambda x: [x[0], x[1][0], len(x[1])], s))
ans = [0] * n
g = group(a)
g.append([0, 0, 0])
for c, n in zip(g[:-1], g[1:]):
ans[c[1]] += (c[0] - n[0]) * c[2]
n[1] = min(c[1], n[1])
n[2] += c[2]
[print(a) for a in ans] |
s683053725 | p03802 | u692782635 | 1531642456 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 577 | from functools import cmp_to_key
n = int(input())
a = list(map(int, input().split()))
def group(a):
d = {}
for i, x in enumerate(a):
d.setdefault(x, []).append(i)
s = sorted(d.items(), key=cmp_to_key(lambda x, y: x[0] - y[0]),
reverse=True)
return list(map(lambda x: [x[0], x[1][0], len(x[1])], s))
ans = [0] * n
g = group(a)
g.append([0, 0, 0])
for c, n in zip(g[:-1], g[1:]):
ans[c[1]] += (c[0] - n[0]) * c[2]
n[1] = min(c[1], n[1])
n[2] += c[2]
[print(a) for a in ans] |
s225337215 | p03802 | u692632484 | 1489788882 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 246 | N=int(input())
xy=[[int(i) for i in input().split()] for i in range(N)]
flag=[False for i in range(N)]
z=[[xy[i][0],i] for i in range(N)]
z.extend([[xy[i][1],i] for i in range(N)])
z.sort()
dist=[z[i+1]-z[i] for i in range(2N-1)]
dist.sort()
|
s428311919 | p03803 | u904075088 | 1601230857 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8772 | 210 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
A = int(input('Alice'))
B = int(input('Bob'))
if A==1:
A+=13
if B==1:
B++13
if A==B:
print('Draw')
elif A > B:
print('Alice')
elif A < B:
print('Bob')
|
s538232990 | p03803 | u904075088 | 1601229714 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8860 | 187 | A = input('A')
B = input('B')
if A==B:
print('Draw')
elif A>B:
if B==1:
print('Bob')
else:
print('Alice')
elif A<B:
if A==1:
print('Alice')
else:
print('Bob')
|
s186628445 | p03803 | u904075088 | 1601229659 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8724 | 185 | A = input('A')
B = input('B')
if A==B:
print('Draw')
elif A>B:
if B==1:
print('Bob')
else:
print('Alice')
elif A<B:
if A==1:
print('Alice')
else:
print('Bob')
|
s237504432 | p03803 | u904075088 | 1601228870 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9036 | 180 | A = input('A')
B = input('B')
if A==B:
print('Draw')
elif A>B:
if B==1:
print('Bob')
else:
print('Alice')
elif A<B:
if A==1:
print('Alice')
else:
print('Bob')
|
s595206156 | p03803 | u904075088 | 1601228250 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8920 | 169 | A = input(A)
B = input(B)
if A==B
print("Draw")
elif A>B
if B==1
print("Bob")
else print("Alice")
elif A<B
if A==1
print("Alice")
else print("Bob")
|
s087241777 | p03803 | u485349322 | 1600399437 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9156 | 156 | A,B=map(int,input().split())
if A==B:
print("Draw")
elif A==1:
print("Alice")
elif B==1:
print(Bob)
elif A>B:
print("Alice")
else:
print("Bob")
|
s482069580 | p03803 | u666550725 | 1599859821 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74176 | 172 | A, B = map(int, input().split())
if A == B:
print("Draw")
elif A == 1 and :
print("Alice")
elif B == 1:
print("Bob")
elif A > B:
print("Alice")
else:
print("Bob") |
s896357754 | p03803 | u237634011 | 1599857363 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8936 | 104 | a, b = map(int, input().split())
if a > b or a = 1:
print("Alice")
elif b > a or b = 1:
print("Bob") |
s572182088 | p03803 | u849073847 | 1599186787 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8920 | 192 | a b = int(x) for x in input().split()
if a == b:
print("Draw")
elif a > b and b != 1:
print("Alice")
elif a < b and a != 1:
print("Bob")
elif a==1:
print("Alice")
else:
print("Bob")
|
s715403024 | p03803 | u849073847 | 1599186745 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8960 | 191 | a b = int(x) for x in input().split()
if a == b:
print("Draw")
elif a > b and b != 1:
print("Alice")
elif a < b and a != 1:
print("Bob")
elif a==1:
print("Alice")
else
print("Bob")
|
s756146106 | p03803 | u849073847 | 1599186696 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8924 | 197 | a b = int(x) for x in input().split()
if a == b:
print("Draw")
elif a > b and b != 1:
print("Alice")
elif a < b and a != 1:
print("Bob")
elif a==1:
print("Alice")
elif b==1:
print("Bob")
|
s643644220 | p03803 | u782001565 | 1598723908 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9028 | 178 | # ๅ
ฅๅ
A, B = map(int,input().split())
# ๅฆ็
if A == B:
print('Draw')
elif A == 1:
print('Alice')
elif B == 1:
print('Bob')
elif A > B:
print('Alice')
else: |
s575754071 | p03803 | u620846115 | 1598468906 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8848 | 153 | a = list(int(input()))
if a[0] ==0 or a[1]==0:
a.replace("0","14")
if a[0]>a[1]:print("Alice")
elif a[0]=a[1]:print("Draw")
elif a[0]<a[1]:print("Bob") |
s782088998 | p03803 | u620846115 | 1598468759 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8936 | 148 | a = list(input())
if a[0] ==0 or a[1]==0:
a.replace("0","14")
if a[0]>a[1]:print("Alice")
elif a[0]=a[1]:print("Draw")
elif a[0]<a[1]:print("Bob") |
s656972230 | p03803 | u004823354 | 1598417462 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9008 | 242 | a = int(input())
b = int(input())
if a != 1 and b!= 1:
if a > b:
print("Alice")
elif a < b:
print("Bob")
else:
print("Draw")
elif a!=1 and b == 1:
print("Bob")
elif a == 1 and b != 1:
print("Alice")
else:
print("Draw") |
s557983104 | p03803 | u468972478 | 1598215792 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9056 | 186 | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
for i in a:
for j in b:
if j not in i:
print("No")
exit()
print("Yes")
|
s629386186 | p03803 | u763963344 | 1598211005 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8908 | 127 | a,b = map(int, input().split())
if a>b and b!=1 or a==1:
print("Alice")
elif a==b:
print("Draw")
else
print("Bob") |
s427446339 | p03803 | u763963344 | 1598210972 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8908 | 127 | a,b = map(int, input().split())
if a>b and b!=1 or a==1:
print("Alice")
elif a==b:
print("Draw")
else
print("Bob") |
s929841544 | p03803 | u763963344 | 1598210935 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8888 | 127 | a,b = map(int, input().split())
if a>b and b!=1 or a==1:
print("Alice")
elif a==b:
print("Draw")
else
print("Bob") |
s068498048 | p03803 | u468972478 | 1597626882 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8904 | 148 | a, b = map(int, input().split()
if a == b:
print("Draw")
elif a == 1 or a > b >= 2:
print("Alice")
elif b == 1 or b > a >= 2:
print("Bob") |
s497945932 | p03803 | u468972478 | 1597624707 | Python | Python (3.8.2) | py | Runtime Error | 31 | 8944 | 129 | a, b = map(int, input().split()
if a == b:
print("Draw")
elif a == 1 or (a > b >= 2):
print("Alice")
else:
print("Bob") |
s563720829 | p03803 | u468972478 | 1597624584 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8748 | 127 | a, b = map(int, input().split()
if a == b:
print("Draw")
elif a == 1 or a > b >= 2:
print("Alice")
else:
print("Bob") |
s330126618 | p03803 | u468972478 | 1597624352 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9004 | 122 | a, b = map(int, input().split()
if a == b:
print("Draw")
elif a == 1 or a > b:
print("Alice")
else:
print("Bob") |
s350773293 | p03803 | u835575472 | 1597264386 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9104 | 148 | a, b = map(int, input())
if a > b or (a == 1 and b != 1):
print("Alice")
elif a < b or (a !=1 and b == 1):
print("Bob")
else:
print("Draw")
|
s689673086 | p03803 | u589969467 | 1597195950 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8944 | 182 | Alice,Bob = map(int,input().split())
if Alice = 1:
ALice = 14
if Bob = 1:
Bob = 14
if Alice>Bob:
print('Alice')
elif Alice==Bob:
print('Draw')
else:
print('Bob')
|
s545031058 | p03803 | u766646838 | 1597178852 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9224 | 787 | N,M = map(int,input().split())
a = []
c = []
for i in range(N):
b = list(input())
a+=b
for i in range(M):
b = list(input())
c+=b
#print(c,a)
f = False
for i in range(N*N):
if f == True:
break
if N*N-i<M*M:
break
count=0
flag = True
#print(i,c[0],a[i])
if c[0] == a[i]:
if N-(i%N)<M:
continue
num = i
for j in range(M):
for k in range(M):
#print(c[count],a[num])
if c[count] == a[num]:
num+=1
count+=1
elif c[count]!=a[num]:
flag =False
break
num+=N-M
if flag == False:
#print(i)
break
if j == M-1:
f = True
else:
continue
if f == False:
print('No')
else:
print('Yes')
|
s214114142 | p03803 | u442948527 | 1597064842 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9024 | 99 | a=(int(input())-2)%13
b=(int(input())-2)%13
print(["Draw","Bob","Alice"][((a==b)+1)*((a<b)-(b<a))]) |
s847704143 | p03803 | u226779434 | 1596968929 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8660 | 190 | a,b =map(int,input().split())
A,B,C ="Alice","Bob",Draw"
if max(a,b) =="13" and min(a,b) =="1":
print(A) if a < b else print(B)
else:
print(A) if a > b print(B) if a < b else print(C)
|
s015120539 | p03803 | u274615057 | 1596952198 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8936 | 270 |
def main():
a, b = map(int, input().split())
if a-2 < 0:
a = 14
if b-2 < 0:
b = 14i
if a-2 > b-2:
print('Alice')
elif a-2 < b-2:
print('Bob')
else:
print('Draw')
if __name__ == "__main__":
main()
|
s075834047 | p03803 | u442948527 | 1596765545 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8956 | 106 | a,b=map(int,input().split())
if a>b:
print("Alice")
elif a=b:
print("Draw")
else:
print("Bob") |
s925460706 | p03803 | u125269142 | 1596674347 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9020 | 129 | a, b = map(int, input().split())
if a < b:
ans = 'Bob'
elif a == b:
ans = 'Draw'
else:
a > b:
ans = 'Alice'
print(ans) |
s369232642 | p03803 | u714104087 | 1596577927 | Python | PyPy3 (7.3.0) | py | Runtime Error | 98 | 74340 | 109 | a, b = map(int, input().split())
if a > b:
print("Alice")
elif a = b:
print("Draw")
else:
print("Bob") |
s263203449 | p03803 | u174536291 | 1596561490 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8980 | 184 | a, b = list(map(int, input().split()))
if a == 1:
a = 14
else:
break
if b == 1:
b = 14
else:
break
if a > b:
print('Alice')
elif a == b:
print('Draw')
else:
print('Bob')
|
s132231925 | p03803 | u739843002 | 1596227184 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8964 | 148 | tmp = input().split(" ")
a = (int(tmp[0]) - 2) % 13
b = (int(tmp[1]) - 2) % 13
print("Alice") if a > b else print("Draw") if a = b else print("Bob") |
s644361601 | p03803 | u487288850 | 1595657080 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8796 | 138 | a,b = = map(int,input().split())
if a==1 and b!=1 or a>b:
print('Alice')
elif b==1 and a!=1 or b>a:
print('Bob')
else:
print('Draw') |
s616876883 | p03803 | u670961163 | 1595480407 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9016 | 110 | a, b = map(int, input())
if a == b:
print('Draw')
elif a > b and b!=1:
print('Alice')
else:
print('Bob') |
s543790180 | p03803 | u786020649 | 1595194941 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9176 | 149 | A, B=map(int,input())
func=lambda x:(x,x+13)[x==1]
if func(A)==func(B):
print('Draw')
elif func(A)<func(B):
print('Bob')
else:
print('Alice') |
s197767510 | p03803 | u506549878 | 1593701391 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8952 | 419 | import itertools
N,M = map(int,input().split())
L=[]
for i in range(M):
a,b=map(int,input().split())
L.append([a,b])
number=[]
for i in range(1,N+1):
number.append(i)
ans=0
for v in itertools.permutations(number,N):
a=0
v=list(v)
for j in range(N-1):
if ([v[j],v[j+1]] not in L ) and ([v[j+1],v[j]] not in L):
a=1
if a==0 and v[0]==1:
ans+=1
print(ans) |
s063106368 | p03803 | u209275335 | 1593150611 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9188 | 187 | li = [2,3,4,5,6,7,8,9,10,11,12,1]
a,b = map(int,input().split())
if li.index(a) == li.index(b):
print("Draw")
elif li.index(a) > li.index(b):
print("Alice")
else:
print("Bob") |
s350859352 | p03803 | u209275335 | 1593150576 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9216 | 185 | li = [2,3,4,5,6,7,8,9,10,11,12,1]
a,b = map(int,input().split())
if li.index(a) == li.index(b):
print("Draw")
if li.index(a) > li.index(b):
print("Alice")
else:
print("Bob") |
s382751171 | p03803 | u440478998 | 1593116170 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9020 | 163 | a,b = map(int(input().split()))
a = 14 if a == 1 else a
b = 14 if b == 1 else b
if a > b:
print("Alice")
elif a < b:
print("Bob")
else:
print("Draw") |
s043628605 | p03803 | u046158516 | 1592960614 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 74732 | 171 | a,b=int(input().split())
if a==b:
print('Draw')
else:
if a==1:
print('Alice')
elif b==1:
print('Bob')
elif a>b:
print('Alice')
else:
print('Bob') |
s512657134 | p03803 | u137228327 | 1592848540 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9012 | 129 | lst = map(int,input().split())
if lst[0] > lst[1]:
print('Alice')
elif lst[0] < lst[1]:
print('Bob')
else:
print('Draw')
|
s514861740 | p03803 | u188138642 | 1592783153 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9204 | 393 | N, M = map(int, input().split())
ab = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int,input().split())
ab[a-1].append(b-1)
ab[b-1].append(a-1)
count = 0
def dfs(i, now, done):
global count
if i == N-1:
count += 1
return
for j in ab[now]:
if j not in done:
dfs(i+1, j, done + [j])
return
dfs(0, 0, [0])
print(count)
|
s700479306 | p03803 | u190178779 | 1592701211 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9064 | 328 | import sys
A,B = map(int,input.split())
if A < 0 or A > 13 or B < 0 or B > 13:
sys.exit()
if A == 1 or B == 1:
if A == B:
print("Draw")
elif A == 1:
print("Alice")
elif B == 1:
print("Bob")
sys.exit()
if A > B:
print("Alice")
elif B > A:
print("Bob")
else:
print("Draw") |
s532725328 | p03803 | u685244071 | 1591635194 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 227 | a, b = map(int, input().split())
if a == 1:
if b == 1:
print('Draw')
else:
print(Alice)
else:
if b == 1:
print('Bob')
elif a > b:
print('Alice')
elif a == b:
print('Draw')
else:
print('Bob') |
s061365523 | p03803 | u446711904 | 1591629205 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | p=[2,3,4,5,6,7,8,9,10,11,12,13,1]
a,b=map(int,input().split())
print('ABloibc e'[p.index(a)<p.idex(b)::2] if a!=b else 'Draw') |
s522149318 | p03803 | u230621983 | 1591499311 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 169 | a,b = map(int,input.split())
if a == b:
ans = 'Draw'
elif a == 1:
ans = 'Alice'
elif b == 1:
ans = 'Bob'
elif a > b:
ans = 'Alice'
else:
ans = 'Bob'
print(ans) |
s453950106 | p03803 | u739798900 | 1590983931 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 352 | cards = input()
cards_s = cards.split()
porker_list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
alice_str = cards_s[0]
alice_s = porker_list.index(alice_str)
alice = int(alice_s)
bob_str = cards_s[1]
bob_s = porker_list.index(bob_str)
bob = int(bob_s)
if alice > bob:
print('Alice')
elif alice == bob:
print('Draw')
else
print('Bob')
|
s915826462 | p03803 | u739798900 | 1590983762 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 359 | cards = input()
cards_s = cards.split()
porker_list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
alice_str = cards_s[0]
alice_int = int(alice_str)
alice = porker_list.index(alice_int)
bob_str = cards_s[1]
bob_int = int(bob_str)
bob = porker_list.index(bob_int)
if alice > bob:
print('Alice')
elif alice == bob:
print('Draw')
else
print('Bob') |
s327666669 | p03803 | u207799478 | 1590892869 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38640 | 256 | a.b=map(int,input().split())
if a==1:
print('Alice')
exit()
if b==1:
print('Bob')
exit()
if a==1 and b==1:
print('Draw')
exit()
if a<b:
print('Bob')
exit()
if a>b:
print('Alice')
exit()
if a==b:
print('Draw')
exit()
|
s333119963 | p03803 | u036190609 | 1590806748 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 200 | A, B = map(int, input().split()))
if A == B:
print("Draw")
elif A == 1 and B != 1:
print("Alice")
elif B == 1 and A != 1:
print("Bod")
elif A > B:
print("Alice")
else:
print("Bob") |
s238116892 | p03803 | u350093546 | 1590709759 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 158 | a,b=map(int,input.split())
if a==b:
print('Draw')
elif a==1:
print('Alice')
elif b==1:
print('Bob')
elif a>b:
print('Alice')
elif a<b:
print('Bob')
|
s173186054 | p03803 | u350093546 | 1590709658 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 153 | a,b=map(int,input.split())
if a==b:
print('Draw')
elif a==1:
print('Alice')
elif b==1:
print('Bob')
elif a>b:
print('Alice')
else:
print('Bob') |
s344440489 | p03803 | u164471280 | 1590293340 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 428 | # ACB054C
n, m = map(int, input().split())
L = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
L[a-1].append(b-1)
L[b-1].append(a-1)
ans = 0
def f(t, history):
history[t] += 1
his = history[:]
global ans
if sum(his) == n:
ans += 1
else:
for i in L[t]:
if his[i] == 0:
f(i, his)
f(0, [0]*n)
print(ans)
|
s290375441 | p03803 | u475966842 | 1590103852 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 113 | A,B=map(int,input().split())
if A==B:
print("Draw")
elif (A>B or A:
print("Alice")
else:
print("Bob") |
s967197876 | p03803 | u475966842 | 1590103789 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 116 | A,B=map(int,input().split())
if A==B:
print("Draw")
elif or(A>B,A==1):
print("Alice")
else:
print("Bob") |
s747177939 | p03803 | u941047297 | 1590014453 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 167 | a = list(map(int, input().split()))
a = [i for i in a if i != 1 else 14]
if a[0] > a[1]:
print('Alice')
elif a[0] == a[1]:
print('Draw')
else:
print('Bob') |
s916993381 | p03803 | u760831084 | 1589657384 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 | if a == 1: a += 13
if b == 1: b += 13
if a > b:
print('Alice')
elif a < b:
print('Bob')
else:
print('Draw') |
s240989709 | p03803 | u044964932 | 1589504884 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 290 | def main():
a, b = map(int, input().split())
if a == b:
ans = 'Draw'
elif a == 1:
ans = 'Alice'
elif b == 1:
ans = 'Bob'
elif a > b:
ans = 'Alice'
elif b < a:
ans = 'Bob'
print(ans)
if __name__ == "__main__":
main()
|
s915536131 | p03803 | u425762225 | 1589415517 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 154 | A,B=map(int,input().split())
def judge(a,b):
if a > b:
return "Alice"
elif a = b:
return "Draw"
else:
return "Bob"
print(judge(A,B)) |
s488271192 | p03803 | u484315555 | 1589313486 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 2318 | class Graph():
def __init__(self):
""" ใใผใใฎใคใชใใใ่พๆธๅใง่กจ็พใใ """
self.adjacency_dict = {}
def add_vertex(self, v):
""" ใใผใใ่ฟฝๅ ใใ """
self.adjacency_dict[v] = []
def add_edge(self, v1, v2):
""" ใใผใๅๅฃซใใคใชใใ"""
# ็กๅใฐใฉใใฎๅ ดๅใฏๅๆนๅใใใๆๅใฐใฉใใชใ็ๅดใฎใฟใ
self.adjacency_dict[v1].append(v2)
self.adjacency_dict[v2].append(v1)
def remove_edge(self, v1, v2):
""" ใใผใๅๅฃซใฎใคใชใใใๅ้คใใใ"""
self.adjacency_dict[v1].remove(v2)
self.adjacency_dict[v2].remove(v1)
def remove_vertex(self,v):
""" ใใผใใๅ้คใใใ"""
while self.adjacency_dict[v] != []:
adjacent_vertex = self.adjacency_dict[v][-1]
self.remove_edge(v, adjacent_vertex)
del self.adjacency_dict[v]
def print_graph(self):
print(self.adjacency_dict)
def _init_internal_graph(self, graph_dict):
self.adjacency_dict = graph_dict
def get_edge(self, v):
""" ๆๅฎใใใใใผใใซ้ขใใใจใใธใ่ฟใใ"""
return self.adjacency_dict[v]
def dprint(*args):
if debug:
if len(args)==1:
print(args[0])
else:
print(args)
debug = False
if debug:
g = Graph()
# N,M = [7, 7]
# g._init_internal_graph({0: [2], 1: [6], 2: [0, 3], 3: [2, 4, 5], 4: [3, 5], 5: [3, 4, 6], 6: [1, 5]})
N,M = [3, 3]
g._init_internal_graph({0: [1, 2], 1: [0, 2], 2: [0, 1]})
else:
N, M = map(int, input().split())
g = Graph()
dprint(N,M)
for n in range(N):
g.add_vertex(n)
# 0-origin
for m in range(M):
v1,v2 = list(map(int, input().split()))
g.add_edge(v1-1,v2-1)
# g.print_graph()
seen = [False] * N
count = 0
def dfs(node, depth):
dprint(node,depth)
if seen[node]:
return 0
if depth == N - 1:
dprint('count-up',seen)
return 1
seen[node] = True
dprint(seen)
total_paths = 0
for next_node in g.get_edge(node):
total_paths += dfs(next_node, depth + 1)
# seenใๆชๅฐ้ใซใใฆๆฌกใธ
seen[node] = False
return total_paths
count = dfs(0, 0)
print(count)
|
s479082899 | p03803 | u713539685 | 1589114472 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 353 | Score_Alice, Score_Bob = map(int, input().split())
if Score_Alice == 1 and Score_Bob == 1:
print('Draw')
elif Score_Alice == 1 and Score_Bob != 1:
print('Alice')
elif Score_Alice != 1 and Score_Bob == 1:
print('Bob')
else:
if Score_Alice > Score_Bob:
print('Alice')
elif Score_Alice < Scoer_Bob:
print('Bob')
else:
print('Draw') |
s692356671 | p03803 | u713539685 | 1589114412 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 353 | Score_Alice, Score_Bob = map(int, input().split())
if Score_Alice == 1 and Score_Bob == 1:
print('Draw')
elif Score_Alice == 1 and Score_Bob != 1:
print('Alice')
elif Score_Alice != 1 and Score_Bob == 1:
print('Bob')
else:
if Score_Alice > Score_Bob:
print('Alice')
elif Score_Alice < Scoer_Bob:
print('Bob')
else:
print('Draw') |
s710288345 | p03803 | u073852194 | 1588992819 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 173 | A, B = map(int, input().split())
if A == B:
print('Draw')
elif A == 1:
pirnt('Alice')
elif B == 1:
print('Bob')
elif A > B:
print('Alice')
else:
print('Bob')
|
s693666579 | p03803 | u073852194 | 1588992784 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 171 | A, B = map(int, input().split())
if A == B:
print('Draw)
elif A == 1:
pirnt('Alice')
elif B == 1:
print('Bob')
elif A > B:
print('Alice')
else:
print('Bob') |
s351462250 | p03803 | u092387689 | 1588750956 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 438 | from itertools import permutations
n,m = map(int,input().split())
rel_t = [[False for i in range(n)] for j in range(n)]
for i in range(m):
a,b = map(int,input().split())
rel_t[a-1][b-1]=True
rel_t[b-1][a-1]=True
cnt=0
n_list = [i for i in range(n)]
for l in permutations(n_list,len(n_list)):
if(l[0]!=1):
continue
judge=[rel_t[l[i]][l[i+1]] for i in range(n-1)]
if all(judge):
cnt+=1
print(cnt) |
s102338520 | p03803 | u373304480 | 1588029684 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 463 | import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]
mc = n-m+1
tb = [[0]*mc]*mc
ans = False
for ai in range(0, mc):
if(ans):
break
ind = [m.start() for m in re.finditer(b[0], a[ai])]
for i in ind:
if(ans):
break
for bi in range(1, mc):
if(a[ai+bi][i:i+m] != b[bi]):
break
if(bi==mc-1):
ans = True
if(ans):
print('Yes')
else:
print('No') |
s958292928 | p03803 | u115877451 | 1588004934 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 323 | a,b = map(int,input().split())
if a != 1 and b != 1:
if a > b :
print("Alice")
elif a < b:
print("Bob")
else:
print("Draw")
elif a == 1 and b != 1:
print("Alice")
elif a != 1 and b == 1:
print("Bob")
else:
print("Draw") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.