message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Emuskald is addicted to Codeforces, and keeps refreshing the main page not to miss any changes in the "recent actions" list. He likes to read thread conversations where each thread consists of m...
instruction
0
6,949
14
13,898
No
output
1
6,949
14
13,899
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,025
14
14,050
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` a = input() b = a.split() n = int(b[0]) k = int(b[1]) d = int(b[2]) raw = [' ']*n if n > k**d: print(-1) exit() table = [[1]*d] p = 1 for i in range(d): cv = 1 for j in range(n): if j % p == 0 and j != 0: cv = cv + 1 if cv == k+1: ...
output
1
7,025
14
14,051
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,026
14
14,052
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` import os import sys from io import BytesIO, IOBase import math def main(): pass # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer =...
output
1
7,026
14
14,053
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,027
14
14,054
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` #http://codeforces.com/problemset/problem/459/C # Input of the values n, k, d = map(int, input().split()) #Convention : Busses are numbered from 1 to k # Students are numbered from 0 to k - 1 # Days are numbered from 0 to k - 1 # Variab...
output
1
7,027
14
14,055
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,028
14
14,056
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` import time,math,bisect,sys sys.setrecursionlimit(100000) from sys import stdin,stdout from collections import deque from fractions import Fraction from collections import Counter from collections import OrderedDict pi=3.14159265358979323846264338...
output
1
7,028
14
14,057
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,029
14
14,058
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` from sys import stdin, stdout, setrecursionlimit input = stdin.readline # import string # characters = string.ascii_lowercase # digits = string.digits # setrecursionlimit(int(1e6)) # dir = [-1,0,1,0,-1] # moves = 'NESW' inf = float('inf') from fun...
output
1
7,029
14
14,059
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,030
14
14,060
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` def f(t): i = -1 t[i] += 1 while t[i] > k: t[i] = 1 i -= 1 t[i] += 1 return list(map(str, t)) n, k, d = map(int, input().split()) if k ** d < n: print(-1) else: t = [1] * d t[-1] = 0 s = [f(t) fo...
output
1
7,030
14
14,061
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,031
14
14,062
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` n,k,d = map(int, input().split()) if (n > k ** d): print(-1) exit() for i in range(d): power = k**i resArray = [((j // power) % k +1) for j in range(n)] #for j in range(n//(k**i)+1): # resArray.extend([(j % k) + 1] * (k ...
output
1
7,031
14
14,063
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). ...
instruction
0
7,032
14
14,064
Tags: combinatorics, constructive algorithms, math Correct Solution: ``` # -*- coding: utf-8 -*- import math import collections import bisect import heapq import time import random import itertools import sys from typing import List """ created by shhuan at 2020/1/8 21:47 """ def bit(val, n, l): x = [] whi...
output
1
7,032
14
14,065
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,033
14
14,066
Yes
output
1
7,033
14
14,067
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,034
14
14,068
Yes
output
1
7,034
14
14,069
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,035
14
14,070
Yes
output
1
7,035
14
14,071
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,036
14
14,072
Yes
output
1
7,036
14
14,073
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,037
14
14,074
No
output
1
7,037
14
14,075
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,038
14
14,076
No
output
1
7,038
14
14,077
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,039
14
14,078
No
output
1
7,039
14
14,079
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d differ...
instruction
0
7,040
14
14,080
No
output
1
7,040
14
14,081
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,095
14
14,190
Tags: binary search, sortings, two pointers Correct Solution: ``` def kac(l,d): l.sort(reverse=True) ma=l[0][1] v=l[0][1] i=j=0 for i in range(1,len(l)): v=v+l[i][1] while abs(l[i][0]-l[j][0])>=d: v-=l[j][1] j+=1 if(v>ma): ma=v print(ma...
output
1
7,095
14
14,191
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,096
14
14,192
Tags: binary search, sortings, two pointers Correct Solution: ``` n, d = map(int, input().split()) friends = [] for i in range(n): friends.append(tuple(map(int, input().split()))) friends.sort(key=lambda x: x[0]) prefix = [0] * n prefix[0] = friends[0][1] for i in range(1, n): prefix[i] += prefix[i - 1] le =...
output
1
7,096
14
14,193
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,097
14
14,194
Tags: binary search, sortings, two pointers Correct Solution: ``` [friendsSize, moneyDiff] = [int(x) for x in input().split()] friends = [] for i in range(friendsSize): friendMoney, currentPoints = map(int, input().split()) friends.append([friendMoney, currentPoints]) friends = sorted(friends) currentPoints = 0 max...
output
1
7,097
14
14,195
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,098
14
14,196
Tags: binary search, sortings, two pointers Correct Solution: ``` n,d=map(int,input().split()) a=[] for i in range(n): a.append((list(map(int,input().split())))) a.sort() x=0 y=0 m=0 f=0 while y<n: if a[y][0]-a[x][0]<d: m+=a[y][1] y+=1 f=max(m,f) else: m-=a[x][1] x+=1...
output
1
7,098
14
14,197
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,099
14
14,198
Tags: binary search, sortings, two pointers Correct Solution: ``` user_input=input() first_line=user_input.split(' ') n=int(first_line[0]) d=int(first_line[1]) long_list=[] for i in range(n): extended_list=[] user_input = input() line = user_input.split(' ') extended_list.extend([int(line[0]),int(line...
output
1
7,099
14
14,199
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,100
14
14,200
Tags: binary search, sortings, two pointers Correct Solution: ``` def find_company(friends, d): def mergesort_tuples(tuples, index): def merge(A, B): i, j = 0, 0 result = [] while i < len(A) and j < len(B): if A[i][index] < B[j][index]: ...
output
1
7,100
14
14,201
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,101
14
14,202
Tags: binary search, sortings, two pointers Correct Solution: ``` z,zz=input,lambda:list(map(int,z().split())) zzz=lambda:[int(i) for i in stdin.readline().split()] szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz()) from string import * from re import * from collections import * from queue import * ...
output
1
7,101
14
14,203
Provide tags and a correct Python 3 solution for this coding contest problem. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and...
instruction
0
7,102
14
14,204
Tags: binary search, sortings, two pointers Correct Solution: ``` from bisect import * n,d = map(int,input().split()) tp = list() for i in range(n): m,s = map(int,input().split()) tp.append((m,s)) tp.sort(key = lambda x : x[0]) m = list() s = list() for i in range(n): m.append(tp[i][0]) s.appen...
output
1
7,102
14
14,205
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is ...
instruction
0
7,103
14
14,206
Yes
output
1
7,103
14
14,207
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is ...
instruction
0
7,104
14
14,208
Yes
output
1
7,104
14
14,209
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is ...
instruction
0
7,106
14
14,212
Yes
output
1
7,106
14
14,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is ...
instruction
0
7,108
14
14,216
No
output
1
7,108
14
14,217
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is ...
instruction
0
7,110
14
14,220
No
output
1
7,110
14
14,221
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,475
14
14,950
"Correct Solution: ``` N = int(input()) A = [0] * 101010 for i in range(N): a, b = map(int, input().split()) A[a] += 1 A[b+1] -= 1 ans = 1 cuma = A[0] for i, a in enumerate(A[1:], 1): cuma += a if cuma >= i-1: ans = i print(ans-1) ```
output
1
7,475
14
14,951
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,476
14
14,952
"Correct Solution: ``` import itertools n=int(input()) table=[0 for i in range(100003)] table[0]=1 for i in range(n): a,b=map(int,input().split()) table[a]+=1 table[b+1]-=1 table=list(itertools.accumulate(table)) for i in range(len(table)): if table[i]>=i: ans=i print(ans-1) ```
output
1
7,476
14
14,953
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,477
14
14,954
"Correct Solution: ``` n=int(input()) l=[0 for i in range(100003)] for i in range(n): a,b=map(int,input().split()) l[a]+=1 l[b+1]-=1 su=1 res=1 for i in range(100003): su+=l[i] if su>=i: res=max(i,res) print(res-1) ```
output
1
7,477
14
14,955
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,478
14
14,956
"Correct Solution: ``` from itertools import accumulate n = int(input()) lst = [0] * 100002 for _ in range(n): a, b = map(int, input().split()) lst[a - 1] += 1 lst[b] -= 1 lst = list(accumulate(lst)) for i in range(n, -1, -1): if i <= lst[i]: print(i) break ```
output
1
7,478
14
14,957
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,479
14
14,958
"Correct Solution: ``` def main(): N = int(input()) ab = [list(map(int, input().split())) for i in range(N)] imos = [0]*(N+3) for a, b in ab: imos[min(a,N+2)] += 1 imos[min(b+1,N+2)] -= 1 for i in range(N+1): imos[i+1] += imos[i] #print(imos) ans = 0 for i, imo ...
output
1
7,479
14
14,959
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,480
14
14,960
"Correct Solution: ``` N = int(input()) a=[] p = 0 for i in range(N): q=[int(j) for j in input().split()] a.append([q[0]-1,q[1]]) p = max(p, q[1]) table=[0]*(p+1) for i in range(len(a)): table[a[i][0]]+=1 table[a[i][1]]-=1 for i in range(1,p+1): table[i]+=table[i-1] ans=0 for i, val in enumer...
output
1
7,480
14
14,961
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,481
14
14,962
"Correct Solution: ``` N = int(input()) MAX_N = int(1e5) + 2 acc = [0] * (MAX_N + 1) acc[0] += 1 acc[MAX_N] -= 1 for _ in range(N): a, b = map(int, input().split()) acc[a] += 1 acc[b + 1] -= 1 for i in range(MAX_N): acc[i + 1] += acc[i] for i in reversed(range(MAX_N)): if acc[i] >= i: print(...
output
1
7,481
14
14,963
Provide a correct Python 3 solution for this coding contest problem. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many of my ...
instruction
0
7,482
14
14,964
"Correct Solution: ``` n = int(input()) a = [0] * (10**5 + 2) for i in range(n) : mi, ma = map(int, input().split()) a[mi-1] += 1 a[ma] -= 1 for i in range(n) : a[i+1] += a[i] ans = 0 for i in range(n, 0, -1) : if a[i] >= i : ans = i break print(ans) ```
output
1
7,482
14
14,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,483
14
14,966
Yes
output
1
7,483
14
14,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,484
14
14,968
Yes
output
1
7,484
14
14,969
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,485
14
14,970
Yes
output
1
7,485
14
14,971
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,486
14
14,972
Yes
output
1
7,486
14
14,973
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,487
14
14,974
No
output
1
7,487
14
14,975
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,488
14
14,976
No
output
1
7,488
14
14,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,489
14
14,978
No
output
1
7,489
14
14,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too...
instruction
0
7,490
14
14,980
No
output
1
7,490
14
14,981
Provide tags and a correct Python 3 solution for this coding contest problem. Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right. The hotel has two entrances β€” one from the left end, and another from the right end. When a customer arrives to the hotel through the left ent...
instruction
0
7,650
14
15,300
Tags: brute force, data structures, implementation Correct Solution: ``` n=int(input()) s=input() a=[0]*10 for i in range(n): if s[i]=='L': for i in range(10): if a[i]==0: a[i]=1 break continue if s[i]=='R': for i in range(9,-1,-1): ...
output
1
7,650
14
15,301
Provide tags and a correct Python 3 solution for this coding contest problem. Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right. The hotel has two entrances β€” one from the left end, and another from the right end. When a customer arrives to the hotel through the left ent...
instruction
0
7,651
14
15,302
Tags: brute force, data structures, implementation Correct Solution: ``` n = int(input()) b = [] res = 'a' for i in range(10): b.append(0) l = 0 r = 0 a = input() for i in range(n): if a[i] == "L": k = b.index(0) b[k] = 1 elif a[i] == "R": b.reverse() b[b.index(0)] = 1 ...
output
1
7,651
14
15,303
Provide tags and a correct Python 3 solution for this coding contest problem. Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right. The hotel has two entrances β€” one from the left end, and another from the right end. When a customer arrives to the hotel through the left ent...
instruction
0
7,652
14
15,304
Tags: brute force, data structures, implementation Correct Solution: ``` N = int(input()) events = list(input()) hotel = [False] * 10 for e in events: if e == 'L': for i in range(10): if not hotel[i]: break hotel[i] = True elif e == 'R': for i in range(9, -1, -1): ...
output
1
7,652
14
15,305
Provide tags and a correct Python 3 solution for this coding contest problem. Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right. The hotel has two entrances β€” one from the left end, and another from the right end. When a customer arrives to the hotel through the left ent...
instruction
0
7,653
14
15,306
Tags: brute force, data structures, implementation Correct Solution: ``` n = int(input()) ans = [0]*10 a = list(input()) lastl=0 lastr=9 for i in range (0,len(a)): lastl=0 lastr=9 if a[i]=='L': while ans[lastl]== 1: lastl += 1 ans[lastl]=1 elif a[i]...
output
1
7,653
14
15,307