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
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s763805860
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) L = [int(n) for n in input().split()] maxL = max(L) if maxL < sum(L) - maxL print("yes") else: print("no")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s117425632
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) L = list(map(int, input().split())) nagai = max(L) if nagai > sum(L) print('Yes') else print('No')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s569370405
Accepted
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
import math INF, MOD = float("inf"), 1e9 + 7 MAX, MIN = -INF, INF dx1, dy1, dx2, dy2 = ( [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1], ) def get_int(): return int(input()) def get_int_list(): return list(map(int, input().split())) def mins(x, y): x = min(x, y) def maxs(x, y): x = max(x, y) while True: try: n = int(input()) a = list(map(int, input().split())) mx = max(a) if (sum(a) - mx) > mx: print("Yes") else: print("No") except EOFError: exit()
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s208430147
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
# -*- coding: utf-8 -*- # Nの取得 index = int(input()) # n回ループして配列に入れる max = 0 other = 0 for i in range(n): tmp = input() max = tmp if tmp > max else other = other + tmp print("Yes") if max < tmp else print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s431518724
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = input() a = [input() for i in range(N)] if max(a) > sum(a) - max(a): print("Yes") else print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s578729974
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
# -*- coding: utf-8 -*- # Nの取得 index = int(input()) # n回ループして配列に入れる max = 0 other = 0 for i in range(n): tmp = input() max = tmp if tmp > max else other = other + tmp if max < tmp : print("Yes") else : print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s780443027
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
input_angle = int(input()) input_length = input() _length = input_length.split(' ') length = [int(l) for l in _length] length.sort() sum = 0 for i in range(input_angle-2): sum += int(length[i]) if int(length[-1]) < sum: print('Yes') else:
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s461166604
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
input_angle = int(input()) input_length = input() _length = input_length.split(' ') length = [int(l) for l in _length] length.sort() sum = 0 for i in range(input_angle-1): sum += int(length[i]) if int(length[-1]) < sum: print('Yes') else:
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s089195508
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
input_angle = int(input()) input_length = input() _length = input_length.split(' ') length = [int(l) for l in _length] length.sort() sum = 0 for i in range(input_angle-1): sum += int(length[i]) if int(length[-1]) < sum: print('Yes') else:
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s268431930
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) l = list(map(input().split(' '), int)) if max(l) < sum(l) - max(l): print('Yes') else print('No')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s497429855
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = input() a = list(map(int, input().split())) if max(a)*2 >= sum(a): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s380472231
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
a=int(input()) b=list(map(int,input().split()) if sum(b)>2*max(b): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s690146439
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) a = list(map(int, input().split())) print("Yes" if max(a) < sum(a)-max(a) else "No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s100687318
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = input() a = [input() for i in range(N)] if max(a) > sum(a) - max(a): print("Yes") else print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s739226160
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = input() a = list(map(int, input().split())) if max(a)*2 >= sum(a): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s425484782
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) l = list(map(int,input().split()))w if max(l) >= sum(l)-max(l): print('No') else: print('Yes')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s926326612
Wrong Answer
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
print( (lambda l: ["No", "Yes", input()][sum(l[:-1]) >= l[-1]])( sorted(list(map(int, input().split()))) ) )
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s281823634
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) l = list(map(int, input().split(' '))) if max(l) < sum(l) - max(l): print('Yes') else print('No')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s844667529
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) l = list(map(int, input().split())) l.sort() ans = 0 for i + 1 in l: ans += l[i + 1] if l[0] < ans: print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s710135451
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N, M = map(int, input().split()) X = list(map(int, input().split())) X.sort() A = [] for i in range(M - 1): A.append(X[i + 1] - X[i]) A.sort() print(sum(A[: M - N]))
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s984671258
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N= int(input()) L = list(map(int, input().split())) L.sort() if sum(L[:-1]) > L[-1]: print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s226193550
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) l = list[] for i in N: n = int(input()) l.append(n) m = l.max() SUM = l.sum() - m if m > SUM: print("YES") else: print("NO")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s694239045
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) L = list(map(int, input(.split()))) if sum(L[:N-1]) < max(L): print('Yes') else: print('No')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s518841348
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) lists = list(map(int,input().split()) ma = max(lists) if sum(lists) - ma >ma: print("YES") else: print("NO")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s561044715
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = input() a list(map(int,input().split())) a = sorted(a) if sum(a[0:-2]) > a[-1]: print("No") else: print("Yes")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s503879242
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = input() N = int(n) a = [input() for i in range(N)] a = int(a) if max(a) >= sum(a) - max(a): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s352922881
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = int(input()) a = [int(i) for i in input().split()] if(max(a) > (sum(a) - max(a)): print("NO") else: print("YES")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s947384430
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) if a[0]<sum(a[1:]): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s645300790
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) L = [] for i in range(N): L.append(int(input()) maxL = max(L) sumL = sum(L) - maxL if maxL >= sumL : return 'No' else: return 'Yes'
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s567194085
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
n = input() EdgeLength=input() edgeLength=[int(i) for i in EdgeLength] N = int(n) sorted(edgeLength) sumL = 0 sumLength = [sumL += edgeLength[i] for i in range(N-1)] if edgeLength[N] < sumL: print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s654126609
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) listL = [int(i) for i in input().split()] maxL = max(listL) for i in range(N) sum += listL[i-1] sum = sum - maxL if maxL < sum: print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s504989500
Accepted
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N, L = open(0) L = sorted(map(int, L.split())) print("YNeos"[sum(L[:-1]) <= L[-1] :: 2])
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s424178676
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N = int(input()) L = [for i in range(N-1)] if max(i) < sum(i) - max(i): print('Yes') else: print('No')
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s265037403
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
./ABC/117/abc117B.py
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s260945079
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
N=int(input()) l=list(map(int,input().split())) l=sorted(l) if l[-1] < sum([:-1]): print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If an N-sided polygon satisfying the condition can be drawn, print `Yes`; otherwise, print `No`. * * *
s626644101
Runtime Error
p03136
Input is given from Standard Input in the following format: N L_1 L_2 ... L_N
#ABC117 B N = int(input() Ln = [input() for i in range(N)] Ln.sort() max = L[0] sun = 0 for i in N-1: sum += L[i+1] if max < sum: print("Yes") else: print("No")
Statement Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
[{"input": "4\n 3 8 5 1", "output": "Yes\n \n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can\nbe drawn on a plane.\n\n* * *"}, {"input": "4\n 3 8 4 1", "output": "No\n \n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon\ncannot be drawn on a plane.\n\n* * *"}, {"input": "10\n 1 8 10 5 8 12 34 100 11 3", "output": "No"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s560342396
Accepted
p03423
Input is given from Standard Input in the following format: N
print((int(input())) // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s464537334
Accepted
p03423
Input is given from Standard Input in the following format: N
import functools import os INF = float("inf") def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): return input().split() def debug(fn): if not os.getenv("LOCAL"): return fn @functools.wraps(fn) def wrapper(*args, **kwargs): print( "DEBUG: {}({}) -> ".format( fn.__name__, ", ".join( list(map(str, args)) + ["{}={}".format(k, str(v)) for k, v in kwargs.items()] ), ), end="", ) ret = fn(*args, **kwargs) print(ret) return ret return wrapper n = inp() print(n // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s589249445
Runtime Error
p03423
Input is given from Standard Input in the following format: N
N=int(input()) name=[] for i in range(N): name.append(input()) M=0 A=0 R=0 C=0 H=0 letters=['M','A','R','C','H'] for i in range(N): for j in letters: if name[i][0]==j: if j=='M': M+=1 elif j=='A': A+=1 elif j=='R': R+=1 elif j=='C': C+=1 elif j=='H': H+=1 kazu=! if M==0: M+=1 if A==0: A+=1 if C==0: C+=1 if R==0: R+=1 if H==0: H+=1 print(M*A*C*R*H)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s893760785
Runtime Error
p03423
Input is given from Standard Input in the following format: N
a, b = (int(x) for x in input().split()) if a * b % 2 == 0: print("Even") else: print("Odd")
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s952784343
Runtime Error
p03423
Input is given from Standard Input in the following format: N
import numpy as np from scipy.special import comb n = int(input()) a = [] for _ in range(n): b = list(map(str, input())) a.append(b) ans = [0] * 5 for i in range(n): tmp = a[i][0] if tmp == "M": ans[0] += 1 elif tmp == "A": ans[1] += 1 elif tmp == "R": ans[2] += 1 elif tmp == "C": ans[3] += 1 elif tmp == "H": ans[4] += 1 else: continue cnt = [] for j in range(len(ans)): if ans[j] == 0: continue else: cnt.append(ans[j]) l = 0 for k in range(len(cnt)): if cnt[k] > 1: l += cnt[k] - 1 cnt.sort() if len(cnt) <= 2: print(0) elif len(cnt) == 3: print(np.prod(cnt)) elif len(cnt) == 4: print((cnt[0] * cnt[1] * cnt[2]) + (3 * cnt[3])) else: print((cnt[0] * cnt[1] * cnt[2]) + (3 * cnt[3]) + (6 * cnt[4]))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s649369541
Accepted
p03423
Input is given from Standard Input in the following format: N
print(str(int(input()) // 3))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s285199154
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n = int(input()) cnt = 0 while n >= 3:     n -=3 cnt+=1 print()
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s045799058
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print("{}".fotmat(int(input()) // 3))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s443782862
Runtime Error
p03423
Input is given from Standard Input in the following format: N
s = input()$ return int(s)//3$
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s921324171
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n= int(input()) print( n//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s968625384
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(int(input())num / 3))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s498896416
Runtime Error
p03423
Input is given from Standard Input in the following format: N
N = int(input()) ans N//3 print(ans)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s898681393
Runtime Error
p03423
Input is given from Standard Input in the following format: N
import sys N=sys.argv[0] print(int(N/3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s969947427
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n=int(input() print(int(n//3))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s379438724
Accepted
p03423
Input is given from Standard Input in the following format: N
A = int(input()) print(A // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s172918332
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input()//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s210261105
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input() // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s625048021
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print((int)input()/3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s742860220
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input() // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s148605296
Wrong Answer
p03423
Input is given from Standard Input in the following format: N
print(int(input()) // 3 - 1)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s721668851
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input()//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s619415945
Wrong Answer
p03423
Input is given from Standard Input in the following format: N
print(int(input()) // 38)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s735872162
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input()//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s156483220
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input())%%3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s608656665
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(input()//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s303083736
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n = int() n = int(input()) print((n - n % 3)//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s683023151
Runtime Error
p03423
Input is given from Standard Input in the following format: N
import itertools import math N = int(input()) S_list = [] for i in range(N): S_list.append(input()) count_M = 0 count_A = 0 count_R = 0 count_C = 0 count_H = 0 for l in S_list: if l.startswith("M"): count_M += 1 elif l.startswith("A"): count_A += 1 elif l.startswith("R"): count_R += 1 elif l.startswith("C"): count_C += 1 elif l.startswith("H"): count_H += 1 count = [count_M, count_A, count_R, count_C, count_H] a = sum(count) x = a * (a - 1) * (a - 2) / math.factorial(3) for c in count: if c > 2: x -= c * (c - 1) * (c - 2) / math.factorial(3) elif c == 2: x -= a - 2 print(int(x))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s800624367
Runtime Error
p03423
Input is given from Standard Input in the following format: N
s = [input() for i in range(3)] print(s[0][0], s[1][1], s[2][2], sep="")
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s315802430
Runtime Error
p03423
Input is given from Standard Input in the following format: N
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); System.out.println(N / 3); } }
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s814882688
Runtime Error
p03423
Input is given from Standard Input in the following format: N
# --*-- encoding:utf-8 --*-- n = input() list = input().split(" ") result = [] for i in list: for x not in list: result.append(x) print(len(result))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s056011356
Wrong Answer
p03423
Input is given from Standard Input in the following format: N
print((int(input()) + 3 - 1) // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s549473478
Runtime Error
p03423
Input is given from Standard Input in the following format: N
a = int(imput()) m = int(a / 3) print(m)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s799734094
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n = int(input()) print(n//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s240739699
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(lambda x: x / 3)(input())
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s066399853
Runtime Error
p03423
Input is given from Standard Input in the following format: N
n= int(input()) print( n//3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s175915780
Accepted
p03423
Input is given from Standard Input in the following format: N
d = int(input()) print(d // 3)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s731103405
Runtime Error
p03423
Input is given from Standard Input in the following format: N
print(int(int(input) / 3))
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
If you can form at most x groups consisting of three or more students, print x. * * *
s557062769
Runtime Error
p03423
Input is given from Standard Input in the following format: N
N = input() a = [] for i in range(N): a.append(input()) b = list(set(a)) If length(b) ==3 : print(3) elso : print(4)
Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible. Divide the students so that the number of groups consisting of three or more students is maximized.
[{"input": "8", "output": "2\n \n\nFor example, you can form a group of three students and another of five\nstudents.\n\n* * *"}, {"input": "2", "output": "0\n \n\nSometimes you cannot form any group consisting of three or more students,\nregardless of how you divide the students.\n\n* * *"}, {"input": "9", "output": "3"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s244234663
Accepted
p03073
Input is given from Standard Input in the following format: S
S = [int(i) for i in input()] if len(S) % 2 == 0: s_01 = [0, 1] * int((len(S) / 2)) s_10 = [1, 0] * int((len(S) / 2)) acc_01 = sum([i == j for i, j in zip(S, s_01)]) acc_10 = sum([i == j for i, j in zip(S, s_10)]) print(min(len(S) - acc_01, len(S) - acc_10)) else: s_01 = [0, 1] * int((len(S) / 2)) s_01.append(0) s_10 = [1, 0] * int((len(S) / 2)) s_10.append(1) acc_01 = sum([i == j for i, j in zip(S, s_01)]) acc_10 = sum([i == j for i, j in zip(S, s_10)]) print(min(len(S) - acc_01, len(S) - acc_10))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s851801616
Accepted
p03073
Input is given from Standard Input in the following format: S
S = input() ans = [] if len(S) % 2 == 0: k = 0 for i in range(len(S) // 2): if S[2 * i] != "0": k += 1 if S[2 * i + 1] != "1": k += 1 ans.append(k) l = 0 for i in range(len(S) // 2): if S[2 * i] != "1": l += 1 if S[2 * i + 1] != "0": l += 1 ans.append(l) print(min(ans)) elif len(S) > 1 and len(S) % 2 != 0: k = 0 for i in range(len(S) // 2): if S[2 * i] != "0": k += 1 if S[2 * i + 1] != "1": k += 1 if S[-1] != "0": k += 1 ans.append(k) l = 0 for i in range(len(S) // 2): if S[2 * i] != "1": l += 1 if S[2 * i + 1] != "0": l += 1 if S[-1] != "1": l += 1 ans.append(l) print(min(ans)) else: print(0)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s221023082
Accepted
p03073
Input is given from Standard Input in the following format: S
S = input() Length = len(S) Counta = 0 Countb = 0 if Length % 2 == 0: Sa = "01" * (Length // 2) Sb = "10" * (Length // 2) else: Sa = "01" * (Length // 2) + "0" Sb = "10" * (Length // 2) + "1" for i in range(Length): if S[i] != Sa[i]: Counta += 1 if S[i] != Sb[i]: Countb += 1 print(min(Counta, Countb))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s109223829
Accepted
p03073
Input is given from Standard Input in the following format: S
s = input() s = list(s) to_black = 0 to_white = 0 last = "0" if s[0] == "1" else "1" pos = 0 for c in s: if c == last and c == "0": to_white += 1 s[pos] = "1" c = "1" elif c == last and c == "1": to_black += 1 s[pos] = "0" c = "0" last = c pos += 1 print(to_black + to_white)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s944365272
Accepted
p03073
Input is given from Standard Input in the following format: S
S = input() multi = len(S) // 2 if len(S) % 2 == 0: S1 = "10" * multi S2 = "01" * multi else: S1 = "10" * multi + "1" S2 = "01" * multi + "0" con1 = 0 con2 = 0 for i in range(0, len(S)): if S[i] != S1[i]: con1 += 1 if S[i] != S2[i]: con2 += 1 print(min(con1, con2))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s135496944
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
print(sum(i % 2 ^ int(s) for i, s in enumerate(input())))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s567410005
Accepted
p03073
Input is given from Standard Input in the following format: S
String = input() num0_odd = 0 num1_odd = 0 num0_even = 0 num1_even = 0 odd_check = 1 num_of_tile = 0 for i in String: num_of_tile += 1 if odd_check == 0: if i == "0": num0_odd += 1 else: num1_odd += 1 else: if i == "0": num0_even += 1 else: num1_even += 1 odd_check += 1 if odd_check == 2: odd_check = 0 answer = max(num0_odd + num1_even, num0_even + num1_odd) print(num_of_tile - answer)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s453668427
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
S = input() p01 = 0 p10 = 0 p00 = 0 p11 = 0 for i in range(0, (len(S) // 2 * 2), 2): if S[i : i + 2] == "01": p01 += 1 elif S[i : i + 2] == "10": p10 += 1 elif S[i : i + 2] == "00": p00 += 1 else: p11 += 1 # print(p01,p10,p00,p11) c = 0 if (p01 == 0) and (p10 == 0): c = len(S) // 2 elif p01 >= p10: c = p10 * 2 + p00 + p11 if len(S) & 1: if S[-1] == "0": c += 1 else: c = p01 * 2 + p00 + p11 if len(S) & 1: if S[-1] == "1": c += 1 print(c)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s045077465
Accepted
p03073
Input is given from Standard Input in the following format: S
s = list(map(int, list(input()))) c01 = sum([1 for i, j in enumerate(s) if i % 2 == j]) c10 = sum([1 for i, j in enumerate(s) if i % 2 != j]) print(min(c01, c10))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s524339306
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
S = "0b" + input() s1 = "0b" + "10" * (len(S) // 2) + "1" * (len(S) % 2) s2 = "0b" + "01" * (len(S) // 2) + "0" * (len(S) % 2) Ss1 = bin(int(S, 2) ^ int(s1, 2))[2:] Ss2 = bin(int(S, 2) ^ int(s2, 2))[2:] print(min(sum([1 for x in Ss1 if int(x)]), sum([1 for x in Ss2 if int(x)])))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s024158372
Runtime Error
p03073
Input is given from Standard Input in the following format: S
# coding=utf-8 tile = input() cor_list = ["10" * 50000, "01" * 50000] diff_1 = int("0b" + tile, 2) ^ int("0b" + cor_list[0][: len(tile)], 2) diff_2 = int("0b" + tile, 2) ^ int("0b" + cor_list[1][: len(tile)], 2) score_1 = sum([int(s) for s in bin(diff_1)[2:]]) score_2 = sum([int(s) for s in bin(diff_2)[2:]]) print(min[score_1, score_2])
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s920757213
Accepted
p03073
Input is given from Standard Input in the following format: S
n = input() s = n[::2].count("0") + n[1::2].count("1") print(min(s, len(n) - s))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s895269987
Accepted
p03073
Input is given from Standard Input in the following format: S
st = input() length = len(st) pat1 = ["0" if i % 2 else "1" for i in range(length)] pat2 = ["0"] + pat1[:-1] len1 = len([s for s, ss in zip(st, pat1) if s != ss]) len2 = len([s for s, ss in zip(st, pat2) if s != ss]) print(min(len1, len2))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s950637764
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
s = "0b" + input() a = int("0b" + "10" * (len(s) // 2 - 1) + "0" * (len(s) % 2 == 1), 0) s = int(s, 0) c = lambda x: str(bin(x)).count("1") print(min(c(s ^ a), c(s ^ (-~a))))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s678495614
Accepted
p03073
Input is given from Standard Input in the following format: S
N = "0b" + input() M = "0b" + "1" * (len(N) - 2) a = int(N, 0) ^ int(M, 0) if len(N) % 2 == 0: K = "0b" + "10" * ((len(N) - 2) // 2) # 10101010...10(偶数) else: K = "0b" + "10" * ((len(N) - 2) // 2) + "1" # 1010...01(奇数) uK = bin(int(K, 0) ^ int(M, 0)) # Kの逆 q = bin(int(N, 0) ^ int(K, 0)) w = bin(int(N, 0) ^ int(uK, 0)) q = q[2:] w = w[2:] print(min(w.count("1"), q.count("1")))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s291304783
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
print(0)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s738491202
Runtime Error
p03073
Input is given from Standard Input in the following format: S
N = str(input()) anser = 0 for i in range(len(N) - 1): if N[i] == N[i + 1]: if N[i] == 0: N[i] = "1" else: N[i] = "0" anser += 1 print(anser)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s744922602
Wrong Answer
p03073
Input is given from Standard Input in the following format: S
S = input().rstrip() zero_zero = 0 one_zero = 0 zero_one = 0 one_one = 0 one = 0 zero = 0 for i in range(len(S) // 2 - 1): tmp = S[i * 2 : i * 2 + 2] if tmp == "00": zero_zero += 1 elif tmp == "01": zero_one += 1 elif tmp == "10": one_zero += 1 else: one_one += 1 index = len(S) // 2 - 1 if len(S) // 2 - 1 >= 0 else 0 tmp = S[index * 2 :] if tmp == "00": zero_zero += 1 elif tmp == "01": zero_one += 1 elif tmp == "10": one_zero += 1 elif tmp == "11": one_one += 1 elif tmp == "1": one += 1 else: zero += 1 counter = 0 if zero_one > one_zero: counter += one_zero * 2 + zero_zero + one_one + one elif zero_one < one_zero: counter += zero_one * 2 + zero_zero + one_one + zero else: counter += zero_one * 2 + zero_zero + one_one + zero + one print(counter if len(S) != 1 else 0)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s389497542
Accepted
p03073
Input is given from Standard Input in the following format: S
s = list(input()) a = s[::2] b = s[1::2] x = a.count("0") y = b.count("0") print(min(x + len(b) - y, len(a) - x + y))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s576486366
Accepted
p03073
Input is given from Standard Input in the following format: S
S = list(input()) a = S[::2].count("0") + S[1::2].count("1") print(min(a, len(S) - a))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s004644301
Accepted
p03073
Input is given from Standard Input in the following format: S
S = list(input()) even_list = S[::2] odd_list = S[1::2] even_black = even_list.count("0") even_white = even_list.count("1") odd_black = odd_list.count("0") odd_white = odd_list.count("1") if even_white + odd_black < even_black + odd_white: print(even_white + odd_black) else: print(even_black + odd_white)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s770137610
Accepted
p03073
Input is given from Standard Input in the following format: S
list = list(map(int, list(input()))) odds = [list[i] for i in range(0, len(list), 2)] evens = [list[i] for i in range(1, len(list), 2)] a = odds.count(0) b = len(odds) - a c = evens.count(0) d = len(evens) - c print(min(a + d, b + c))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s381266079
Accepted
p03073
Input is given from Standard Input in the following format: S
number = input() tile = [int(i) for i in number] even = sum(tile[0::2]) odd = sum(tile) - even ex1 = ((len(tile) // 2) - odd) + even ex2 = ((len(tile) - (len(tile) // 2)) - even) + odd print(min(ex1, ex2))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s533147508
Accepted
p03073
Input is given from Standard Input in the following format: S
S = [digit for digit in input()] s_len = len(S) pattern1 = [str(i % 2) for i in range(s_len)] pattern2 = [str(1) if i % 2 == 0 else str(0) for i in range(s_len)] def get_diff_num(pattern, compared): diff_num = 0 for p, c in zip(pattern, compared): if not p == c: diff_num += 1 return diff_num p1_diff = get_diff_num(pattern1, S) p2_diff = get_diff_num(pattern2, S) print(min(p1_diff, p2_diff))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s994327333
Accepted
p03073
Input is given from Standard Input in the following format: S
S = list(map(int, input().strip())) best = N = len(S) for c in range(2): n_flip = 0 for i in range(N): n_flip += S[i] ^ c c ^= 1 best = min(best, n_flip) print(best)
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]
Print the minimum number of tiles that need to be repainted to satisfy the condition. * * *
s355703721
Accepted
p03073
Input is given from Standard Input in the following format: S
read = input s = read() a = [] pc = "0" if s[0] == "1" else "1" pcnt = 0 for c in s: if pc == c: a.append(pcnt) pcnt = 1 else: pcnt = pcnt + 1 pc = c a.append(pcnt) # print(a, s) odd = sum(map(lambda tp: tp[1], filter(lambda tp: tp[0] % 2 != 0, enumerate(a)))) even = sum(map(lambda tp: tp[1], filter(lambda tp: tp[0] % 2 == 0, enumerate(a)))) print(min(odd, even))
Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors. At least how many tiles need to be repainted to satisfy the condition?
[{"input": "000", "output": "1\n \n\nThe condition can be satisfied by repainting the middle tile white.\n\n* * *"}, {"input": "10010010", "output": "3\n \n\n* * *"}, {"input": "0", "output": "0"}]