From 0c7c64e3415604d9b989247e7bdbb852f70e7ce4 Mon Sep 17 00:00:00 2001 From: ceciliakemiac Date: Tue, 15 Oct 2019 22:42:22 -0300 Subject: [PATCH 1/2] city day --- Codeforces/city_day.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Codeforces/city_day.py diff --git a/Codeforces/city_day.py b/Codeforces/city_day.py new file mode 100644 index 0000000..c281b35 --- /dev/null +++ b/Codeforces/city_day.py @@ -0,0 +1,42 @@ +Problem statement : https://codeforces.com/contest/1199/problem/A + +Solution : + +n, x, y = [int(x) for x in input().split(' ')] +ent = input().split(' ') + +for i in range(n): + ent[i] = int(ent[i]) + +pos = 0 +while True: + resp = 'yeap' + for i in range(x): + if (pos - i - 1) < 0 or pos < 0 or pos > len(ent) - 1: + break + + if ent[pos - i - 1] <= ent[pos]: + resp = 'nope' + break + if resp != 'nope': + for i in range(y): + if (pos + i + 1) > len(ent) - 1 or pos < 0 or pos > len(ent) - 1: + break + + if ent[pos + i + 1] <= ent[pos]: + resp = 'nope' + break + + if resp == 'nope': + pos += 1 + resp = 'yeap' + else: + break + +if pos >= len(ent): + print (pos) +else: + print (pos + 1) + + + From 0fbb0fc3efaa8d939e0ac887f30a8c844c395614 Mon Sep 17 00:00:00 2001 From: ceciliakemiac Date: Tue, 15 Oct 2019 22:44:13 -0300 Subject: [PATCH 2/2] city day --- Codeforces/city_day.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Codeforces/city_day.py b/Codeforces/city_day.py index c281b35..4dc64b7 100644 --- a/Codeforces/city_day.py +++ b/Codeforces/city_day.py @@ -37,6 +37,4 @@ print (pos) else: print (pos + 1) - - - + \ No newline at end of file