output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
Print the maximum value of f. * * *
s011135954
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
print(-int(input())+sum(int(i) for i in input().split())))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s225515924
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
print(sum(i - 1 for i in map(int, open(0).read().split())[1:]))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s008035295
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
7 994 518 941 851 647 2 581
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s639515328
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = input() a = list(map(int, input().split())) fmax = 0 for i in range(sum(a)): f = 0 for j in range(n): f += i % a[j] if f > fmax: fmax = f print(fmax)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s069104830
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
import sys sys.setrecursionlimit(1000000) # def input(): # return sys.stdin.readline()[:-1] """ n=int(input()) for i in range(n): a[i]=int(input()) a[i],b[i]=map(int,input().split()) a=[int(x) for x in input().split()] n,m=map(int,input.split()) """ test_data1 = """\ A??C """ test_data2 = """\ ACACAC """ test_data3 = """\ 7 994 518 941 851 647 2 581 """ test_data4 = """\ ?AC?AC """ td_num = 3 def GetTestData(index): if index == 1: return test_data1 if index == 2: return test_data2 if index == 3: return test_data3 if index == 4: return test_data4 if False: with open("../test.txt", mode="w") as f: f.write(GetTestData(td_num)) with open("../test.txt") as f: # Start Input code --------------------------------------- n = int(f.readline()) a = [int(x) for x in f.readline().split()] # End Input code --------------------------------------- else: # Start Input code --------------------------------------- n = int(input()) a = [int(x) for x in input().split()] # End Input code --------------------------------------- # print(n,a,sum(a)-n) print(sum(a) - n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s294510314
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
# def gcd(a, b): # while b: # a, b = b, a % b # return a # def lcm(a, b): # return a * b // gcd (a, b) # def f(m, input): # r = 0 # for i in input: # r += m % i # return r N = map(int, input()) a_n = list(map(int, input().split(" "))) # a_n = sorted(a_n) max = 0 for x in a_n: max += x # result = [] # for m in range(max): # out = f(m, a_n) # result.append(out) # re = sorted(result) # print(re[-1]) # print(max) #994 518 941 851 647 2 581 -> 4534 print(max - len(a_n))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s209127115
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
# 高橋君!の問題について # したのコードでTLEになってしまうのは、もうPythonの限界なのか、 # 無駄なプロセスがあるのかどうかを聞く。 H, W = map(int, input().split()) mp = [list(input()) for _ in range(H)] for i in range(H): for j in range(W): if mp[i][j] == "s": start = (i, j) elif mp[i][j] == "g": goal = (i, j) dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)] import queue from collections import defaultdict q = queue.Queue() d = defaultdict() q.put(start) while not q.empty(): now = q.get() if not now in d.keys(): d[now] = 0 for dx, dy in dxy: n_0 = now[0] + dx n_1 = now[1] + dy # すでに行っていたとしても、塀をより壊していない # ルートなら採用するべき if (n_0, n_1) in set(d.keys()): if mp[n_0][n_1] == "#": if d[(n_0, n_1)] > d[now] + 1: q.put((n_0, n_1)) d[(n_0, n_1)] = d[now] + 1 else: if d[(n_0, n_1)] > d[now]: q.put((n_0, n_1)) d[(n_0, n_1)] = d[now] else: # 初めてのルート if 0 <= n_0 < H and 0 <= n_1 < W: if mp[n_0][n_1] == "g": print("YES") exit(0) elif mp[n_0][n_1] == "#": if d[now] < 2: q.put((n_0, n_1)) d[(n_0, n_1)] = d[now] + 1 else: q.put((n_0, n_1)) d[(n_0, n_1)] = d[now] print("NO")
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s486284985
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) N = int(input()) A = list(map(int, input().split())) #N = 7 #A = [994, 518, 941, 851, 647, 2, 581] t = A[0] for i in range(1,N): if (t % A[i]) continue t = t * A[i] / gcd(t, A[i]) sum = 0 t -= 1 for i in range(N): sum += t % A[i] print(int(sum))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s987203252
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
from functools import reduce n = int(input()) a = list(map(int, input().split())) def gcd(x, y): try: if y == 0: return x return gcd(y, x % y) def gcd2(number): return reduce(gcd, number) def lcm(x, y): return x * y // gcd(x, y) def lcm2(number): return reduce(lcm, number) m = lcm2(a) - 1 #print(m) ans = 0 for i in range(n): ans += m % a[i] print(ans)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s030552471
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
a = input() ans = 0 a = [int(i) for i in input().split()] for num in a: ans += num - 1 print(ans)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s755127871
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
input() ans = 0 a = [int(i) for i in input().split()] for num in a: ans += num - 1 print(ans)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s398550507
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
import sys readline = sys.stdin.readline n = int(readline()) print(sum([int(i) for i in readline().split()] - n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s429035839
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
# ans N = int(input()) a = list(map(int, input().split())) print(sum(a)=N)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s354239517
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n=int(input()) da=list(map((int,input().split())) ans=0 for i in da: ans+=i-1 print(ans)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s102652696
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = int(input()) a = list(map(int,input().split()) print(sum(a)-n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s318359820
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = int(input()) s = 0 x = [s += int(i) for i in input().split()] print(s - n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s330587752
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
print(-int(input()) + sum(map(input().split(), int)))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s655650036
Wrong Answer
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
print(sum(map(lambda x: x - 1, list(map(int, input().split())))))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s076778064
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
I = int(input()) B = 0 count = 0 A = list(map(int, input().split())) for i in range(I): B += A[count] - 1 count += 1 print(str(B))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s088893304
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
import math class Sieve: """Sieve of Eratosthenes. List primes up to n. """ def __init__(self, n): self.__prime = [] self.__is_prime = [i >= 2 for i in range(n + 1)] for i in range(2, int(math.sqrt(n)) + 1): if self.__is_prime[i]: for j in range(i * i, n + 1, i): self.__is_prime[j] = False for i in range(2, n + 1): if self.__is_prime[i]: self.__prime.append(i) def prime(self): return self.__prime def is_prime(self, n): return self.__is_prime[n] def bf(N, a): p = Sieve(max(a) + 1).prime() # len <= 9952 prime_to_power = {} for prime in p: prime_to_power[prime] = 0 for i in range(N): ai = a[i] for prime in p: power = 0 while ai % prime == 0: ai //= prime power += 1 prime_to_power[prime] = max(prime_to_power[prime], power) lcm = 1 for prime in prime_to_power: lcm *= prime ** prime_to_power[prime] m = lcm - 1 ans = 0 for ai in a: ans += m % ai return ans def al(N, a): return sum(a) - len(a) if __name__ == "__main__": N = int(input()) # 2 <= N <= 3000 a = list(map(int, input().split())) # 2 <= ai <= 100000 # print(bf(N, a)) print(al(N, a))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the amout of the debt in a line.
s500069658
Wrong Answer
p00007
An integer n (0 ≤ n ≤ 100) is given in a line.
print(int(round(100000 * (1.05 ** int(input())), -4)), end="\n")
Debt Hell Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks.
[{"input": "", "output": "0"}]
Print the amout of the debt in a line.
s556274501
Wrong Answer
p00007
An integer n (0 ≤ n ≤ 100) is given in a line.
while True: try: print(int(round(100000 * (1.05 ** int(input())), -4))) except EOFError: break
Debt Hell Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks.
[{"input": "", "output": "0"}]
Print the amout of the debt in a line.
s720077538
Wrong Answer
p00007
An integer n (0 ≤ n ≤ 100) is given in a line.
s = int(input()) print(int(100000 + 100000 * (0.05 * s) + 1000 * s))
Debt Hell Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks.
[{"input": "", "output": "0"}]
Print the amout of the debt in a line.
s153976756
Accepted
p00007
An integer n (0 ≤ n ≤ 100) is given in a line.
import sys for num in sys.stdin: ini = 100000 num = int(num) for i in range(1, num + 1): ini = ini + ini * 0.05 mod = ini % 1000 ini = ini - mod if mod != 0: ini += 1000 ini = int(ini) print(ini)
Debt Hell Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks.
[{"input": "", "output": "0"}]
Print the lexicographically smallest string that Iroha can produce. * * *
s572945205
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
#!usr/bin/env python3 from collections import defaultdict from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return list(map(list, sys.stdin.readline().split())) def S(): return list(sys.stdin.readline())[:-1] def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] mod = 1000000007 # A """ a = LI() i = a.count(5) j = a.count(7) if i == 2 and j == 1: print("YES") else: print("NO") """ # B n, l = LI() s = SR(n) s.sort() for i in s: print(i, end="") print() # C """ def check(n): n = list(map(int,list(str(n)))) s = 0 for i in n: s += f[i] return s == 0 n,k = LI() d = LI() f = [0 for i in range(10)] for i in d: f[i] = 1 while 1: if check(n): print(n) quit() n += 1 """ # D """ def f(x,y): return fact[x-1+h-y]*fact[y-1+w-x]*inv_fact[x-1]*inv_fact[y-1]*inv_fact[w-x]*inv_fact[h-y]%mod h,w,a,b = LI() fact = [1]*(h+w+1) for i in range(h+w): fact[i+1] = fact[i]*(i+1)%mod inv_fact = [0]*(h+w+1) inv_fact[h+w] = pow(fact[-1],mod-2,mod) for i in range(h+w)[::-1]: inv_fact[i] = inv_fact[i+1]*(i+1)%mod ans = 0 for i in range(1,min(w-b,h-a)+1): ans += f(b+i,a+i) ans %= mod print(ans) """ # E # F # G # H # I # J # K # L # M # N # O # P # Q # R # S # T
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s152784445
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
import sys lines = sys.stdin.readlines() strings = [] max_len = 0 for n, line in enumerate(lines): if n == 0: N, L = [int(_) for _ in line.strip().split(" ")] continue max_len = max([max_len, len(line.strip())]) strings.append([ord(_) - 97 for _ in line.strip()]) def append(source, target): global max_len # print('begin:', end='') # print(source, target) min_idx = -1 check_idx = [_ for _ in range(max_len)] new_check_idx = [] for digit in range(max_len): s_head_min = 26 for n, s in enumerate(source): if not n in check_idx: continue # print('digit:{}, check_idx:{}'.format(digit, check_idx)) if s_head_min > s[digit]: s_head_min = s[digit] min_idx = n elif s_head_min == s[digit]: new_check_idx.append(min_idx) new_check_idx.append(n) if not len(new_check_idx): # print('Break!') # print(new_check_idx) break # print('new_check!') check_idx = new_check_idx new_check_idx = [] target += "".join([chr(_ + 97) for _ in source[min_idx]]) source.remove(source[min_idx]) # print('end:', end='') # print(source, target) if not len(source): return target else: return append(source, target) print(append(strings, ""))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s963352784
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L = map(int, input().split()) input_line1 = [input() for i in range(N)] input_line2 = [] for i in range(N): input_line2.append(min(input_line1)) input_line1.remove(min(input_line1)) print("".join(input_line2))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s867858165
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N,L=map(int,input().split()) S = [input() for i in range(N)] S.sort() for s in S: print(s,end=“”)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s459668881
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
first= input() first = first.split() N = int(firsst[0]) L =[] for i in range(N) s = input() L.append(s) L.sort() for i in L: print(i,end="")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s971266680
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
first= input() first = first.split() N = int(first[0]) L =[] for i in range(N) s = input() L.append(s) L.sort() for i in L: print(i,end="")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s871747659
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) s=[] for i in range(n): s.append(str(input())) a="".join(sorted(s)) print(a
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s850028457
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
a, b = list(map(int, input().split())) print("".join(sorted([input() for i in range(a)])))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s713192331
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
print("".join(sorted(input() for _ in range(int(input().split()[0])))))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s820178607
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
record = sorted([input() for i in range(int(input().split()[1]))]) print("".join(record))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s359148269
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
def hikaku(n1, n2): for x, y in zip(n1, n2): if ord(x) == ord(y): continue else: return True if ord(x) > ord(y) else False num, length = map(int, input().split()) wlist = [] for i in range(num): wlist.append(input()) for n in range(num - 1): kumi = [(x, x + 1) for x in range(num - 1 - n)] if kumi: for x, y in kumi: if hikaku(wlist[x], wlist[y]): wlist[x], wlist[y] = wlist[y], wlist[x] dst = "" for w in wlist: dst += w print(dst)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s288822451
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
#pythonだとsortでそのまま何文字でもソートしてくれる n, l = map(int, input().split()) s = [input() for _ in range(n)]] print(''.join(sorted(s)))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s334224060
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N = int(input().split()[0]) words = [input().rstrip() for i in range(N)] print(words) print("".join(sorted(words)))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s905483219
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
print("".join(sorted([input() for i in range(int(input().split[0]))])))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s136690770
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N = input().split()[0] words = [input() for i in range(N)] print("".join(words.sort()))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s171258851
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list(map(lambda x: x - 1, MII())) ## dp ## def DD2(d1, d2, init=0): return [[init] * d2 for _ in range(d1)] def DD3(d1, d2, d3, init=0): return [DD2(d2, d3, init) for _ in range(d1)] ## math ## def to_bin(x: int) -> str: return format(x, "b") # rev => int(res, 2) def to_oct(x: int) -> str: return format(x, "o") # rev => int(res, 8) def to_hex(x: int) -> str: return format(x, "x") # rev => int(res, 16) MOD = 10**9 + 7 def divc(x, y) -> int: return -(-x // y) def divf(x, y) -> int: return x // y def gcd(x, y): while y: x, y = y, x % y return x def lcm(x, y): return x * y // gcd(x, y) def enumerate_divs(n): """Return a tuple list of divisor of n""" return [(i, n // i) for i in range(1, int(n**0.5) + 1) if n % i == 0] def get_primes(MAX_NUM=10**3): """Return a list of prime numbers n or less""" is_prime = [True] * (MAX_NUM + 1) is_prime[0] = is_prime[1] = False for i in range(2, int(MAX_NUM**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, MAX_NUM + 1, i): is_prime[j] = False return [i for i in range(MAX_NUM + 1) if is_prime[i]] ## libs ## from itertools import accumulate as acc from collections import deque, Counter from heapq import heapify, heappop, heappush from bisect import bisect_left # ======================================================# def main(): n, l = MII() ss = [IS() for _ in range(n)] ss.sort() print("".join(ss)) if __name__ == "__main__": main()
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s550928874
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
# 最初に入力される情報を整理する str_input_list = input().rstrip().split(" ") int_input_list = [] for a in str_input_list: int_input_list.append(int(a)) length = int_input_list[0] amount = int_input_list[1] # 文字列を受け取りリストに格納 mojiretu_list = [] for a in range(amount): mojiretu_list.append(input()) # 文字列を小さい順に並べ、結合 sorted_list = sorted(mojiretu_list) min_mojiretu = "" for a in range(amount): min_mojiretu += sorted_list[a] # 出力 print(min_mojiretu)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s835892815
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n, l = map(int, input().split()) sl = [] for i in range(n): s = input() sl.append(s) sl.sort() "print(sl) ans = "" for i in range(n): ans += sl[i] print(ans)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s789746483
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n, l = map(int, input().split()) s = [int(input()) for _ in range(n)] s.sort() print(i for i in s, end="")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s584018464
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N,L = map(int, input().split()) string_list = [input() for i in range(N)] string_list.sort() print(''.join(string_list)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s752615207
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
str = input()
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s297337832
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L = map(int, input().split()) data = [] for _ in range(N): input_data = input() data.append(input_data) print(data) data.sort() print(''.join(data))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s502533467
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
int main (): N = input('>>') L = input('>>') for i in range(N): dict = [input('>>')] dict.sort() for i in range(N): print(str(dict[i])) if __name__ = '__main__': main()
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s446796797
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N = input() Ss = [] for _ in range(int(N[0])): Ss.append(str(input())) Ss.sort() print(*Ss, sep="")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s912229163
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) c=[] for i range(n): c.append(input()) c.sort() print("".join(c))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s422985574
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
x, y = map(int, input().split()) print("".join(sorted([input() for _ in range(x)])))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s668482840
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n = int(input()) s = [input() for i in n] print(s.sort())
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s599683279
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n, l = map(int,input().split()) s = [input() for _ in range(n)] i = sorted(s) print(''.join(i)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s124928884
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n, l = map(int, input().split()) List = sorted([input() for i in range(n]) print("".join(List))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s688623985
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
import sys input_methods = ["clipboard", "file", "key"] using_method = 0 input_method = input_methods[using_method] IN = lambda: map(int, input().split()) mod = 1000000007 # +++++ def main(): # a = int(input()) n, l = IN() ss = [] for _ in range(n): s = input() ss.append(s) ss.sort() return "".join(ss) # +++++ isTest = False def pa(v): if isTest: print(v) def input_clipboard(): import clipboard input_text = clipboard.get() input_l = input_text.splitlines() for l in input_l: yield l if __name__ == "__main__": if sys.platform == "ios": if input_method == input_methods[0]: ic = input_clipboard() input = lambda: ic.__next__() elif input_method == input_methods[1]: sys.stdin = open("inputFile.txt") else: pass isTest = True else: pass # input = sys.stdin.readline ret = main() if ret is not None: print(ret)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s666433072
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
input_n = input().split(" ") N = int(input_n[0]) L = int(input_n[1]) say = [] for i in range(N): say.append(input()) say.sort() state = "" for i in range(N): state += say[i] print(state)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s092386876
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L = map(int, input().split()) #標準入力からリストの作成 list = [] for _ in (1,N): i = input() list.append(i) #リストの結合 mojiretu = ''.join(list) print(mojiretu
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s273796188
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L = map(int, input().split()) #標準入力からリストの作成 list = [] for _ in range(1,N): i = input() list.append(i) #リストの結合 mojiretu = ''.join(list) print(mojiretu
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s702230774
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
input_N_L = input() # print( input_N_L ) N, L = map(int, input_N_L.split()) # print( N ) # print( L ) str_set = [] for i in range(L): str_set.append(input()) # print( array ) sorted_str = "" for s in sorted(str_set): sorted_str += s print(sorted_str)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s335345182
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
number, length = input().split() input_list = [] out = "" for i in range(number): input_list.append(input()) input_list.sort() for i in input_list: out += i print(out)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s099266506
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
import sequtils, strutils, algorithm let nl = stdin.readline.split.map(parseInt) ss = newSeqWith(nl[0], stdin.readline).sorted(cmp) echo ss.join("")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s928735811
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L=map(int, input().split("")) s=[] for i in range(n): s.append(input()) print(''.join(sorted(s))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s971247476
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
lengh, num = map(int, input().split()) lis = [input() for i in range(num)] print("".join(sorted(lis)))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s880398687
Wrong Answer
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n = input() l = "" for i in n: c = 0 if i == "1" or i == "0": l += i else: l = l[: len(l) - 1] print(l)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s130866074
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N,L=map(int,input().split()) S = [input() for i in range(N)] S.sort() for s in S: print(s,end=“”)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s091335046
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) s=[] for i range(n): s.append(input()) s.sort() ans='' for x in s: ans+=x print(ans)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s639171423
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N,L=[int(x) for x i input().split()] s=[] for _ in range(N): s.append(input()) s.sort() print("".join(s))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s997637463
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) c=[] for i range(n): c.append(input()) c.sort() print("",join(c))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s875488742
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n, k = map(int, input().split()) ln = map(str(input()) for _ in range(n)) ln.sort() print("".join(ln))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s109914626
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
x = list(map(int,input().split())) for i in 0 to X[0] A.append(input()) result = ''.join(A) print(result)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s805093843
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) list=[] for _ in range(n): list.append(str(input()) list.sort() ans="" for i in list: ans+=i print(ans)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s060008518
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
#ABC042.B N,L = map(int,input().split()) s = [input()for_in range(n)] s.sort() ans='' for i in range(s): ans += s[i] print(ans)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s268174611
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
H, W = map(int, input().split()) S = [] for _ in range(H): S.append(input()) S.sort() str1 = "" str1.append(S[i] for i in range(H)) print(str1)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s359438342
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n.l = map(int,input().split()) L = [input() for_ in range(n)] L.sort() print("".join(L))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s854903642
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
3 3 dxx axx cxx
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s466229716
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
list = sorted[input()] print(*list, sep="")
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s421462981
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
print("".join(sorted([input() for _ in range(input().split()[0]))))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s496153567
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l =map(int,input().split()) s=sorted([input(),for i in range(n)]) print(*s,sep='')
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s947296826
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) s=[input() for i in range(n)] print(''.join(sorted(s))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s891938576
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
n,l=map(int,input().split()) for i range(n): s=input() s=s.sort() print(*s,sep='')
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s296712651
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
N, L = map(int, input().split()) S = [input() for _ in range(N)] print(''.join(S.sort())
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s890631324
Accepted
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
# Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(str, sys.stdin.readline().split())) def LS(): return list(map(str, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def solver(allNumber, eachStringList): result = "" # algorithm eachStringList.sort(reverse=False) # print("{}".format(eachStringList)) result = result.join(eachStringList) return result if __name__ == "__main__": N, _ = MI() SI = [] for j in range(N): tmpList = LS() SI.append(tmpList[0]) print("{}".format(solver(N, SI)))
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the lexicographically smallest string that Iroha can produce. * * *
s294011735
Runtime Error
p04044
The input is given from Standard Input in the following format: N L S_1 S_2 : S_N
def power_func(a, b, p): """a^b mod p を求める""" if b == 0: return 1 if b % 2 == 0: d = power_func(a, b // 2, p) return d * d % p if b % 2 == 1: return (a * power_func(a, b - 1, p)) % p from math import factorial H, W, A, B = map(int, input().split()) p = 10**9 + 7 ans = 0 X = [1] Y = [1] for i in range(H + W - 2): fact = factorial(i + 1) % p X += [fact] Y += [power_func(fact, p - 2, p)] for i in range(B, W): ans += ( X[H - A - 1 + i] * X[A + W - 2 - i] * (Y[H - A - 1] * Y[i] * Y[A - 1] * Y[W - 1 - i]) % p ) print(ans)
Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.
[{"input": "3 3\n dxx\n axx\n cxx", "output": "axxcxxdxx\n \n\nThe following order should be used: `axx`, `cxx`, `dxx`."}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s575724008
Runtime Error
p03781
The input is given from Standard Input in the following format: X
import sys input = sys.stdin.readline N, K = map(int, input().split()) a = list(map(int, input().split())) S, f = [set() for i in range(N + 1)], [[0] * K for i in range(N + 1)] S[0].add(0) f[N][0] = 1 for i, (al, ar) in enumerate(zip(a, a[::-1]), 1): for j in S[i - 1]: S[i].add(j) x = al + j if x < K: S[i].add(x) for j in range(K): if f[-i][j]: f[-i - 1][j] = 1 if ar + j < K: f[-i - 1][ar + j] = 1 for i in range(N): for j in range(1, K): f[i][j] += f[i][j - 1] cnt = 0 for i, x in enumerate(a): if x >= K: cnt += 1 continue for j in S[i]: if K - x - j - 1 < 0 or f[i + 1][K - j - 1] - f[i + 1][K - x - j - 1] > 0: cnt += 1 break print(N - cnt)
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s185730275
Runtime Error
p03781
The input is given from Standard Input in the following format: X
# import sys # sys.stdin = open('d3.in') n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() prefix = [set() for _ in range(n + 1)] suffix = [set() for _2 in range(n + 1)] prefix[0] = {0} for i in range(n): for v in prefix[i]: if v + a[i] <= k: prefix[i + 1].add(v + a[i]) suffix[n] = {0} for i in range(n - 1, -1, -1): suffix[i] = set(suffix[i + 1]) for v in suffix[i + 1]: if v + a[i] <= k: suffix[i].add(v + a[i]) # Cumulative sums c_suffix = [[0] * (k + 1) for _3 in range(n + 1)] for i in range(n + 1): for j in range(k): c_suffix[i][j + 1] = c_suffix[i][j] + (j in suffix[i]) def find(i): if k <= a[i]: return 0 for s in prefix[i]: start = max(0, k - a[i] - s) stop = k - s if c_suffix[i + 1][stop] - c_suffix[i + 1][start] > 0: return 0 return 1 res = 0 for i in range(n): res += find(i) print(res)
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s880964668
Runtime Error
p03781
The input is given from Standard Input in the following format: X
import sys [n, k] = [int(x) for x in input().strip().split()] a = [int(x) for x in input().strip().split()] a.sort() if sum(a) < k: print(n) sys.exit() s = 0 for i in range(len(a)): s += a[i] if s >= k: break aa = [x for x in a if x < a[i]] bb = [x for x in a if x < k] cc = [] for i in range(len(aa)): c = bb[:i] + bb[i + 1 :] t = k - bb[i] c.reverse() # print(c) flg = 0 j = 0 s = 0 f = [0 for x in range(len(c))] while True: f[j] = 1 # print(c) # print(f) s += c[j] if s >= t and s < k: flg = 1 # print(c) # print(f) break if s >= k: f[j] = 0 s -= c[j] j += 1 if j == len(c): ii = -1 for jj in range(len(c) - 1): if f[jj] == 1: ii = jj if ii == -1: break else: for l in range(ii, len(c)): f[l] = 0 j = ii + 1 s = sum([c[l] * f[l] for l in range(len(c))]) if flg == 0: cc.append(bb[i]) # print(cc) print(len(cc))
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s087612011
Runtime Error
p03781
The input is given from Standard Input in the following format: X
def main(): n, k = map(int, input().split()) a = list(filter(lambda x: x < k, list(map(int, input().split())))) n = len(a) a.sort(reverse=True) ng = -1 ok = n while ok - ng > 1: mid = (ok + ng) // 2 dp = [False] * (k + 1) dp[0] = True f = 0 for j in range(n): if j == mid: continue w = a[j] for i in range(k, w - 1, -1): if dp[i - w]: dp[i] = True if k - a[mid] <= i < k: ng = mid f = 1 break if f: break else: ok = mid print(n - ok) if __name__ == "__main__": main()
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s097337857
Runtime Error
p03781
The input is given from Standard Input in the following format: X
x = int(input()) i=0 while x>0 i++ x=x-i print(i)
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the earliest possible time for the kangaroo to reach coordinate X. * * *
s384522490
Runtime Error
p03781
The input is given from Standard Input in the following format: X
x = int(input()) i = 0 while x>0 i = i+1 x = x-i print(i)
Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.
[{"input": "6", "output": "3\n \n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times,\nwhich is the earliest possible time.\n\n* * *"}, {"input": "2", "output": "2\n \n\nHe can reach his nest at time 2 by staying at his position during the first\nsecond, and jumping to the right at the next second.\n\n* * *"}, {"input": "11", "output": "5"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s292322183
Accepted
p02893
Input is given from Standard Input in the following format: N X
def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) divisors.sort() return divisors def nasu(x): t = make_divisors(x) c = 0 for i in t: c += D[i] return c def honya(x): y = 0 k = 1 for i in range(x - 1, -1, -1): if X[i]: y = (y + k) % MOD k = (k * 2) % MOD return y + honyaraka(x) def honyaraka(x): cnt = 0 for i in range(N // x): t = i % 2 for j in range(x): if X[cnt] != (X[j] ^ t): if X[cnt] == 0: return 0 else: return 1 cnt += 1 return 1 N = int(input()) X = list(map(int, input())) MOD = 998244353 Y = 0 k = 1 for i in range(N - 1, -1, -1): if X[i]: Y = (Y + k) % MOD k = (k * 2) % MOD D = [0] * (N + 1) L = make_divisors(N) cnt = 0 for i in L: if i != N and (N // i) % 2 == 1: D[i] = honya(i) - nasu(i) cnt += D[i] D[N] = Y - cnt + 1 ans = 0 for i in L: ans = (ans + D[i] * i * 2) % MOD print(ans)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s211307775
Accepted
p02893
Input is given from Standard Input in the following format: N X
import sys input = sys.stdin.readline mod = 998244353 N = int(input()) X = input() import math xr = math.ceil(math.sqrt(N)) LIST = [] for i in range(1, xr + 1): if N % i == 0: LIST.append(i) LIST.append(N // i) REP = [l for l in set(LIST) if (N // l) % 2 == 1 and l != N] REP.sort(reverse=True) ANS = 2 * N * (int(X, 2) + 1) % mod def invstr(X, r): return bin(int(X, 2) ^ ((1 << r) - 1))[2:].zfill(r) from collections import defaultdict score = defaultdict(int) for r in REP: score[r] += 2 * r - 2 * N for j in REP: if r % j == 0 and j < r: score[j] -= score[r] for r in REP: sc = score[r] # print(r,score) XSTR = X[:r] kosuu = int(XSTR, 2) if (XSTR + invstr(XSTR, r)) * (N // (r * 2)) + XSTR <= X: kosuu += 1 ANS += kosuu * sc print(ANS % mod)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s222136854
Accepted
p02893
Input is given from Standard Input in the following format: N X
N = int(input()) X = input() MOD = 998244353 ans = 0 memo = dict() # def get_divisor(n): # '''nの約数を返す # ''' # d = set() # for i in range(1, int(n**0.5)+1): # if n % i == 0: # d.add(i) # d.add(n//i) # return d def get_oddivisor(n): """nの約数のうち商が奇数のものを返す""" d = set() for i in range(1, int(n**0.5) + 1): if n % i == 0: if i % 2 == 1: d.add(n // i) if (n // i) % 2 == 1: d.add(i) return d D = list(get_oddivisor(N)) D.sort() def alternate(x, n): """x: 00101, y: 11010, z: (00101)(11010)... n times""" y = ("0" * len(x) + bin(int(x, 2) ^ (2 ** len(x) - 1))[2:])[-len(x) :] z = (x + y) * (n // 2) if n % 2 == 1: z += x return z for d in D: cnt = int(X[:d], 2) if int(X, 2) >= int(alternate(X[:d], N // d), 2): cnt += 1 dd = list(get_oddivisor(d)) for ddd in dd: if ddd != d: cnt -= memo[ddd] memo[d] = cnt ans += cnt * 2 * d ans %= 998244353 print(ans)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s977959602
Wrong Answer
p02893
Input is given from Standard Input in the following format: N X
import sys N = int(input()) X = int(input(), 2) def proc(x): if x % 2 == 1: return x >> 1 else: return (x >> 1) + int("1" + "0" * (N - 1), 2) total = 0 MAX_TRY = 1000 for k in range(X + 1): p = k for num_calc in range(1, MAX_TRY): p = proc(p) if p == k: total += num_calc break if num_calc == MAX_TRY - 1: print("-1") sys.exit(0) print(total % 998244353)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s682217521
Wrong Answer
p02893
Input is given from Standard Input in the following format: N X
n = int(input()) x = input() x_10 = int(x, 2) cnt = x_10 + 1 ans = 0 n_copy = n for i in range(3, n + 1, 2): if n % i == 0: p = int(x[0 : n // i], 2) if x_10 >= sum(p << ((n // i) * j) for j in range(0, i, 2)) + sum( (2 ** (n // i) - p - 1) << ((n // i) * j) for j in range(1, i, 2) ): cnt -= p + 1 ans += (p + 1) * 2 * (n // i) else: cnt -= p ans += p * 2 * (n // i) ans += n * 2 * cnt print(ans % 998244353)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s801765508
Runtime Error
p02893
Input is given from Standard Input in the following format: N X
# import numpy as np # # n = int(input()) # # m = np.zeros((n, n), dtype=np.bool) # # for i in range(n): # l = [int(s) for s in list(input())] # m[i] =l # a = np.count_nonzero(m,axis=0) # r = np.count_nonzero(np.count_nonzero(m, axis=0) > 1) # r = r or -1 # print(r) n = int(input()) x = int(input(), 2) th = 2 ** (n - 1) * 2 def calc_1(tmp_k): return (tmp_k - 1) / 2 def calc_2(tmp_k): return tmp_k / 2 + 2 ** (n - 1) def calc_count(tmp_k): if tmp_k % 2 == 1: new_k = calc_1(tmp_k) else: new_k = calc_2(tmp_k) if new_k == k: return 1 if tmp_k > new_k > calc_2(tmp_k): return False calc_result = calc_count(new_k) if calc_result: calc_result += 1 return calc_result result = 0 for k in range(x + 1): calc_result = calc_count(k) if calc_result: result += calc_result print(result % 998244353)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s400306015
Wrong Answer
p02893
Input is given from Standard Input in the following format: N X
N = int(input()) X = int(input(), 2) MOD = 998244353 ans = ((X + 1) % MOD) * 2 * N L = [] for i in range(1, N // 3 + 1): if N % (2 * i) == i: for j in range(2**i): b = int( (("0" * i + bin(j)[2:])[-i:] + ("0" * i + bin(2**i - j - 1)[2:])[-i:]) * (N // (2 * i)) + ("0" * i + bin(j)[2:])[-i:], 2, ) if X >= b and not (b in L): L.append(b) ans -= 2 * N ans += 2 * i ans %= MOD print(ans)
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353. * * *
s648802684
Runtime Error
p02893
Input is given from Standard Input in the following format: N X
# import sys # input = sys.stdin.readline # import heapq # from fractions import gcd # from collections import defaultdict # sys.setrecursionlimit(10**9) # map(int,input().split()) def main(): n = int(input()) x = int(input(), 2) ans = [0] * (x + 1) tmp = 0 for i in range(x + 1): if ans[i] != 0: continue else: cnt = 0 tmp = i li = [tmp] while True: if tmp % 2: tmp = (tmp - 1) // 2 li.append(tmp) cnt += 1 else: tmp = (tmp // 2) + (2 ** (n - 1)) li.append(tmp) cnt += 1 if tmp == i: for ii in li: if ii <= x: ans[ii] = cnt break print(sum(ans) % 998244353) if __name__ == "__main__": main()
Statement Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353. * Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)
[{"input": "3\n 111", "output": "40\n \n\nFor example, for k=3, the operation changes k as follows: 1,0,4,6,7,3.\nTherefore the answer for k=3 is 6.\n\n* * *"}, {"input": "6\n 110101", "output": "616\n \n\n* * *"}, {"input": "30\n 001110011011011101010111011100", "output": "549320998"}]
Print the maximum positive integer K that satisfies the condition. * * *
s237462011
Accepted
p02939
Input is given from Standard Input in the following format: S
a = 0 t = c = "" for i in input(): t += i if c != t: a += 1 c = t t = "" print(a)
Statement Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.
[{"input": "aabbaa", "output": "4\n \n\nWe can, for example, divide S into four strings `aa`, `b`, `ba`, and `a`.\n\n* * *"}, {"input": "aaaccacabaababc", "output": "12"}]
Print the maximum positive integer K that satisfies the condition. * * *
s246596658
Wrong Answer
p02939
Input is given from Standard Input in the following format: S
a = input() print(len(a))
Statement Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.
[{"input": "aabbaa", "output": "4\n \n\nWe can, for example, divide S into four strings `aa`, `b`, `ba`, and `a`.\n\n* * *"}, {"input": "aaaccacabaababc", "output": "12"}]
Print the maximum positive integer K that satisfies the condition. * * *
s786183871
Wrong Answer
p02939
Input is given from Standard Input in the following format: S
print(15)
Statement Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.
[{"input": "aabbaa", "output": "4\n \n\nWe can, for example, divide S into four strings `aa`, `b`, `ba`, and `a`.\n\n* * *"}, {"input": "aaaccacabaababc", "output": "12"}]
Print the maximum positive integer K that satisfies the condition. * * *
s497752374
Wrong Answer
p02939
Input is given from Standard Input in the following format: S
str = input() print("4")
Statement Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.
[{"input": "aabbaa", "output": "4\n \n\nWe can, for example, divide S into four strings `aa`, `b`, `ba`, and `a`.\n\n* * *"}, {"input": "aaaccacabaababc", "output": "12"}]