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_40 | O(nlogn) | O(1) | n = int(input())
days = input()
numFS = 0
numSF = 0
for i in range(n-1):
if (days[i] + days[i+1] == 'FS'):
numFS += 1
elif( days[i] + days[i+1] == 'SF'):
numSF += 1
if (numSF > numFS):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_41 | O(nlogn) | O(1) | total_days = int(input())
days = input()
previous_day = days[0]
flight_counts = {
'S': 0,
'F': 0
}
for i in range(1, total_days):
if days[i] is not previous_day:
flight_counts[days[i]] = flight_counts[days[i]] + 1
previous_day = days[i]
if flight_counts['F'] > flight_counts['S']:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_42 | O(n) | O(n) | n = int(input())
l = list(input())
f = 0
s = 0
i=0
while(i<n-1):
if(l[i] == "F"):
if(l[i+1] == "S"):
f=f+1
if(l[i] == "S"):
if(l[i+1] == "F"):
s=s+1
i=i+1
if(s>f):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_43 | O(nlogn) | O(1) | n = int(input())
s = input()
a = 0
b = 0
c = 0
for i in range(n-1):
if(s[i] == s[i+1]):
c += 1
if(c == len(s)-1):
print("NO")
else:
for i in range(n-1):
if(s[i] == 'S' and s[i+1] == 'F'):
a += 1
if(s[i] == 'F' and s[i+1] == 'S'):
b += 1
if(a > b):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_44 | O(n) | O(n) | n=int(input())
s=str(input())
countsf=0
countfs=0
for i in range(n):
if "SF" in s[i:i+2]:
countsf+=1
else:
continue
for j in range(n):
if "FS" in s[j:j+2]:
countfs+=1
else:
continue
if countsf>countfs:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_45 | O(n) | O(n) | n = int(input())
lst = list(input())
count = 0
for i in range(n-1):
if (lst[i]+lst[i+1]=="FS"):
count-=1
if (lst[i]+lst[i+1]=="SF"):
count+=1
if (count>0):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_46 | O(n) | O(1) | class Solver:
def main(self):
_ = input()
flights = input().strip()
print(['No', 'Yes'][int(flights.count('SF') > flights.count('FS'))])
Solver().main()
|
1101 | 867_A. Between the Offices | 1101_47 | O(n) | O(1) | n = int(input())
s = input().strip()
sf = s.count('SF')
fs = s.count('FS')
if sf > fs:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_48 | O(nlogn) | O(1) | n = int(input())
s = input()
c1, c2 = 0, 0
for i in range(1, n):
if s[i - 1] == 'S' and s[i] == 'F':
c1 += 1
elif s[i - 1] == 'F' and s[i] == 'S':
c2 += 1
if c1 > c2:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_49 | O(1) | O(1) | a = input()
x = input()
if x[0]=="S" and x[-1]=="F":
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_50 | O(nlogn) | O(1) | n = int(input())
s = input()
sf =0
ss =0
for i in range(1,n) :
if s[i-1]=='S':
if s[i]=='F':
sf+=1
else:
if s[i]== 'S':
ss+=1
print('YES' if (sf>ss) else 'NO')
|
1101 | 867_A. Between the Offices | 1101_51 | O(nlogn) | O(1) | n=int(input())
k=input()
f=0
s=0
for i in range(n-1):
if "S" in k[i] and 'F' in k[i+1]:
s+=1
elif "F" in k[i] and 'S' in k[i+1]:
f+=1
if s>f:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_52 | O(n) | O(1) | num = int(input())
cities = input()
score = 0
for i in range(len(cities)-1):
flight = cities[i:i+2]
if flight == 'SF':
score += 1
elif flight == 'FS':
score -= 1
if score > 0:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_53 | O(n) | O(n) | n = int(input())
s = list(input())
SF = 0
FS = 0
for i in range(n-1):
if(s[i] == "S" and s[i+1] == "F"):
SF += 1
if(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_54 | O(nlogn) | O(1) | def manager(n, s):
c1 = 0
c2 = 0
for i in range(n - 1):
if(s[i] == 'S' and s[i + 1] == 'F'):
c1 = c1 + 1
elif(s[i] == 'F' and s[i + 1] == 'S'):
c2 = c2 + 1
if(c1 > c2):
return "YES"
else:
return "NO"
n = int(input())
s = str(input())
print(manager(n, s)) |
1101 | 867_A. Between the Offices | 1101_55 | O(1) | O(1) | n=int(input())
f=input()
print("YES") if f[0]=="S" and f[-1]=="F" else print("NO")
|
1101 | 867_A. Between the Offices | 1101_56 | O(nlogn) | O(1) | n =int(input())
string =input()
a =b =0
for i in range(n-1):
if (string[i] == 'S' and string[i+1] == 'F'):
a+=1
elif (string[i] == 'F' and string[i+1] == 'S'):
b+=1
if (a > b):
print ("YES")
exit()
print ("NO") |
1101 | 867_A. Between the Offices | 1101_57 | O(nlogn) | O(1) | n=int(input())
s=input()
sf=0
fs=0
for i in range(n-1):
if s[i]=="F" and s[i+1]=="S":
fs+=1
elif s[i]=="S" and s[i+1]=="F":
sf+=1
if sf>fs:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_58 | O(n) | O(1) | k=int(input())
line=input()
if line.count("SF")>line.count("FS"):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_59 | O(n) | O(1) | n = input()
m = input()
l = len(m)
s = 0
f = 0
for i in range(l):
if i != l-1 and m[i]=='S' and m[i+1]=='F':
s += 1
elif i != l-1 and m[i]=='F' and m[i+1]=='S':
f += 1
if s > f:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_60 | O(nlogn) | O(1) | #from dust i have come dust i will be
n=int(input())
s=input()
sf=0;fs=0
for i in range(n-1):
if s[i]=='F' and s[i+1]=='S':
fs+=1
elif s[i]=='S' and s[i+1]=='F':
sf+=1
if sf>fs:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_61 | O(nlogn) | O(1) | d=int(input())
v=input()
i=0;vs=0;vf=0
while i<d-1:
if v[i]=="F" and v[i+1]=="F":
i=i+1
elif v[i]=="S" and v[i+1]=="S":
i=i+1
elif v[i]=="S" and v[i+1]=="F":
vs=vs+1
i=i+1
elif v[i]=="F" and v[i+1]=="S":
vf=vf+1
i=i+1
if vf>=vs:
print("NO")
else:
print("YES") |
1101 | 867_A. Between the Offices | 1101_62 | O(n) | O(1) | n=input()
a=str(input())
f=0;s=0;t=1
while t<len(a):
if a[t]!=a[t-1]:
if a[t]=='S':
s+=1
else:
f+=1
t+=1
if f<=s:
print("NO")
else:
print("YES")
|
1101 | 867_A. Between the Offices | 1101_63 | O(n) | O(n) | #!/usr/bin/python3
n = int(input())
cities = input()
SF = 0
FS = 0
current_city = cities[0]
for city in cities[1:]:
if(current_city != city):
if(current_city == "S"):
SF = SF + 1
else:
FS = FS + 1
current_city = city
if(SF > FS):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_64 | O(n) | O(1) | n = int(input())
string = str(input())
sf = 0
fs = 0
for i in range(0, n-1):
if string[i:i+2] == "SF":
sf += 1
elif string[i:i+2] == "FS":
fs += 1
if sf > fs:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_65 | O(n) | O(1) | def fr(r, s):
return s[:s.find(r)] + s[s.find(r)+len(r):]
def f(r, s):
a = 0
while r in s: s, a= fr(r, s), a + 1
return a
n, s = int(input()), input()
print('YES' if f('SF', s) > f('FS', s) else 'NO') |
1101 | 867_A. Between the Offices | 1101_66 | O(n) | O(n) | n=int(input())
l=list(input())
sf=0
fs=0
for i in range(n-1):
if l[i]=='F' and l[i+1]=='S':
fs+=1
elif l[i]=='S' and l[i+1]=='F':
sf+=1
if sf>fs:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_67 | O(nlogn) | O(1) | n = input();
n = int(n);
s = input();
flag1=0;
flag2=0;
for i in range(n-1):
if s[i] == 'S':
if s[i]!=s[i+1]:
flag1+=1;
if s[i] == 'F':
if s[i]!= s[i+1]:
flag2+=1;
if flag1>flag2:
print("Yes");
else:
print("No");
|
1101 | 867_A. Between the Offices | 1101_68 | O(nlogn) | O(1) | x = int(input())
y = input()
k = 0
j = 0
for i in range(x):
if i==(x-1):
break
if y[i]=='S' and y[i+1]=='F':
k=k+1
if y[i]=='F' and y[i+1]=='S':
j=j+1
if(k>j):
print("Yes")
else:
print("No")
|
1101 | 867_A. Between the Offices | 1101_69 | O(nlogn) | O(1) |
def main():
n = int(input())
line = input()
FS = 0
SF = 0
for i in range(n -1):
if line[i] != line[i+1]:
if line[i]=="S":
SF +=1
else:
FS +=1
if SF > FS:
return "YES"
else:
return "NO"
print(main()) |
1101 | 867_A. Between the Offices | 1101_70 | O(n) | O(n) | a = input()
a = list(input())
fs, sf = 0, 0
for i in range(len(a)-1):
if a[i] == 'F' and a[i+1] == 'S':
fs += 1
elif a[i] == 'S' and a[i+1] == 'F':
sf += 1
if sf > fs:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_71 | O(nlogn) | O(1) | a = int(input())
n = input()
p = 0
w = 0
for i in range(a - 1):
if n[i] == 'S' and n[i+1] == 'F':
p = p + 1
if n[i] == 'F' and n[i+1] == 'S':
w = w + 1
if p > w:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_72 | O(nlogn) | O(1) | a=int(input())
b=str(input())
x=0
y=0
for i in range(a-1):
if b[i]=='S' and b[i+1]=='F':
x+=1
elif b[i]=='F' and b[i+1]=='S':
y+=1
else:
x+=0
y+=0
if x>y:
print('YES')
elif x==0 or y==0:
print('NO')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_73 | 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_74 | O(nlogn) | O(1) | x=int(input())
a=input()
fgh=0
dfg=0
for i in range(x-1):
if a[i]=='S' and a[i+1]=='F':
fgh+=1
elif a[i]=='F' and a[i+1]=='S':
dfg+=1
if fgh > dfg:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_75 | O(n) | O(n) | n = int(input())
cities = input()
cities = list(cities)
count = 0
var = 0
i = 1
while i <= len(cities) - 1:
if cities[i] == 'F' and cities[i - 1] == 'S':
count += 1
if cities[i] == 'S' and cities[i - 1] == 'F':
var += 1
i += 1
if count > var:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_76 | O(n) | O(n) | import sys
n = int(input())
c = str(input())
if(list(c)[0] == 'S' and list(c)[n - 1] == 'F'):
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_77 | O(nlogn) | O(1) | n = int(input())
flights = input()
f_to_s, s_to_f = 0, 0
for i in range(n - 1):
if flights[i] == 'S' and flights[i + 1] == 'F':
s_to_f += 1
elif flights[i] == 'F' and flights[i + 1] == 'S':
f_to_s += 1
if s_to_f > f_to_s:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_78 | O(nlogn) | O(1) | a=int(input())
b=input()
i=0
countf=0
counts=0
while (i+1)<a:
if b[i]=="F" and b[i+1]=="S":
countf+=1
elif b[i]=="S" and b[i+1]=="F":
counts+=1
i+=1
if counts>countf:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_79 | O(n) | O(1) | x = int(input())
y = input()
if y.count("SF")>y.count("FS"):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_80 | O(n) | O(1) | n=int(input())
m=input()
c=m.count('FS')
d=m.count('SF')
if m=='SF':
print('YES')
elif d>c:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_81 | O(n) | O(1) | n=int(input())
s=input()
if(s.count('SF')>s.count("FS")):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_82 | O(1) | O(1) |
n=int(input())
p=input()
if p.startswith("S") and p.endswith("F"):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_83 | O(n) | O(1) | #Between the Offices
n=int(input())
s=str(input())
sf=s.count("SF")
fs=s.count("FS")
if(sf>fs):
print('YES')
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_84 | O(n) | O(1) | n=int(input())
a=input()
c,d=0,0
for i in range(len(a)-1):
if a[i]=='S' and a[i+1]=='F':
c+=1
elif a[i]=='F'and a[i+1]=='S':
d+=1
if c>d:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_85 | O(1) | O(1) | n=int(input())
s=input()
if(s[0]==s[-1]):
print('NO')
elif(s[0]=='S'):
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_86 | O(nlogn) | O(1) | n = int(input())
f = input()
sf = 0
fs = 0
for i in range(1, n):
if f[i] == 'S' and f[i - 1] == 'F':
fs += 1
if f[i] == 'F' and f[i - 1] == 'S':
sf += 1
print('YES' if sf > fs else 'NO') |
1101 | 867_A. Between the Offices | 1101_87 | O(n) | O(1) | input ();
s = input ();
print (["NO", "YES"][s.count ("SF") > s.count ("FS")]);
|
1101 | 867_A. Between the Offices | 1101_88 | O(1) | O(n) | class CodeforcesTask867ASolution:
def __init__(self):
self.result = ''
self.flights = ''
def read_input(self):
input()
self.flights = input()
def process_task(self):
s_to_f = self.flights.count("SF")
f_to_s = self.flights.count("FS")
if s_to_f > f_to_s:
self.result = "YES"
else:
self.result = "NO"
def get_result(self):
return self.result
if __name__ == "__main__":
Solution = CodeforcesTask867ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())
|
1101 | 867_A. Between the Offices | 1101_89 | null | null | import sys
fin = sys.stdin
fout = sys.stdout
lines = (line.strip() for line in fin)
n = int(next(lines))
trips = next(lines)
total = 0
for i in range(n - 1):
trip = trips[i:i+2]
if trip == 'SF':
total += 1
elif trip == 'FS':
total -= 1
print("YES" if total > 0 else "NO", file=fout)
|
1101 | 867_A. Between the Offices | 1101_90 | O(n) | O(n) | t = int(input())
city = input().upper()
if city.count('SF')>city.count('FS'):
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_91 | O(n) | O(1) | n=int(input())
ch=input()
if ch.count('FS')<ch.count('SF'):
print('yes')
else:
print('no') |
1101 | 867_A. Between the Offices | 1101_92 | null | null | n = int(input())
str = str(input())
i = 0;
while (i < n):
if (str[i] != 'S' and str[i] != 'F'):
print("error")
exit()
i = i + 1
i = 0
count_S = 0
count_F = 0
i = int(i)
while (i < n):
if (i + 1 < n and (str[i] == 'S' and str[i + 1] == 'F')):
count_S += 1
elif (i + 1 < n and (str[i] == 'F' and str[i + 1] == 'S')):
count_F += 1
i += 1
if (count_S > count_F):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_93 | O(1) | O(1) | import sys
import math
def main():
#sys.stdin = open('E:\\Sublime\\in.txt', 'r')
#sys.stdout = open('E:\\Sublime\\out.txt', 'w')
n = int(sys.stdin.readline())
f = (sys.stdin.readline().strip())
if f[0] == 'S' and f[n - 1] == 'F':
print('YES')
else:
print('NO')
if __name__ == '__main__':
main()
#hajj |
1101 | 867_A. Between the Offices | 1101_94 | O(1) | O(1) | #Codeforce 867A
length=int(input())
string1=input()
if string1[0]=="F":
print("No")
elif string1[0]=="S" and string1[length-1]=="S":
print("No")
else:
print("Yes") |
1101 | 867_A. Between the Offices | 1101_95 | O(1) | O(1) | size = int(input())
data = input()
if data[0] == "S" and data[-1] == "F":
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_96 | O(nlogn+m) | O(n) | n1 = input()
arr1 = input()
arr = []
for i in arr1:
arr.append(i)
n = int(n1)
count = 0
for i in range(n):
if arr[i] == 'S' and i + 1 < n:
if arr[i+ 1] == 'F':
count += 1
elif arr[i] == 'F' and i + 1 < n:
if arr[i + 1] == 'S':
count -= 1
if count <= 0:
print("NO")
else:
print("YES") |
1101 | 867_A. Between the Offices | 1101_97 | O(n) | O(1) | n=int(input())
k=input()
sf=0
fs=0
if len(set(k))==1:
print("NO")
else:
for i in range(n-1):
if k[i]=="S" and k[i+1]=="F":
sf+=1
elif k[i]=="F" and k[i+1]=="S":
fs+=1
if sf>fs:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_98 | O(n) | O(1) | aaaaaaaaaaaaa=int(input())
a=input()
g=0
for i in range(1,len(a)):
if a[i]=='S' and a[i-1]=='F':
g-=1
if a[i]=='F' and a[i-1]=='S':
g+=1
if g>0:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_99 | O(n+mlogm) | O(n) | t = int(input())
cities = input()
my_list = []
fs = 0
sf = 0
for char in cities:
my_list.append(char)
for i in range(t-1):
if my_list[i+1] == 'S' and my_list[i] == 'F':
fs+=1
if my_list[i+1] == 'F' and my_list[i] == 'S':
sf+=1
if sf > fs :
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_100 | O(1) | O(1) | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
class Scanner():
@staticmethod
def int():
return int(sys.stdin.readline().rstrip())
@staticmethod
def string():
return sys.stdin.readline().rstrip()
@staticmethod
def map_int():
return [int(x) for x in Scanner.string().split()]
@staticmethod
def string_list(n):
return [input() for i in range(n)]
@staticmethod
def int_list_list(n):
return [Scanner.map_int() for i in range(n)]
@staticmethod
def int_cols_list(n):
return [int(input()) for i in range(n)]
class Math():
@staticmethod
def gcd(a, b):
if b == 0:
return a
return Math.gcd(b, a % b)
@staticmethod
def lcm(a, b):
return (a * b) // Math.gcd(a, b)
@staticmethod
def divisor(n):
res = []
i = 1
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
res.append(i)
if i != n // i:
res.append(n // i)
return res
@staticmethod
def round_up(a, b):
return -(-a // b)
@staticmethod
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
d = int(n ** 0.5) + 1
for i in range(3, d + 1, 2):
if n % i == 0:
return False
return True
class PriorityQueue:
def __init__(self, l=[]):
self.q = l
heapq.heapify(self.q)
return
def push(self, n):
heapq.heappush(self.q, n)
return
def pop(self):
return heapq.heappop(self.q)
MOD = int(1e09) + 7
INF = int(1e15)
def main():
# sys.stdin = open("sample.txt")
N = Scanner.int()
S = Scanner.string()
now = S[0]
cnt = [0] * 2
for i in range(1, N):
if now != S[i]:
cnt[0 if now == 'F' else 1] += 1
now = S[i]
print('YNEOS '[cnt[0] >= cnt[1]::2])
if __name__ == "__main__":
main()
|
1101 | 867_A. Between the Offices | 1101_101 | O(n) | O(n) | n = int(input())
print('YES' if input()[::n - 1] == 'SF' else 'NO') |
1101 | 867_A. Between the Offices | 1101_102 | O(n) | O(n) | '''
Author : thekushalghosh
Team : CodeDiggers
'''
import sys,math
#input = sys.stdin.readline
n = int(input())
a = list(input())
#a.pop()
q = 0
w = 0
for i in range(len(a) - 1):
if a[i] == "S" and a[i + 1] == "F":
q = q + 1
elif a[i] == "F" and a[i + 1] == "S":
w = w + 1
if q > w:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_103 | O(nlogn) | O(1) | n = int(input())
s = input()
a = 0
b = 0
for i in range(n - 1):
if s[i] == 'S' and s[i + 1] == 'F':
a += 1
elif s[i] == 'F' and s[i + 1] == 'S':
b += 1
if a > b:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_104 | O(1) | O(1) | number = input()
arr = input()
print("YES") if arr[0] == "S" and arr[len(arr) - 1] == "F" else print("NO") |
1101 | 867_A. Between the Offices | 1101_105 | O(n) | O(n) |
n = int(input())
fly_di = list(input())
fly_di1 =''.join(fly_di)
a = fly_di1.count("SF")
b = fly_di1.count("FS")
if a > b:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_106 | O(n) | O(1) | n, s = int(input()), input()
print('YES' if s.count('SF') > s.count('FS') else 'NO') |
1101 | 867_A. Between the Offices | 1101_107 | O(n) | O(n) | n = int(input())
nstr = input()
sf_count = 0
fs_count = 0
for x in range(len(nstr)-1):
if nstr[x] != nstr[x+1]:
if nstr[x] == "S":
sf_count +=1
else:
fs_count +=1
if sf_count > fs_count:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_108 | O(n) | O(1) | input()
s = input()
a = s.count('FS')
b = s.count('SF')
if b > a:
print('YES')
else:
print('no')
|
1101 | 867_A. Between the Offices | 1101_109 | O(nlogn) | O(n) | N = int(input())
C = [c for c in input()]
last = C[0]
S, F = 0, 0
for i in range(1,N):
if C[i] != last:
if last=='S':
S+=1
elif last=='F':
F+=1
last = C[i]
if S>F:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_110 | O(n) | O(1) | q = int(input())
c = input()
g = c.replace('SF','1').count('1')
d = c.replace('FS','2').count('2')
if g>d:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_111 | O(n) | O(1) | n=int(input())
s=input()
if (s.count("SF")>s.count("FS")):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_112 | O(n) | O(1) | n=int(input())
s=input()
if "SF" in s and "FS" in s:
if s.count("SF") > s.count("FS"):
print("YES")
else:
print("NO")
elif "SF" in s:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_113 | O(1) | O(1) | n = int(input())
s = input()
print("YES" if s[0] == 'S' and s[-1] == 'F' else "NO")
|
1101 | 867_A. Between the Offices | 1101_114 | 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_115 | null | null | from sys import stdin,stdout
n=int(stdin.readline())
s=stdin.readline()
if(s[0]=="S" and s[n-1]=="F"):
stdout.write("YES")
else:
stdout.write("NO") |
1101 | 867_A. Between the Offices | 1101_116 | O(nlogn) | O(1) | t=int(input())
s=input()
y=0
n=0
for i in range(t-1):
if s[i]=="S" and s[i+1]=="F":
y=y+1
elif s[i]=="F" and s[i+1]=="S":
n=n+1
if y>n:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_117 | O(n) | O(1) | n=int(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_118 | O(nlogn) | O(1) | n=int(input())
s=input()
c1=0
c2=0
for i in range(n-1):
if s[i]=="S" and s[i+1]=="F":
c1+=1
elif s[i]=="F" and s[i+1]=="S":
c2+=1
if c1>c2:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_119 | O(1) | O(1) | a = int(input())
s = input()
if s[0] == 'F':
print("NO")
else:
if s[a - 1] == 'F':
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_120 | O(n) | O(1) | n = input()
s = input()
ans = 0
for i in range(2, len(s) + 1):
if s[i-2:i] == "SF":
ans += 1
elif s[i-2:i] == "FS":
ans -= 1
if ans > 0:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_121 | O(1) | O(1) | n = int(input())
a = input()
if a[0] == 'S' and a[n-1] == 'F':
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_122 | O(n) | O(1) | n = int(input())
places = input()
it = iter(places)
prev_city = next(it)
sf, fs = 0, 0
for city in it:
if prev_city != city:
if city == 'F':
sf += 1
else:
fs += 1
prev_city = city
if sf > fs:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_123 | O(n) | O(1) | a = int(input())
s = input()
s_to_f = s.count('SF')
f_to_s = s.count('FS')
if s_to_f > f_to_s:
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_124 | O(nlogn) | O(1) | n = int(input())
c = str(input())
S = 0
F = 0
for i in range(n - 1):
if c[i] == "S" and c[i + 1] == "F":
S += 1
if c[i] == "F" and c[i + 1] == "S":
F += 1
if S > F:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_125 | O(n) | O(1) | def dkwpwn(string):
sfcount = fscount = 0
for i in range(len(string)-1):
if string[i]=='S'and string[i+1]=='F':
sfcount += 1
elif string[i] == 'F' and string[i+1]=='S':
fscount+=1
return 'YES' if sfcount>fscount else 'NO'
useless = int(input())
string = input()
print(dkwpwn(string))
|
1101 | 867_A. Between the Offices | 1101_126 | O(n) | O(1) | n=int(input())
a = input()
i=1
f=0
k=0
while(i<len(a)):
if(a[i-1]=='S' and a[i]=='F'):
f+=1
if(a[i-1]=='F' and a[i]=='S'):
k+=1
i+=1
if(f>k):
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_127 | O(nlogn) | O(1) | n = int(input())
s = input()
x = 0
for i in range(1,n):
if s[i-1] != s[i]:
if s[i-1] == 'S' and s[i] =='F':
x += 1
else:
x -= 1
if x > 0:
print('YES')
else:
print('NO')
|
1101 | 867_A. Between the Offices | 1101_128 | O(n) | O(1) | n = int(input())
s = input()
cnt1, cnt2 = s.count("FS"), s.count("SF")
print("YES" if cnt2 > cnt1 else "NO") |
1101 | 867_A. Between the Offices | 1101_129 | O(n) | O(1) | n=int(input())
s=input()
x=s.count('SF')
y=s.count('FS')
if(x>y):
print('YES')
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_130 | O(nlogn) | O(n) | # Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon!
n=int(input())
s=input()
k=''
for i in range(n-1):
if(s[i]!=s[i+1]):
k=k+s[i]
k=k+s[n-1]
sc=0
fc=0
for i in range(len(k)-1):
if(k[i]=='S' and k[i+1]=='F'):
sc+=1
elif(k[i]=='F' and k[i+1]=='S'):
fc+=1
if(sc>fc):
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_131 | O(n) | O(1) | a = int(input())
b = input()
a1 = b.count("SF")
a2 = b.count("FS")
if a1 > a2:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_132 | O(n) | O(n) | input()
s = ''
for c in input():
if not s or s[-1] != c:
s += c
s = s[1:]
print('YES' if s.count('F') > s.count('S') else 'NO') |
1101 | 867_A. Between the Offices | 1101_133 | O(n) | O(1) |
cnt = int(input())
locs = input()
pre, sf, fs = locs[0], 0, 0
for i in range(1, len(locs)):
if pre != locs[i]:
if locs[i] == 'S':
fs += 1
elif locs[i] == 'F':
sf += 1
pre = locs[i]
if sf > fs:
print("YES")
else:
print("NO") |
1101 | 867_A. Between the Offices | 1101_134 | O(n) | O(1) | # https://codeforces.com/problemset/problem/867/A
input()
s = input()
# SF = travel Seattle to San Francisco
# FS = travel San Francisco to Seattle
print('YES' if s.count('SF') > s.count('FS') else 'NO')
|
1101 | 867_A. Between the Offices | 1101_135 | O(n) | O(1) | input()
string = input()
SF =0
FS = 0
current = string[0]
for city in string:
if city!= current:
if current == 'S':
SF+=1
else:
FS+=1
current = city
if SF>FS:
print("YES")
else:
print("NO")
|
1101 | 867_A. Between the Offices | 1101_136 | O(n) | O(1) | x=input()
n=input()
if n.count('SF') > n.count('FS'):
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_137 | O(1) | O(1) | n = int(input())
f = input()
#sf = 0
#fs = 0
#for i in range(1, n):
# if f[i] == 'S' and f[i - 1] == 'F':
# fs += 1
# if f[i] == 'F' and f[i - 1] == 'S':
# sf += 1
#print('YES' if sf > fs else 'NO')
print('YES' if f[0] == 'S' and f[-1] == 'F' else 'NO') |
1101 | 867_A. Between the Offices | 1101_138 | O(n) | O(1) | n = int(input())
x = input()
if x.count('SF')>x.count('FS'):
print('YES')
else:
print('NO') |
1101 | 867_A. Between the Offices | 1101_139 | O(n) | O(1) | n=int(input())
st=input()
c1=0
c2=0
for i in range(1,len(st)):
if st[i]=='F' and st[i-1]=='S':
c1=c1+1
elif st[i]=='S' and st[i-1]=='F':
c2=c2+1
if c1>c2:
print("YES")
else:
print("NO")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.