problem_id
stringlengths
1
4
problem_name
stringlengths
9
108
solution_id
stringlengths
3
10
time_complexity_inferred
stringclasses
439 values
space_complexity_inferred
stringclasses
262 values
query_code
stringlengths
11
464k
1101
867_A. Between the Offices
1101_140
null
null
n = int(input("")) str = input("") if str[0] == 'S' and str[-1] == 'F': print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_141
O(n)
O(1)
n = input() word = input() SF = 0 FS = 0 for i in range (0, int(n)-1) : if word[i] + word[i+1] == "SF" : SF += 1 elif word[i] + word[i+1] == "FS" : FS += 1 if SF > FS : print("yes") else : print("no")
1101
867_A. Between the Offices
1101_142
O(n)
O(n)
l=int(input()) a=list(input()) f=s=0 for i in range(len(a)-1): if a[i]=='F' and a[i+1]=='S': s+=1 elif a[i]=='S' and a[i+1]=='F': f+=1 if f>s: print('YES') else: print("NO")
1101
867_A. Between the Offices
1101_143
O(nlogn)
O(n)
y=int(input()) x=input() c=0 d=0 e=0 for i in range(y-1): if x[i]=='S' and x[i+1]=='F': c=c+1 elif x[i]=='F' and x[i+1]=='S': d=d+1 if c>d: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_144
O(n)
O(1)
x = input() z = input() s_f = z.count('SF') f_z = z.count('FS') if s_f > f_z: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_145
O(1)
O(1)
#!/usr/bin/env python3 import sys def main(): n = int(input()) stays = input().strip() state = stays[0] fts = stf = 0 for stay in stays[1:]: if state != stay: if state > stay: stf += 1 elif state < stay: fts += 1 state = st...
1101
867_A. Between the Offices
1101_146
O(nlogn)
O(1)
n = int(input()) a = input() s = 0 f = 0 for i in range(n-1): if a[i] == "S" and a[i+1] == "F": f += 1 elif a[i] == "F" and a[i+1] == "S": s += 1 if s >= f: print("NO") else: print("YES")
1101
867_A. Between the Offices
1101_147
O(n)
O(1)
n = input() s = input() sf = s.count("SF") fs = s.count("FS") if sf > fs: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_148
O(n)
O(1)
input() s = input() print('Yes' if s.count('SF') > s.count('FS') else 'No')
1101
867_A. Between the Offices
1101_149
O(n)
O(1)
days = input() offices = input() fs , sf = 0,0 for i in range(len(offices)-1): if offices[i:i+2] == 'FS': fs +=1 elif offices[i:i+2] == 'SF': sf += 1 if sf > fs : print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_150
O(n)
O(n)
import sys _ = sys.stdin.readline() s = sys.stdin.readline() def comparator(x, y): if x == "F" and y == "S": return -1 elif x == "S" and y == "F": return 1 else: return 0 print("YES" if sum(map(lambda t: comparator(t[0], t[1]), zip(s, s[1:]))) > 0 else "NO")
1101
867_A. Between the Offices
1101_151
O(nlogn)
O(1)
''' n = int(input()) cube = lambda n: n ** 3 print(cube(n)) ''' ''' n = int(input()) a = list(map(int, input().split())) zero = 0 for i in range(n - 1): if a[i] < a[i + 1] and a[i] > a[i + 1]: zero += 1 print(zero) ''' ''' n = int(input()) if n % 2 == 0: print('Mahmoud') else: print('Ehab') ''' ''' n = int(input()...
1101
867_A. Between the Offices
1101_152
O(1)
O(1)
_ = input() nights = input() ans = 'YES' if (nights[0] == 'S' and nights[-1] == 'F') else 'NO' print(ans)
1101
867_A. Between the Offices
1101_153
O(1)
O(1)
def program(n, a): current = a[0] san_fran = 0 seattle = 0 for i in range(1, n): if current != a[i]: if current == "F": seattle += 1 else: san_fran += 1 current = a[i] if san_fran > seattle: return "Yes" return ...
1101
867_A. Between the Offices
1101_154
O(n)
O(1)
a=input() a=input() b=a.split("FS") a=a.split("SF") if(len(a)>len(b)): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_155
O(n)
O(1)
import time def countFlights(flightStr): flSF = 0 flFS = 0 for x in range(len(flightStr)-1): if flightStr[x:x+2] == "SF": flSF += 1 if flightStr[x:x+2] == "FS": flFS += 1 if flSF > flFS: return "YES" else: return "NO" def solve(): n =...
1101
867_A. Between the Offices
1101_156
O(1)
O(1)
input();s=input();print(['NO','YES'][s[0]=='S' and s[-1]=='F'])
1101
867_A. Between the Offices
1101_157
O(n)
O(n)
n = int(input()) arr = input() print("YES" if arr.count("SF") > arr.count("FS") else "NO")
1101
867_A. Between the Offices
1101_158
O(n)
O(1)
n = int(input()) offices = input() francisco_seattle = 0 seattle_francisco = 0 for i in range(1,len(offices)): if offices[i-1] != offices[i]: if offices[i-1] == "S": seattle_francisco += 1 else: francisco_seattle += 1 if seattle_francisco > francisco...
1101
867_A. Between the Offices
1101_159
O(1)
O(n)
n = int(input()) s = input() if s[0] == 'S' and s[-1] == 'F': print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_160
O(n)
O(1)
# oskwariusz # 867 # A. Between the Offices n = int(input()) days = input() to_san_francisco = 0 to_seattle = 0 for i in range(1, len(days)): if days[i - 1] == 'S' and days[i] == 'F': to_san_francisco += 1 elif days[i - 1] == 'F' and days[i] == 'S': to_seattle += 1 print("YES" if to_san_francis...
1101
867_A. Between the Offices
1101_161
O(n)
O(n)
input() s = list(input()) c, d = 0, 0 for i in range(len(s) - 1): if(s[i] == 'F' and s[i + 1] == 'S'): c += 1 elif(s[i] == 'S' and s[i + 1] == 'F'): d += 1 else: continue if(d > c): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_162
O(n)
O(1)
n = int(input()) st = input() if (st.count('SF') > st.count('FS')): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_163
O(n)
O(n)
input() i = input() for _ in range(101): i = i.replace("SS", "S").replace("FF", "F") i = i[1:] print("YES" if i.count("F") > i.count("S") else "NO")
1101
867_A. Between the Offices
1101_164
O(nlogn)
O(1)
n = int(input().split()[0]) ss = input() i, a, b = 0, 0, 0 while i + 1 < n: if ss[i] == 'F' and ss[i+1] == 'S': a = a + 1 elif ss[i] == 'S' and ss[i+1] == 'F': b = b + 1 i = i + 1 if a >= b: print('NO') else: print("YES")
1101
867_A. Between the Offices
1101_165
O(n)
O(1)
n = input() s = input() fr = 0 si = 0 for i in range(len(s)-1): if ((s[i] == 'F') & (s[i+1] == 'S')): fr += 1 if ((s[i] == 'S') & (s[i+1] == 'F')): si += 1 if (fr < si): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_166
O(1)
O(n)
n = int(input()) string = input() if string[0] == 'S' and string[n-1] == 'F': print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_167
O(nlogn)
O(1)
n=int(input()) s=str(input()) r=0 p=0 for i in range(n-1): if (s[i]=='F')and(s[i+1]=='S'): r=r+1 if (s[i]=='S')and(s[i+1]=='F'): p=p+1 if p>r: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_168
O(nlogn)
O(n)
m=int(input()) n=list(input()) a=[] b=[] for i in range(m-1): if (n[i]+n[i+1])=="SF": a.append("ab") elif n[i]+n[i+1]=="FS": b.append("cd") if len(a)>len(b): print("Yes") else: print("No")
1101
867_A. Between the Offices
1101_169
O(n)
O(1)
n=int(input()) s=input() f,p=0,0 for i in range(len(s)): if s[i:i+2]=='SF': f+=1 elif s[i:i+2]=='FS': p+=1 if f>p: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_170
O(1)
O(1)
n = int(input()) s = input() if s[0:1] == "S" and s[n-1:n] == "F": print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_171
O(n)
O(1)
n = int(input()) s = input() francisco, seattle = 0,0 for i in range(len(s)-1): if s[i] == 'F' and s[i+1] == 'S': seattle +=1 elif s[i] == 'S' and s[i+1] == 'F': francisco += 1 if francisco > seattle: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_172
O(n)
O(1)
def Offices(n, s): if s.count('SF') > s.count('FS'): return 'YES' else: return 'NO' n = int(input()) s = input() print(Offices(n , s))
1101
867_A. Between the Offices
1101_173
O(1)
O(1)
from math import * from copy import * from string import * # alpha = ascii_lowercase from random import * from sys import stdin from sys import maxsize from operator import * # d = sorted(d.items(), key=itemgetter(1)) from itertools import * from collections import Counter # d = dict(Counter(l)) import math def...
1101
867_A. Between the Offices
1101_174
O(nlogn)
O(n)
a = int(input()) k = list(input()) p = 0 q = 0 for i in range(a-1): if (k[i]=="S" and k[i+1]=="F"): p+=1 elif (k[i]=="F" and k[i+1]=="S"): q+=1 if (p>q): print ("YES") else: print ("NO")
1101
867_A. Between the Offices
1101_175
O(nlogn)
O(1)
N = int(input()) S = input().strip() S_counter = 0 F_counter = 0 for i in range(N - 1): if S[i] != S[i + 1]: if S[i] == "F": S_counter += 1 else: F_counter += 1 if S_counter >= F_counter: print("NO") else: print("YES")
1101
867_A. Between the Offices
1101_176
O(nlogn)
O(1)
from sys import stdin input=lambda:stdin.readline().strip() n=int(input()) s=input() nd,ndd=0,0 for i in range(0,n-1): if s[i]=='S' and s[i+1]=='F': nd+=1 elif s[i]=='F' and s[i+1]=='S': ndd+=1 if nd>ndd: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_177
O(n)
O(1)
n,s=int(input()),input() print('NYOE S'[s.count('SF')>s.count('FS')::2])
1101
867_A. Between the Offices
1101_178
O(nlogn)
O(1)
n = int(input()) places = input() count = 0 for index in range(n-1): if (places[index] == 'F' and places[index+1] == 'F') or (places[index] == 'S' and places[index + 1] == 'S'): continue count = count + 1 if places[index] == 'S' and places[index + 1] == 'F' else count - 1 print("NO" if count <= 0 else "...
1101
867_A. Between the Offices
1101_179
O(n)
O(1)
b=list() c=list() a=int(input()) d=str(input()) def top(): for i in range(a-1): if (d[i]+d[(i+1)])=="SF": b.append(1) elif (d[i]+d[(i+1)])=="FS": c.append(1) else: continue top() if len(b)>len(c): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_180
O(n)
O(n)
n = int(input()) s = input() a, b = 0, 0 for i in range(n-1): flight = s[i:i+2] if flight == 'SF': a += 1 elif flight == 'FS': b += 1 if a > b: print ('YES') else: print ('NO')
1101
867_A. Between the Offices
1101_181
O(n)
O(1)
n = int(input()) strok = input() if strok.count('SF')>strok.count('FS'): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_182
null
null
number = input('') airport = input('') if airport[0] == 'S' and airport[-1] == 'F': print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_183
O(nlogn)
O(n)
n=int(input()) m=list(input()) S=0 F=0 for i in range(n-1): if m[i]=="S" and m[i+1]=="F": F+=1 elif m[i]=="F" and m[i+1]=="S": S+=1 print("YES" if F>S else "NO")
1101
867_A. Between the Offices
1101_184
O(nlogn)
O(1)
n = int(input()) string = input() s = 0 f = 0 for i in range(n - 1): char1 = string[i] char2 = string[i+1] if (char1 == 'S' and char2 == 'F'): f += 1 if (char1 == 'F' and char2 == 'S'): s += 1 if (f > s): print ('YES') else: print ('NO')
1101
867_A. Between the Offices
1101_185
O(n)
O(1)
days = int(input()) string = input() last = "" sf, fs = 0, 0 for x in string: if last == "S" and x == "F": sf += 1 elif last == "F" and x == "S": fs += 1 last = x if sf > fs: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_186
O(n)
O(1)
n = int(input()) flights = input() if flights.count('SF') > flights.count('FS'): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_187
O(n)
O(n)
n = int(input()) s = [x for x in input()] sf = fs = 0 temp = s[0] for x in s: if x != temp: if temp == "S": sf = sf+1 else: fs = fs+1 temp = x if sf > fs: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_188
O(n)
O(1)
n=int(input()) a=input() s=0 s2=0 for i in range(n-1): if a[i:i+2]=='SF': s=s+1 if a[i:i+2]=='FS': s2=s2+1 if s>s2: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_189
O(1)
O(1)
n = int(input()) if 2 <= n <= 100: st = input() a = 0 b = 0 i = 0 while i < n - 1: if st[i] == 'F' and st[i+1] == 'S': a += 1 elif st[i] == 'S' and st[i+1] == 'F': b += 1 i += 1 if a > b: print('NO') if a < b: print('YES') i...
1101
867_A. Between the Offices
1101_190
O(1)
O(1)
import itertools import math from collections import defaultdict def input_ints(): return list(map(int, input().split())) def solve(): input() s = input() print('YES' if s.count('SF') > s.count('FS') else 'NO') if __name__ == '__main__': solve()
1101
867_A. Between the Offices
1101_191
O(nlogn)
O(1)
n = int(input()) s = input() cnt = [0, 0] for i in range(n - 1): if s[i] != s[i + 1]: if s[i] == 'S': cnt[0] += 1 else: cnt[0] -= 1 if cnt[0] > 0: print ('Yes') else: print ('No')
1101
867_A. Between the Offices
1101_192
O(n)
O(n)
x = int(input()) li = list(input()) current_stay = li[0] f_to_s = 0 s_to_f = 0 for i in range(1,len(li)): if current_stay == "F" and li[i]=="S": f_to_s += 1 elif current_stay == "S" and li[i]=="F": s_to_f += 1 current_stay=li[i] if s_to_f>f_to_s: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_193
O(nlogn)
O(1)
n = int(input()) s = input() cs = 0 cf = 0 for i in range(0,n): if(i+1<n): if(s[i] == 'S' and s[i+1] == 'F'): cf += 1 elif(s[i] == 'F' and s[i+1] == 'S'): cs += 1 if(cf > cs): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_194
null
null
a = input() a = input() if a.count("S") == 0 | a.count("F") == 0: print("NO") exit(0) if a[0] == 'S' and a[-1] == 'F': print("YES") exit(0) print("NO")
1101
867_A. Between the Offices
1101_195
O(n)
O(1)
#!/usr/bin/env python3 n = int(input()) s = input() fs = 0 sf = 0 for i in range (0, len(s) - 1): if (s[i] == 'S' and s[i+1] == 'F'): sf += 1 elif (s[i] == 'F' and s[i+1] == 'S'): fs += 1 if (sf > fs): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_196
O(n)
O(1)
n = int(input()) string = input() if string.count('SF') > string.count('FS'): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_197
O(n)
O(1)
n = int(input()) s = input() freq = {'FS': 0, 'SF': 0} i = 0 while i < n - 1: flight = s[i:i + 2] if flight == 'SF' or flight == 'FS': freq[flight] += 1 i += 1 if freq['SF'] > freq['FS']: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_198
O(1)
O(1)
if __name__ == "__main__": input() days = input() m = {} m["SF"] = 0 m["FS"] = 0 loc = days[0] for d in days: if loc != d: m[loc + d] += 1 loc = d if m["SF"] > m["FS"]: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_199
O(1)
O(1)
n=int(input()) ch=input() if ch[0]=="S" and ch[len(ch)-1]=="F": print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_200
O(n)
O(1)
from sys import stdin inp = stdin.readline n = int(inp().strip()) s = inp().strip() stf = 0 fts = 0 prev = s[0] for city in s: if prev == 'S' and city == 'F': stf += 1 elif prev == 'F' and city == 'S': fts += 1 prev = city print("YES" if stf > fts else "NO")
1101
867_A. Between the Offices
1101_201
O(nlogn)
O(n)
n=int(input()) s=input() fc=0 sc=0 for i in range(0,n-1): if s[i]=='S' and s[i+1]=='F': fc+=1 if s[i]=='F' and s[i+1]=='S': sc+=1 print('YES' if fc>sc else 'NO')
1101
867_A. Between the Offices
1101_202
O(n)
O(1)
n = int(input()) m = input() a = None count = 0 for o in m: if a is None: a = o elif a != o : a = o count = count + 1 else: continue if count % 2 == 0 : print('NO') elif m[0] == "S": print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_203
O(nlogn)
O(1)
a=int(input()) b=input() cnt=0 d=0 for i in range(a-1): if b[i]=='S' and b[i+1]=='F': cnt+=1 elif b[i]=='F' and b[i+1]=='S': d+=1 if cnt>d: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_204
O(n)
O(1)
import sys n = int(input()) x = input() lst = x.split() f = 0 if x[0]=="S" and x[n-1] =="F": print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_205
O(n)
O(1)
s = int(input()) a = input() if a.count('SF') > a.count('FS'): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_206
O(n)
O(1)
n = int(input().strip()) s = input().strip() s = iter(s) prev = next(s) f2s = 0 s2f = 0 for c in s: if c != prev: if c == 'S': f2s += 1 elif c == 'F': s2f += 1 prev = c if f2s < s2f: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_207
O(nlogn)
O(1)
n=int(input()) a=input() c1=0 c2=0 for i in range (n-1): if a[i]=='S' and a[i+1]=='F': c1=c1+1 if a[i]=='F' and a[i+1]=='S': c2=c2+1 if c1>c2: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_208
O(n)
O(1)
input() ins = input() print("YES" if ins.count("SF")>ins.count("FS") else "NO")
1101
867_A. Between the Offices
1101_209
O(n)
O(1)
n=input() t=input() n=0 l=t.count('SF') n=0 n=t.count('FS') print('YES' if (l>n and (l>0 or n>0)) else 'NO')
1101
867_A. Between the Offices
1101_210
null
null
num = int(input('')) string1 = input('') SanFrancisco = string1.count('SF') Seattle = string1.count('FS') if SanFrancisco > Seattle: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_211
O(n)
O(1)
n = int(input()) sttr = input() print('YES' if sttr.count('SF') > sttr.count('FS') else 'NO')
1101
867_A. Between the Offices
1101_212
O(nlogn)
O(1)
n=int(input()) S=input() k=0 k1=0 for i in range(n-1) : if S[i]=='S' and S[i+1]=='F' : k=k+1 if S[i]=='F' and S[i+1]=='S' : k1=k1+1 if k>k1 : print('YES') else : print('NO')
1101
867_A. Between the Offices
1101_213
O(n)
O(n)
day = int(input()) stat = input() if len(stat)>day : print("Wrong input") else : if stat.count("SF")>stat.count("FS") : print("YES") else : print("NO")
1101
867_A. Between the Offices
1101_214
O(n)
O(1)
d = input() n = input() #n1 = n.split('SF') #n2 = n.split('FS') #print(n1,n2) if len(n.split('SF')) > len(n.split('FS')): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_215
O(n)
O(1)
n = int(input()) s = input() cnt = 0 prev = 0 if s[0] == 'F' else 1 for i in range(1, len(s)): cur = 0 if s[i] == 'F' else 1 if cur != prev: if cur == 1: cnt -= 1 else: cnt += 1 prev = cur print('YES' if cnt > 0 else 'NO')
1101
867_A. Between the Offices
1101_216
O(n)
O(n)
#867A in codeforces n = int(input()) stof = 0 ftos = 0 days = list(char for char in input()) city = days[0] for nextcity in days: if city != nextcity: if city == "S": stof += 1 elif city == "F": ftos += 1 city = nextcity if stof>ftos: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_217
O(nlogn)
O(1)
#867A Between the Offices n = int(input()) s = str(input()) ans = 'NO' fly_counter = 0 initial_city = s[0] for i in range(1,n): if s[i] != s[i-1]: fly_counter += 1 if initial_city == 'S': if fly_counter % 2 == 1: ans = 'YES' print(ans)
1101
867_A. Between the Offices
1101_218
O(n)
O(n)
n=int(input()) travel=list(input()) good=0 bad=0 for i in range(1,len(travel)): if travel[i]=='F' and travel[i-1]=='S': good+=1 elif travel[i]=='S' and travel[i-1]=='F': bad+=1 if good>bad: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_219
O(n)
O(1)
n = int(input()) s = input() F_S = 0 S_F = 0 previous = '' for i in s: if i == 'F': if previous == 'S': S_F+=1 elif i == 'S': if previous == 'F': F_S+=1 previous = i if F_S>=S_F: print("NO") else: print("YES")
1101
867_A. Between the Offices
1101_220
O(nlogn)
O(1)
a = int(input()) d = input() s1 = 0 s2 = 0 for q in range(a - 1): if(d[q]=="S" and d[q+1]=="F"): s1 += 1 if (d[q]=="F" and d[q + 1] == "S"): s2 += 1 if(s1>s2): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_221
O(n)
O(1)
input() x = input() y = x[0] si = 0 san = 0 for i in x: if i != y: y = i if i == 'F': san += 1 else: si += 1 if san>si: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_222
O(nlogn)
O(1)
n = int(input()) string = input() s,f = 0,0 for i in range(n-1): if string[i] == "S" and string[i+1] != string[i]: s += 1 elif string[i] == "F" and string[i+1] != string[i]: f += 1 print("YES" if s > f else "NO")
1101
867_A. Between the Offices
1101_223
O(1)
O(1)
input() s = input() print(('NO', 'YES')[s[0] + s[-1] == 'SF'])
1101
867_A. Between the Offices
1101_224
O(1)
O(1)
n=int(input()) str1=input() if str1[0]=='S' and str1[n-1]=='F': print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_225
O(n)
O(n)
p = int(input()) s=input() s=s.upper() count1=0 count2=0 for k in range(0,len(s)-1): if s[k]=='F' and s[k+1]=='S': count1+=1 if s[k]=='S' and s[k+1]=='F': count2+=1 if count2>count1: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_226
O(n)
O(1)
i=input n=int(i()) days=i() if days.count('SF') > days.count('FS'): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_227
O(n)
O(1)
n = int(input()) tour = input() hasil1,hasil2,j = 0,0,1 for i in range(len(tour)): if i != len(tour)-1: if tour[i] == "S" and tour[j] == "F": hasil1 += 1 elif tour[i] == "F"and tour[j] == "S": hasil2 += 1 j += 1 if hasil1 <= hasil2: print("NO") else: print("Y...
1101
867_A. Between the Offices
1101_228
O(nlogn)
O(1)
n = int(input()) a = input() sf = 0 fs = 0 r = a[0] for i in range(1, n): if r != a[i]: if a[i] == "S": r = "S" fs+=1 else: r = "F" sf+=1 if sf > fs: print("yes") else: print("no")
1101
867_A. Between the Offices
1101_229
O(n**2)
O(nlogn)
n = int(input()) s = input() k='' for i in s: if i=='F': k=k+'1' else: k=k+'0' l=len(k) a=0 b=0 for i in range(0,l-1): for j in range(1,l): if(k[i]=='1' and k[j] == '0'): a=a+1 elif(k[i]=='0' and k[j]== '1'): b=b+1 z=(b-a) if z>0: print("YES") el...
1101
867_A. Between the Offices
1101_230
O(n)
O(1)
n = int(input()) st = input() pre = '0' sc = 0 fc = 0 for i in st: if i == 'S' and pre == 'F': fc += 1 elif i =='F' and pre == 'S': sc += 1 pre = i if sc > fc : print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_231
O(nlogn)
O(1)
a = int(input()) s = input() b, l = 0, 0 for i in range(a - 1): if s[i] == 'S' and s[i + 1] == 'F': b += 1 elif s[i] == 'F' and s[i + 1] == 'S': l += 1 if b > l: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_232
O(n)
O(n)
n=int(input()) l=list(input()) a,b=0,0 for i in range(len(l)-1): if l[i]=="S" and l[i+1]=="F": a+=1 elif l[i]=="F" and l[i+1]=="S": b+=1 print("YES" if a>b else "NO")
1101
867_A. Between the Offices
1101_233
O(nlogn)
O(1)
n = int(input()) s = input(); cnt1 = 0 cnt2 = 0 s1 = "" for i in range(1, n): if s[i-1] == "S" and s[i] == "F": cnt1 += 1 elif s[i-1] == "F" and s[i] == "S": cnt2 += 1 if cnt1 > cnt2: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_234
O(1)
O(1)
n = int(input()) s = input() if s[0] == 'S' and s[-1] == 'F': print('Yes') else: print('No')
1101
867_A. Between the Offices
1101_235
O(nlogn)
O(1)
a=int(input()) e=0 b=input() j=0 for i in range(a): if i+1<a: if b[i]=='S' and b[i+1]=='F': e+=1 if b[i]=='F' and b[i+1]=='S': j+=1 if e>j: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_236
O(n)
O(1)
n = int(input()) s = input() F = s.count('SF') S = s.count('FS') if(F > S): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_237
O(n)
O(n)
n = int(input()) s = input().upper() if s[0] == "S" and s[-1]=="F": print("Yes") else: print("No")
1101
867_A. Between the Offices
1101_238
O(nlogn)
O(1)
# import sys # sys.stdin = open('input.txt', 'r') # sys.stdout = open('output.txt', 'w') n=int(input()) s=input() c=0 for i in range(n-1): if s[i]=='S' and s[i+1]=='F': c+=1 if s[i]=='F' and s[i+1]=='S': c-=1 if c>0: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_239
O(1)
O(1)
q = input() a = input() print(['NO','YES'][a[0]=='S' and a[-1]=='F'])