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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s692870752 | p02261 | u637322311 | 1531748937 | Python | Python3 | py | Runtime Error | 0 | 0 | 1406 | import copy
def print_list(A):
print(*A, sep=" ")
def swap(a, b):
return b, a
def val(str):
return int(str[1])
def is_stable(_in, _out, n):
for i in range(0, n):
for j in range(i+1, n):
for a in range(0, n):
for b in range(a+1, n):
if val(_in[i... |
s680479326 | p02261 | u637322311 | 1531749111 | Python | Python3 | py | Runtime Error | 0 | 0 | 1406 | import copy
def print_list(A):
print(*A, sep=" ")
def swap(a, b):
return b, a
def val(str):
return int(str[1])
def is_stable(_in, _out, n):
for i in range(0, n):
for j in range(i+1, n):
for a in range(0, n):
for b in range(a+1, n):
if val(_in[i... |
s269496964 | p02261 | u313089641 | 1531758061 | Python | Python3 | py | Runtime Error | 0 | 0 | 1499 | _ = int(input())
l2 = list(map(int, input().split()))
class Card():
def __init__(self, card):
self.card = card
self.mark = card[0]
self.number = card[1]
def __lt__(self, other):
if not isinstance(other, Card):
return NotImplemented
return self.numbe... |
s288480625 | p02261 | u635209856 | 1541160299 | Python | Python3 | py | Runtime Error | 0 | 0 | 709 | def bubble(A):
flag=True;
n=len(A)
i=0
while flag:
for j in range(n-1,i,-1):
if A[j][1]<A[j-1][1]:
A[j],A[j-1]=A[j-1],A[j]
flag=True
i+=1
def selection(A):
n=len(A)
for i in range(n):
minj=i
for j in range(i,n):
... |
s071717059 | p02261 | u312681524 | 1546420457 | Python | Python | py | Runtime Error | 0 | 0 | 1203 | <?php
fscanf(STDIN, '%d', $N);
$line = trim(fgets(STDIN));
$arr = explode(' ', $line);
$bubbleArr = BubbleSort($arr,$N);
echo(implode(' ',$bubbleArr).PHP_EOL."Stable".PHP_EOL);
$selectionArr = SelectionSort($arr,$N);
echo implode(" ",$selectionArr) . PHP_EOL;
isStable($bubbleArr, $selectionArr);
function BubbleSort($... |
s502861917 | p02261 | u412294315 | 1559288406 | Python | Python3 | py | Runtime Error | 20 | 5624 | 1568 | class Sort():
def __init__(self,n,cards):
self.cards = cards
self.n = n
def bubble_sort(self):
# bubble sort
flag = 1
while flag != 0:
flag = 0
rev = list(range(1,self.n))
rev.reverse()
for j in rev:
if int(self.cards[j][1]) < int(self.cards[j-1][1]):
self.cards[j],self.cards[j-1] = se... |
s737804692 | p02261 | u567380442 | 1421308790 | Python | Python3 | py | Runtime Error | 0 | 0 | 928 | def compare_cards(a, b):
return a[1] < b[1]
def bubble(C):
for i in range(len(C)):
for j in range(len(C) - 1, i, -1):
if compare_cards(C[j], C[j - 1]):
C[j], C[j - 1] = C[j -1], C[j]
def selection(C):
for i in range(len(C)):
mini = i
for j in range(i, le... |
s287836713 | p02261 | u567380442 | 1421309382 | Python | Python3 | py | Runtime Error | 0 | 0 | 863 | def compare_cards(a, b):
return a[1] < b[1]
def bubble(C):
for i in range(len(C)):
for j in range(len(C) - 1, i, -1):
if compare_cards(C[j], C[j - 1]):
C[j], C[j - 1] = C[j -1], C[j]
def selection(C):
for i in range(len(C)):
mini = i
for... |
s429676893 | p02261 | u567380442 | 1421309475 | Python | Python3 | py | Runtime Error | 0 | 0 | 312 | def compare_cards(a, b):
return a[1] < b[1]
def bubble(C):
for i in range(len(C)):
for j in range(len(C) - 1, i, -1):
if compare_cards(C[j], C[j - 1]):
C[j], C[j - 1] = C[j -1], C[j]
N = int(input())
C = input().split()
bubbleC = C.copy()
bubble(bubbleC)
print(*C) |
s045058781 | p02261 | u567380442 | 1421309628 | Python | Python3 | py | Runtime Error | 0 | 0 | 338 | def compare_cards(a, b):
return a[1] < b[1]
def bubble(C):
for i in range(len(C)):
for j in range(len(C) - 1, i, -1):
if compare_cards(C[j], C[j - 1]):
C[j], C[j - 1] = C[j -1], C[j]
N = int(input())
C = input().split()
bubbleC = C.copy()
#bubble(bubbleC)
compare_cards(C[... |
s726938574 | p02261 | u567380442 | 1421309767 | Python | Python3 | py | Runtime Error | 0 | 0 | 152 | def compare_cards(a, b):
return int(a[1]) < int(b[1])
N = int(input())
C = input().split()
bubbleC = C.copy()
#compare_cards(C[0],C[1])
print(*C) |
s149223007 | p02261 | u313994256 | 1442293630 | Python | Python | py | Runtime Error | 0 | 0 | 749 | #??????????????????
N = int(raw_input())
num_list1 = raw_input().split()
num_list2 = num_list1
flag = 1
while flag==1:
flag =0
for j in range(N-1,0,-1):
if int(num_list1[j][1:]) < int(num_list1[j-1][1:]):
a = num_list1[j]
num_list1[j] = num_list1[j-1]
num_list1[j-1... |
s141648409 | p02261 | u885889402 | 1442293831 | Python | Python3 | py | Runtime Error | 0 | 0 | 1338 | def str_selection_sort(a,n):
m=0
for i in range(0,n):
minj=i
for j in range(i,n):
if(int(a[minj][1:]) > int(a[j][1:])):
minj=j
if(minj!=i):
m+=1
a[minj],a[i] = a[i],a[minj]
print(" ".join(a))
return a
def bubble_sort(a... |
s972219050 | p02261 | u885889402 | 1442293949 | Python | Python3 | py | Runtime Error | 0 | 0 | 1315 | def str_selection_sort(a,n):
m=0
for i in range(0,n):
minj=i
for j in range(i,n):
if(int(a[minj][1:]) > int(a[j][1:])):
minj=j
if(minj!=i):
m+=1
a[minj],a[i] = a[i],a[minj]
print(" ".join(a))
return a
def bubble_sort(a... |
s827990699 | p02261 | u885889402 | 1442294019 | Python | Python3 | py | Runtime Error | 0 | 0 | 1331 | def str_selection_sort(a,n):
m=0
for i in range(0,n):
minj=i
for j in range(i,n):
if(int(a[minj][1:]) > int(a[j][1:])):
minj=j
if(minj!=i):
m+=1
a[minj],a[i] = a[i],a[minj]
print(" ".join(a))
return a
def bubble_sort(a... |
s080634886 | p02261 | u496045719 | 1469603631 | Python | Python3 | py | Runtime Error | 0 | 0 | 1305 | STABLE = 'Stable'
UNSTABLE = 'Not stable'
def main():
card_num = int(input())
cards = input().split()
bubble_sorted = bubble_sort(cards, card_num)
select_sorted = select_sort(cards, card_num)
stability = True
for i, c in enumerate(select_sorted):
if c != bubble_sorted[i]:
stability = False
... |
s080043565 | p02261 | u390995924 | 1472572010 | Python | Python3 | py | Runtime Error | 0 | 0 | 622 | import copy
N = int(input())
bscs = [(int(c[-1]), c) for c in input().split(" ")]
sscs = copy.copy(bscs)
for i in range(N):
j = N - 1
while j > i:
if bscs[j][0] < bscs[j - 1][0]:
tmp = bscs[j]
bscs[j] = bscs[j - 1]
bscs[j - 1] = tmp
j -= 1
print(" ".join([c[1]... |
s312461867 | p02261 | u756595712 | 1474855285 | Python | Python3 | py | Runtime Error | 0 | 0 | 603 | length = int(input())
eles = [int(l) for l in input().split()]
is_stable = 'Stable'
import copy
_copy = copy.deepcopy(eles)
for i in range(length):
for j in range(length-1, 0, -1):
if _copy[j][1] < _copy[j-1][1]:
_copy[j], _copy[j-1] = _copy[j-1], _copy[j]
print(*_copy)
print(is_stable)
__co... |
s762224099 | p02261 | u918276501 | 1484820510 | Python | Python3 | py | Runtime Error | 0 | 0 | 654 | n = int(input())
lst = input().split()
bub, sel = [lst]*2
sls = []
for i in range(n):
m = i
li = lst[i][0]
if not li in sls:
sls.append(li)
for j in range(n-1,i,-1):
if bub[j] < bub[j-1]:
bub[j-1:j+1] = bub[j], bub[j-1]
for k in range(i, n):
if sel[k][1] < sel[k][... |
s991322285 | p02261 | u935329231 | 1485000990 | Python | Python3 | py | Runtime Error | 0 | 0 | 1428 | # -*- coding: utf-8 -*-
def bubble_sort(cards, num):
for left in range(num-1):
for right in range(left+1, num):
if cards[right][1] < cards[left][1]:
cards[left], cards[right] = cards[right], cards[left]
print(list_to_str(cards))
def selection_sort(cards, num):
for head... |
s127968561 | p02261 | u895660619 | 1487543006 | Python | Python3 | py | Runtime Error | 0 | 0 | 792 | N = int(input())
C = input().split()
B = C[:]
S = C[:]
# bubble sort
flag = 1
while(flag):
flag = 0
for x in (1, N):
if C[x][1:] < C[x-1][1:]:
C[x], C[x-1] = C[x-1], C[x]
flag = 1
# sectionSot
for x in range(0,N):
minj = x
for j in (x,n):
if S[j][1:] < S[minj]... |
s265365504 | p02261 | u148628801 | 1488960279 | Python | Python3 | py | Runtime Error | 0 | 0 | 600 | import sys
def bubble_sort(C, N):
for i in range(N):
for j in range(N - 1, i, -1):
if C[j][1] < C[j - 1][1]:
C[j], C[j - 1] = C[j - 1], C[j]
return C
def selection_sort(C, N):
for i in range(N):
minj = i
for j in range(i, N):
if C[j][1] < C[minj][1]:
minj = j
C[i], C[minj] = C[minj], C[... |
s699248270 | p02261 | u548155360 | 1489035667 | Python | Python3 | py | Runtime Error | 0 | 0 | 920 | def isStable(inlist, outlist):
for i in range(0, N):
for j in range(i+1, N):
for a in range(0, N):
for b in range(a+1, N):
if int(inlist[i][1:]) == int(inlist[j][1:]) && inlist[i] == outlist[b] && inlist[j] == outlist[a]:
return FALSE
break
else:
return TRUE
N = int(input())
A = input().... |
s753756268 | p02261 | u796784914 | 1492850806 | Python | Python | py | Runtime Error | 10 | 6452 | 1053 | N = input()
A = map(str,raw_input().split())
Ab = A[:]
As = A[:]
def BubbleSort(A,N):
for i in range(N):
flag = 0
for i in range(1,N):
j = N - i
if A[j][1] < A[j-1][1]:
v = A[j]
A[j] = A[j-1]
A[j-1] = v
flag = 1... |
s120107374 | p02261 | u782850499 | 1494744784 | Python | Python3 | py | Runtime Error | 0 | 0 | 1117 | def bubble_sort(num_list):
list_b = num_list[:]
for i in range(len(list_b)-1):
for j in range(len(list_b)-1,i,-1):
if list_b[j][1] < list_b[j-1][1]:
list_b[j],list_b[j-1] = list_b[j-1],list_b[j]
return list_b
def selection_sort(num_list):
list_s = num_list[:]
for... |
s028960900 | p02261 | u782850499 | 1494744958 | Python | Python3 | py | Runtime Error | 0 | 0 | 1120 | def bubble_sort(num_list):
list_b = num_list[:]
for i in range(len(list_b)-1):
for j in range(len(list_b)-1,i,-1):
if list_b[j][1] < list_b[j-1][1]:
list_b[j],list_b[j-1] = list_b[j-1],list_b[j]
return list_b
def selection_sort(num_list):
list_s = num_list[:]
fo... |
s790305692 | p02261 | u813534019 | 1497487853 | Python | Python | py | Runtime Error | 0 | 0 | 1459 | def buble(lst):
src_list = list(lst)
flag=True
while flag:
flag = False
for idx in range(len(lst)-1, 0, -1):
if int(lst[idx][1]) < int(lst[idx-1][1]):
flag_stable = True
for num in range(0, 9):
tmp1 = []
tmp2 = []
for i in range(0, len(lst)):
... |
s819986989 | p02261 | u747635679 | 1498536811 | Python | Python3 | py | Runtime Error | 0 | 0 | 559 | n = int(input())
a = input().split()
b = a
for i in range(n):
for j in range(i + 1, n):
if int(a[j - 1][1]) > int(a[j][1]):
tmp = a[j - 1]
a[j - 1] = a[j]
a[j] = tmp
ra = " ".join(a)
print(ra)
print("Stable")
for i in range(n - 1):
minj = i
for j in (i + 1, n)... |
s371848031 | p02261 | u760630500 | 1498817156 | Python | Python3 | py | Runtime Error | 0 | 0 | 816 |
def BubbleSort(N, C):
C = [] + C
for i in range(N):
for j in range(N-1, i, -1):
if C[j][1] < C[j-1][1]:
C[j], C[j-1] = C[j-1], C[j]
return C
def SelectionSort(N, C):
C = [] + C
for i in range(N):
minj = i
for j in range(i, N):
if C[mi... |
s175094731 | p02261 | u760630500 | 1498817220 | Python | Python3 | py | Runtime Error | 0 | 0 | 818 |
def BubbleSort(N, C):
C = [] + C
for i in range(N):
for j in range(N-1, i, -1):
if C[j][1] < C[j-1][1]:
C[j], C[j-1] = C[j-1], C[j]
return C
def SelectionSort(N, C):
C = [] + C
for i in range(N):
minj = i
for j in range(i, N):
if C[mi... |
s972306423 | p02261 | u735204496 | 1498980536 | Python | Python | py | Runtime Error | 0 | 0 | 1274 | import sys
class Card:
def __init__(self, num, kind):
self.kind = kind
self.num = num
def list_to_string(array):
s = ""
for n in array:
s += str(n) + " "
return s.strip()
def swap(array, i, j):
tmp = array[i]
array[i] = array[j]
array[j] = tmp
def is_stable(ar... |
s462779938 | p02261 | u735204496 | 1498980720 | Python | Python | py | Runtime Error | 0 | 0 | 1503 | import sys
class Card:
def __init__(self, kind, num):
self.kind = kind
self.num = num
def __eq__(self, other):
return (self.kind == other.kind) and (self.num == other.num)
def __ne__(self, other):
return not ((self.kind == other.kind) and (self.num == other.num))
d... |
s865290910 | p02261 | u914146430 | 1500715883 | Python | Python3 | py | Runtime Error | 0 | 0 | 719 | # bable sort
def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in range(len(nums)-1):
for j in range(len(nums)-1,i,-1):
if nums[j][1]<nums[j-1][1]:
nums[j],nums[j-1]=nums[j-1],nums[j]
return nums
# bable sort
def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in ran... |
s183721804 | p02261 | u914146430 | 1500716005 | Python | Python3 | py | Runtime Error | 0 | 0 | 719 | # bable sort
def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in range(len(nums)-1):
for j in range(len(nums)-1,i,-1):
if nums[j][1]<nums[j-1][1]:
nums[j],nums[j-1]=nums[j-1],nums[j]
return nums
# bable sort
def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in ran... |
s472088074 | p02261 | u914146430 | 1500716513 | Python | Python3 | py | Runtime Error | 0 | 0 | 711 | def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in range(len(nums)-1):
for j in range(len(nums)-1,i,-1):
if nums[j][1]<nums[j-1][1]:
nums[j],nums[j-1]=nums[j-1],nums[j]
return nums
def bubbleSort(o_nums, n):
nums=o_nums[:]
for i in range(len(nums)-1):
f... |
s456642745 | p02261 | u153665391 | 1504878673 | Python | Python3 | py | Runtime Error | 0 | 0 | 1157 | n = int(input())
a = list(input().split())
A = []
A1 = []
A2 = []
for i in a:
A.append(list(i))
A1.append(list(i))
A2.append(list(i))
# check stable or not
def is_stable(A3):
for i in range( 1, n ):
if int(A3[i-1][1]) == int(A3[i][1]):
sm = i-1
bg = i
for j ... |
s270222431 | p02261 | u024715419 | 1507276252 | Python | Python3 | py | Runtime Error | 0 | 0 | 463 | n = int(input())
a = input().split()
b = a[:]
while flag:
flag = 0
for i in range(n-1):
if a[i][1] > a[i+1][1]:
a[i][1], a[i+1][1] = a[i+1][1], a[i][1]
flag = 1
print(*a)
print("Stable")
for i in range(n-1):
min_j = i
for j in range(i,n):
if b[j][1] < b[min_j][1... |
s890607117 | p02261 | u024715419 | 1507276328 | Python | Python3 | py | Runtime Error | 0 | 0 | 463 | n = int(input())
a = input().split()
b = a[:]
while flag:
flag = 0
for i in range(n-1):
if a[i][1] > a[i+1][1]:
a[i][1], a[i+1][1] = a[i+1][1], a[i][1]
flag = 1
print(*a)
print("Stable")
for i in range(n-1):
min_j = i
for j in range(i,n):
if b[j][1] < b[min_j][1... |
s852320074 | p02261 | u626266743 | 1510058822 | Python | Python3 | py | Runtime Error | 0 | 0 | 441 | N = int(input())
C = input().split()
_C = C.copy()
for i in range(N):
for j in range(N-1, i, -1):
if (C[j][1] < C[j-1][1]):
C[j][1], C[j-1][1] = C[j-1][1], C[j][1]
print(*C)
print("Stable")
for j in range(N):
m = i
for j in range(i, N):
if (_C[j][1] < _C[j-1][1]):
m... |
s711796543 | p02261 | u150984829 | 1516473360 | Python | Python3 | py | Runtime Error | 0 | 0 | 278 | n=int(input())
c=input().split();d=c[:]
for i in range(n-1):
for j in range(0,n-i-1):
if c[j][1]>c[j+1][1]:c[j],c[j+1]=c[j+1],c[j]
m=i
for j in range(i,n):
if b[m][1]>b[j][1]:m=j
d[i],d[m]=d[m],d[i]
print(*c);print("Stable")
print(*d)
print(['Not s','S'][b==s]+'table')
|
s503962094 | p02261 | u150984829 | 1516473393 | Python | Python3 | py | Runtime Error | 0 | 0 | 278 | n=int(input())
c=input().split();d=c[:]
for i in range(n-1):
for j in range(0,n-i-1):
if c[j][1]>c[j+1][1]:c[j],c[j+1]=c[j+1],c[j]
m=i
for j in range(i,n):
if d[m][1]>d[j][1]:m=j
d[i],d[m]=d[m],d[i]
print(*c);print("Stable")
print(*d)
print(['Not s','S'][b==s]+'table')
|
s039214989 | p02261 | u996463517 | 1518224244 | Python | Python3 | py | Runtime Error | 0 | 0 | 614 | a = int(input())
B = input().split()
print(bubble(a,B))
print("Stable")
print(selection(a,B))
if bubble(a,B) == selection(a,B):
print("Stable")
else:
print("Not stable")
def selection(n,A):
for i in range(n):
minj = i
for j in range(i,n):
if int(A[j][1]) < int(A[minj][1]):
... |
s233816414 | p02261 | u933096856 | 1518590426 | Python | Python3 | py | Runtime Error | 0 | 0 | 469 | n=int(input())
l=input().split()
def BubbleSort(c):
for i in range(len(c)-1):
for j in range(len(c)-1, i, -1):
if int(c[j][-1]) < int(c[j-1][-1]):
c[j], c[j-1]=c[j-1],c[j]
return c
def SelectionSort(C):
for i in range(len(c)-1):
m=i
for j in range(i, len... |
s815504800 | p02261 | u933096856 | 1518590451 | Python | Python3 | py | Runtime Error | 0 | 0 | 470 | n=int(input())
l=input().split()
def BubbleSort(c):
for i in range(len(c)-1):
for j in range(len(c)-1, i, -1):
if int(c[j][-1]) < int(c[j-1][-1]):
c[j], c[j-1]=c[j-1],c[j]
return c
def SelectionSort(C):
for i in range(len(c)-1):
m=i
for j in range(i, len... |
s369259326 | p02261 | u933096856 | 1518607376 | Python | Python | py | Runtime Error | 0 | 0 | 575 | n=raw_int(input())
r=raw_input().split()
def BubbleSort(c, n):
for i in range(n):
for j in range(n-1, i, -1):
if int(c[j][-1]) < int(c[j-1][-1]):
c[j], c[j-1]=c[j-1],c[j]
return c
def SelectionSort(c, n):
for i in range(n):
m=i
for j in range(i, n):
... |
s575552612 | p02261 | u933096856 | 1518607395 | Python | Python | py | Runtime Error | 0 | 0 | 575 | n=int(raw_input())
r=raw_input().split()
def BubbleSort(c, n):
for i in range(n):
for j in range(n-1, i, -1):
if int(c[j][-1]) < int(c[j-1][-1]):
c[j], c[j-1]=c[j-1],c[j]
return c
def SelectionSort(c, n):
for i in range(n):
m=i
for j in range(i, n):
... |
s782099167 | p02261 | u906360845 | 1520702778 | Python | Python3 | py | Runtime Error | 0 | 0 | 724 | n = input()
nums = input()
nums = nums.split()
print(' '.join(map(str, nums)))
def bubble_sort(c, n):
for i in range(n-1):
for j in range(n-1):
if c[j] > c[j+1]:
c[j], c[j+1] = c[j+1], c[j]
return c
def selection_sort(c, n):
for i in range((n):
mink = i
... |
s292603628 | p02261 | u613534067 | 1521354725 | Python | Python3 | py | Runtime Error | 0 | 0 | 1319 | # Quick Sort #
# 安定かどうかの判定の計算量を減らすことができなかったので,悪いことをした...
def partition(A, p, r):
x = A[r][1]
i = p-1
for k in range(p, r):
if A[k][1] <= x:
i += 1
A[i], A[k] = A[k], A[i]
A[i+1], A[r] = A[r], A[i+1]
return i+1
def quick_sort(A, p, r):
if p < r:
q = partit... |
s845960800 | p02261 | u464859367 | 1522463985 | Python | Python3 | py | Runtime Error | 0 | 0 | 1292 | import re
import copy
pattern = r'([0-9])'
repatter = re.compile(pattern)
n = str(input())
text = input()
*lists, = text.split(" ")
lists2 = copy.copy(lists)
lists3 = copy.copy(lists)
# バブルソート
def bubble_sort(a):
flag = 1
i = 0
while flag:
flag = 0
for j in range(n-1, i, -1):
... |
s499628205 | p02261 | u308033440 | 1526012545 | Python | Python3 | py | Runtime Error | 0 | 0 | 1606 | # #バブルソート
# def BubbleSort(C,N):
# for i in range (0,N,1):
# for j in range(N-1,i-1,-1):
# if int(C[j][1:2]) < int(C[j-1][1:2]):
# tmp = C[j]
# C[j] = C[j-1]
# C[j-1] = tmp
# print(' '.join(C))
#バブルソート
def BubbleSort(C,N):
flag = 1
whi... |
s345785444 | p02261 | u308033440 | 1526012576 | Python | Python3 | py | Runtime Error | 0 | 0 | 1323 | #バブルソート
def BubbleSort(C,N):
flag = 1
while flag:
flag = 0
for j in range(N-1,0,-1):
if int(C[j][1:2]) < int(C[j-1][1:2]):
tmp = C[j]
C[j] = C[j-1]
C[j-1] = tmp
flag = 1
print(' '.join(C))
... |
s857219389 | p02261 | u356729014 | 1528433430 | Python | Python3 | py | Runtime Error | 0 | 0 | 1731 | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"reflect"
)
var sc = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdout)
func nextInt() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
type Card struct {
mark string
number int
}
func nextCard() Card... |
s754432796 | p02261 | u298224238 | 1529386472 | Python | Python3 | py | Runtime Error | 0 | 0 | 1564 | class Card:
def __init__(self, mark, value):
self.mark = mark
self.value = value
def __eq__(self, other):
if not isinstance(other, Card):
return NotImplemented
return self.value == other.value and self.mark == other.mark
def __lt__(self, other):
return s... |
s391848830 | p02261 | u298224238 | 1529386506 | Python | Python3 | py | Runtime Error | 0 | 0 | 1575 | class Card:
def __init__(self, mark, value):
self.mark = mark
self.value = value
def __eq__(self, other):
if not isinstance(other, Card):
return NotImplemented
return self.value == other.value and self.mark == other.mark
def __lt__(self, other):
return s... |
s812307435 | p02261 | u677291728 | 1530604483 | Python | Python3 | py | Runtime Error | 0 | 0 | 1040 | def bubble(A):
flag = True
n = len(A)
i = 0
while flag:
flag = False
for j in range(n-1,i,-1):
if A[j][1] < A[j-1][1]:
A[j],A[j-1] = A[j-1],A[j]
flag = True
i += 1
def selection(A):
n = len(A)
for i in range(n):
minj = ... |
s027463483 | p02261 | u677291728 | 1530604582 | Python | Python3 | py | Runtime Error | 0 | 0 | 1033 | def bubble(A):
flag = True
n = len(A)
i = 0
while flag:
flag = False
for j in range(n-1,i,-1):
if A[j][1] < A[j-1][1]:
A[j],A[j-1] = A[j-1],A[j]
flag = True
i += 1
def selection(A):
n = len(A)
for i in range(n):
minj = ... |
s113504799 | p02261 | u677291728 | 1530604699 | Python | Python3 | py | Runtime Error | 0 | 0 | 1033 | def bubble(A):
flag = True
n = len(A)
i = 0
while flag:
flag = False
for j in range(n-1,i,-1):
if A[j][1] < A[j-1][1]:
A[j],A[j-1] = A[j-1],A[j]
flag = True
i += 1
def selection(A):
n = len(A)
for i in range(n):
minj = ... |
s842847978 | p02261 | u922633376 | 1530671432 | Python | Python3 | py | Runtime Error | 0 | 0 | 5106 | Last login: Thu Jun 28 18:57:04 on ttys001
fujitaryuuki-no-MacBook-Pro:~ fujitaryuki$ ls
Applications
Applications (Parallels)
Desktop
Documents
Downloads
KUT Master
Library
Logicool ゲームソフトウェア 8.82.lnk
Movies
Music
Pictures
Public
PythonStudy
Windows 10
eclipse
matsuzaki-lab
tenhou
wget
就活
fujitaryuuki-no-MacBook-Pro:~... |
s464855727 | p02261 | u922633376 | 1530671560 | Python | Python3 | py | Runtime Error | 0 | 0 | 795 | input_line = int(input())
out_selection = input().split()
out_bubble = out_bubble[:]
# bubblesort
for i in range(n):
for j in range(n-1, i, -1):
if out_bubble[j][1] < out_bubble[j-1][1]:
out_bubble[j], out_bubble[... |
s501210889 | p02261 | u922633376 | 1530671905 | Python | Python3 | py | Runtime Error | 0 | 0 | 795 | input_line = int(input())
out_selection = input().split()
out_bubble = out_bubble[:]
# bubblesort
for i in range(n):
for j in range(n-1, i, -1):
if out_bubble[j][1] < out_bubble[j-1][1]:
out_bubble[j], out_bubble[... |
s124736143 | p02261 | u782850731 | 1379686838 | Python | Python | py | Runtime Error | 0 | 0 | 1118 | #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
def bubble(cards):
for i in range(len(cards)):
for j in range(len(cards)-1, i, -1):
if cards[j][1] < cards[j-1][1]:
cards[j], cards[j-1] = cards[j-1], cards[j]
def selection(cards):
... |
s176057408 | p02261 | u140201022 | 1389651306 | Python | Python | py | Runtime Error | 0 | 0 | 1153 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
def bubble(cards):
for i in range(len(cards)):
for j in range(len(cards)-1, i, -1):
if cards[j][1]<cards[j-1][1]:
cards[... |
s097344607 | p02262 | u427752990 | 1535598565 | Python | Python3 | py | Runtime Error | 0 | 0 | 704 | def printing(m, G, cnt, A):
print(m)
for i in range(len(G)):
if i != len(G) - 1:
print(G[i], end=' ')
else:
print(G[i])
print(cnt)
for i in A:
print(i)
def insertionSort(A, n, g, cnt):
for i in range(g, n):
v = A[i]
j = i - g
... |
s057736993 | p02262 | u635209856 | 1541240797 | Python | Python3 | py | Runtime Error | 0 | 0 | 621 | import System
if sys.version_info[0]>=3: raw_input=InputStream
def insertionSort(a,g):
global cnt
for i in range(g,len(a)):
v=a[i]
j=i-g
while j>=0 and a[j]>v:
a[j+g]=a[j]
j=j-g
cnt+=1
a[j+g]=v
def shellSort(a):
global cnt
cnt=0
... |
s404443071 | p02262 | u099826363 | 1546005803 | Python | Python3 | py | Runtime Error | 0 | 0 | 986 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll cnt = 0;
void swap(int& a, int& b){
int tmp = a;
a = b;
b = tmp;
}
void insertionSort(int A[], int n, int g) {
for(int i=g;i<n;i++){
int v = A[i];
int j = i - g;
// cout << "g=" << g << "i=" << i << "j=" << j << endl;
while( j>= 0 && ... |
s190014655 | p02262 | u908238078 | 1546487915 | Python | Python3 | py | Runtime Error | 0 | 0 | 939 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void insertionSort(int A[], int n, int g) {
for (int i = g; i < n; i++) {
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v) {
... |
s565929638 | p02262 | u840247626 | 1556033535 | Python | Python3 | py | Runtime Error | 20 | 5620 | 385 | n = int(input())
G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
while True:
g = int(2.25 * G[-1])
if g > n:
break
G.append(g)
G.reverse()
A = [int(input()) for _ in range(n)]
cnt = 0
for g in G:
for j, v in enumerate(A[g:]):
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j -= g
cnt += 1
A[j+... |
s561786327 | p02262 | u840247626 | 1556034095 | Python | Python3 | py | Runtime Error | 0 | 0 | 410 | n = int(input())
if n == 1:
G = [1]
else:
G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
while True:
g = int(2.25 * G[-1])
if g > n:
break
G.append(g)
G.reverse()
A = [int(input()) for _ in range(n)]
cnt = 0
for g in G:
for j, v in enumerate(A[g:]):
while j >= 0 and A[j] > v:
A[j+g] = ... |
s126319962 | p02262 | u840247626 | 1556034117 | Python | Python3 | py | Runtime Error | 0 | 0 | 410 | n = int(input())
if n == 1:
G = [1]
else:
G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
while True:
g = int(2.25 * G[-1])
if g > n:
break
G.append(g)
G.reverse()
A = [int(input()) for _ in range(n)]
cnt = 0
for g in G:
for j, v in enumerate(A[g:]):
while j >= 0 and A[j] > v:
A[j+g] = ... |
s932986131 | p02262 | u286589639 | 1556421282 | Python | Python3 | py | Runtime Error | 0 | 0 | 497 | def insertion_sort(A ,N, g):
grobal cnt
for i in range(g, N):
v = A[i]
j = i - g
while j>=0 and A[j]>v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shell_sort(A, N):
grobal cnt
cnt = 0
G = []
h = 1
while h<=len(A):
G.append(h)
h = 3*h+1
G.reverse()
m = len(G)
print(m)
print(' '.jo... |
s510707291 | p02262 | u535719732 | 1559410408 | Python | Python3 | py | Runtime Error | 0 | 0 | 571 | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
def insertion_sort(datan,n,g):
cnt = 0
for i in range(g,n):
v = data[i]
j = i - g
while j >= 0 and data[j] > v:
data[j+g] = data[j]
j = j - g
cnt += 1
data[j+g] = v
retu... |
s423362647 | p02262 | u482227082 | 1559453767 | Python | Python3 | py | Runtime Error | 0 | 0 | 828 | def insertionSort(A, n, g, cnt):
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return cnt
def shellSort(A, n):
cnt = 0
G = []
if n <= 3:
m = 1:
G[... |
s454409727 | p02262 | u482227082 | 1559453797 | Python | Python3 | py | Runtime Error | 20 | 5608 | 827 | def insertionSort(A, n, g, cnt):
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return cnt
def shellSort(A, n):
cnt = 0
G = []
if n <= 3:
m = 1
G[0... |
s775058603 | p02262 | u535719732 | 1559489036 | Python | Python3 | py | Runtime Error | 0 | 0 | 682 | def shell_sort(array):
n = len(array)
h = 0
k = 0
cnt = 0
g = []
while h <= n/9:
h = 3*h + 1
g.append = h
while g[k] > 0:
for i in range(h,n):
tmp = array[i]
if tmp < array[i-g[k]]:
j = i
while True:
... |
s932047761 | p02262 | u535719732 | 1559489077 | Python | Python3 | py | Runtime Error | 0 | 0 | 681 | def shell_sort(array):
n = len(array)
h = 0
k = 0
cnt = 0
g = []
while h <= n/9:
h = 3*h + 1
g.append = h
while g[k] > 0:
for i in range(h,n):
tmp = array[i]
if tmp < array[i-g[k]]:
j = i
while True:
... |
s054000585 | p02262 | u535719732 | 1559489092 | Python | Python3 | py | Runtime Error | 0 | 0 | 680 | def shell_sort(array):
n = len(array)
h = 0
k = 0
cnt = 0
g = []
while h <= n/9:
h = 3*h + 1
g.append(h)
while g[k] > 0:
for i in range(h,n):
tmp = array[i]
if tmp < array[i-g[k]]:
j = i
while True:
... |
s231359879 | p02262 | u535719732 | 1559536526 | Python | Python3 | py | Runtime Error | 0 | 0 | 466 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(*G)
for i in ran... |
s633921540 | p02262 | u535719732 | 1559536967 | Python | Python3 | py | Runtime Error | 0 | 0 | 484 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(" ".join(map(str,... |
s496059193 | p02262 | u535719732 | 1559537046 | Python | Python3 | py | Runtime Error | 0 | 0 | 484 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(" ".join(map(int,... |
s302153037 | p02262 | u535719732 | 1559537070 | Python | Python3 | py | Runtime Error | 0 | 0 | 466 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(*G)
for i in ran... |
s393580999 | p02262 | u535719732 | 1559537446 | Python | Python3 | py | Runtime Error | 0 | 0 | 489 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(" ".join(map(str,... |
s463634742 | p02262 | u535719732 | 1559537483 | Python | Python3 | py | Runtime Error | 0 | 0 | 496 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9):
h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print(len(G))
print(" ".join(map... |
s759915886 | p02262 | u535719732 | 1559537570 | Python | Python3 | py | Runtime Error | 0 | 0 | 499 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print("-----")
print(len(G))
print(" "... |
s246833138 | p02262 | u535719732 | 1559537594 | Python | Python3 | py | Runtime Error | 0 | 0 | 504 | def insertionSort(A,n,g):
cnt = 0
for i in range(int(g),n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellsort(A,n):
cnt = 0
h = 0
while(h <= n / 9): h = 3*h + 1
G = []
while h > 0:
G.append(h)
h /= 3
print("-----")
print(len(G))
prin... |
s534923542 | p02262 | u535719732 | 1559538098 | Python | Python3 | py | Runtime Error | 0 | 0 | 767 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return ... |
s682972977 | p02262 | u535719732 | 1559538149 | Python | Python3 | py | Runtime Error | 0 | 0 | 662 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return cnt
def shellsort(A,n):
cnt = 0
... |
s636021132 | p02262 | u535719732 | 1559538233 | Python | Python3 | py | Runtime Error | 0 | 0 | 667 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return cnt
def shellsort(A,n):
cnt = 0
... |
s442703723 | p02262 | u535719732 | 1559538255 | Python | Python3 | py | Runtime Error | 0 | 0 | 668 | def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return cnt
def shellsort(A,n):
cnt = 0
... |
s841019775 | p02262 | u379499530 | 1415372879 | Python | Python | py | Runtime Error | 0 | 0 | 594 | def insertion(A, n, g):
c = 0
for i in range(g, n):
key = A[i]
j = i - g
while j >= 0 and A[j] > key:
A[j + g] = A[j]
j -= g
c += 1
A[j + g] = key
return c
def main():
n = input()
A = [input() for i in range(n)]
h = range(n - 1... |
s059755475 | p02262 | u379499530 | 1415415151 | Python | Python | py | Runtime Error | 19930 | 67884 | 568 | def insertion(A, n, g):
c = 0
for i in range(g, n):
key = A[i]
j = i - g
while j >= 0 and A[j] > key:
A[j + g] = A[j]
j -= g
c += 1
A[j + g] = key
return c
def main():
n = input()
A = [input() for i in range(n)]
G = [1]
h ... |
s691474256 | p02262 | u379499530 | 1415436323 | Python | Python | py | Runtime Error | 0 | 0 | 548 | def insertion(A, n, g):
c = 0
for i in range(g, n):
key = A[i]
j = i - g
while j >= 0 and A[j] > key:
A[j + g] = A[j]
j -= g
c += 1
A[j + g] = key
return c
def main():
n = input()
A = [input() for i in range(n)]
G = list()
... |
s780827084 | p02262 | u379499530 | 1415436367 | Python | Python | py | Runtime Error | 19930 | 67884 | 550 | def insertion(A, n, g):
c = 0
for i in range(g, n):
key = A[i]
j = i - g
while j >= 0 and A[j] > key:
A[j + g] = A[j]
j -= g
c += 1
A[j + g] = key
return c
def main():
n = input()
A = [input() for i in range(n)]
G = list()
... |
s375972186 | p02262 | u379499530 | 1415439328 | Python | Python | py | Runtime Error | 19930 | 67880 | 529 | def insertion(A, n, g):
c = 0
for i in range(g, n):
j = i - g
while j >= 0 and A[j] > A[j + g]:
A[j + g], A[j] = A[j], A[j + g]
j -= g
c += 1
return c
def main():
n = input()
A = [input() for i in range(n)]
G = list()
h = 1
while h <=... |
s523926878 | p02262 | u379499530 | 1415439789 | Python | Python | py | Runtime Error | 19930 | 67876 | 511 | def insertion(A, n, g):
c = 0
for i in range(g, n):
while i >= g and A[i - g] > A[i]:
A[i], A[i - g] = A[i - g], A[i]
i -= g
c += 1
return c
def main():
n = input()
A = [input() for i in range(n)]
G = list()
h = 1
while h <= n:
G[0:0]... |
s903893176 | p02262 | u379499530 | 1415440533 | Python | Python | py | Runtime Error | 19930 | 75688 | 544 | def insertion(A, n, g):
c = 0
for i in range(g, n):
while i >= g and A[i - g] > A[i]:
A[i], A[i - g] = A[i - g], A[i]
i -= g
c += 1
return c
def main():
n = int(raw_input())
A = [int(raw_input()) for i in range(n)]
G = list()
h = 1
while h <=... |
s913889741 | p02262 | u379499530 | 1415441236 | Python | Python | py | Runtime Error | 19930 | 75692 | 546 | def insertion(A, n, g):
global cnt
for i in range(g, n):
while i >= g and A[i - g] > A[i]:
A[i], A[i - g] = A[i - g], A[i]
i -= g
cnt += 1
def main():
global cnt
cnt = 0
n = int(raw_input())
A = [int(raw_input()) for i in range(n)]
G = list()
... |
s532298659 | p02262 | u567380442 | 1421314363 | Python | Python3 | py | Runtime Error | 19930 | 47308 | 590 | def insertionSort(A, g):
cnt = 0
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
return cnt
def shellSort(A):
cnt = 0
m = 0
n = len(A)
while n:
... |
s659355545 | p02262 | u567380442 | 1421314924 | Python | Python3 | py | Runtime Error | 19930 | 46920 | 688 | def insertionSort(A, g):
cnt = 0
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
return cnt
def shellSort(A):
cnt = 0
m = 0
n = len(A)
while n:
... |
s461914114 | p02262 | u567380442 | 1421315638 | Python | Python3 | py | Runtime Error | 19930 | 47308 | 591 | def insertionSort(A, g):
global cnt
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
def shellSort(A):
global cnt
cnt = 0
m = 0
n = len(A)
while n:
... |
s009473172 | p02262 | u567380442 | 1421318686 | Python | Python3 | py | Runtime Error | 19930 | 47316 | 604 | def insertionSort(A, g):
global cnt
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
def shellSort(A):
global cnt
cnt = 0
h = 1
G = []
while h <= ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.