From 7a91bc505ef226a364e646c560185eb1126379bd Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Wed, 4 Oct 2017 02:06:47 +0530 Subject: [PATCH 01/10] Create palingam.py --- 2017/AUG/AUG17/PALINGAM/palingam.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 2017/AUG/AUG17/PALINGAM/palingam.py diff --git a/2017/AUG/AUG17/PALINGAM/palingam.py b/2017/AUG/AUG17/PALINGAM/palingam.py new file mode 100644 index 0000000..650e06e --- /dev/null +++ b/2017/AUG/AUG17/PALINGAM/palingam.py @@ -0,0 +1,31 @@ +t=int(input()) +while(t>0): + a=input() + b=input() + la=list() + lb=list() + la=26*[0] + lb=26*[0] + sa=set() + sb=set() + for i in range(len(a)): + la[ord(a[i])-ord('a')]+=1 + lb[ord(b[i]) - ord('a')] += 1 + sa.add(a[i]) + sb.add(b[i]) + p=int(1) + for i in range(26): + if(la[i]>1 and lb[i]==0): + p=0 + print("A") + break + elif sb.issubset(sa) and not(sb.issuperset(sa)): + print("A") + p=0 + break + if(p==1): + print("B") + t-=1 + + + From 65b7781661ecb00be8d3d7ca99e326d6c653f49f Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Wed, 4 Oct 2017 13:34:30 +0530 Subject: [PATCH 02/10] Update palingam.py --- 2017/AUG/AUG17/PALINGAM/palingam.py | 37 +++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/2017/AUG/AUG17/PALINGAM/palingam.py b/2017/AUG/AUG17/PALINGAM/palingam.py index 650e06e..1c341b0 100644 --- a/2017/AUG/AUG17/PALINGAM/palingam.py +++ b/2017/AUG/AUG17/PALINGAM/palingam.py @@ -1,31 +1,28 @@ -t=int(input()) -while(t>0): - a=input() - b=input() - la=list() - lb=list() - la=26*[0] - lb=26*[0] - sa=set() - sb=set() +t = int(input()) +while t > 0 : + a = input() + b = input() + la = list() + lb = list() + la = 26*[0] + lb = 26*[0] + sa = set() + sb = set() for i in range(len(a)): - la[ord(a[i])-ord('a')]+=1 + la[ord(a[i]) - ord('a')] += 1 lb[ord(b[i]) - ord('a')] += 1 sa.add(a[i]) sb.add(b[i]) - p=int(1) + p = int(1) for i in range(26): - if(la[i]>1 and lb[i]==0): - p=0 + if la[i]>1 and lb[i] == 0: + p = 0 print("A") break elif sb.issubset(sa) and not(sb.issuperset(sa)): print("A") - p=0 + p = 0 break - if(p==1): + if p == 1: print("B") - t-=1 - - - + t -= 1 From e1d3dee541a2f67235e9035c328d66ac0998faae Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Wed, 4 Oct 2017 19:29:42 +0530 Subject: [PATCH 03/10] Update palingam.py --- 2017/AUG/AUG17/PALINGAM/palingam.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2017/AUG/AUG17/PALINGAM/palingam.py b/2017/AUG/AUG17/PALINGAM/palingam.py index 1c341b0..2675c87 100644 --- a/2017/AUG/AUG17/PALINGAM/palingam.py +++ b/2017/AUG/AUG17/PALINGAM/palingam.py @@ -4,8 +4,8 @@ b = input() la = list() lb = list() - la = 26*[0] - lb = 26*[0] + la = 26 * [0] + lb = 26 * [0] sa = set() sb = set() for i in range(len(a)): @@ -15,7 +15,7 @@ sb.add(b[i]) p = int(1) for i in range(26): - if la[i]>1 and lb[i] == 0: + if la[i] > 1 and lb[i] == 0: p = 0 print("A") break From dc99cf23f882914da763c1a9f9cd54e22c1a12cb Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Wed, 4 Oct 2017 21:48:48 +0530 Subject: [PATCH 04/10] Update AUG.md --- 2017/AUG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2017/AUG.md b/2017/AUG.md index 7bd28ad..60186b0 100644 --- a/2017/AUG.md +++ b/2017/AUG.md @@ -12,7 +12,7 @@ | [AUG17](https://www.codechef.com/AUG17) | [RAINBOWA](https://www.codechef.com/AUG17/problems/RAINBOWA) | ★★ | | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14909134) (100 pts) [![image](../img/AC.png)](#) | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.java) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14859923) (100 pts) [![image](../img/AC.png)](#) | | | [AUG17](https://www.codechef.com/AUG17) | [CHEFMOVR](https://www.codechef.com/AUG17/problems/CHEFMOVR) | ★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [GCAC](https://www.codechef.com/AUG17/problems/GCAC) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/GCAC/GCAC.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14947059) (100 pts) [![image](../img/AC.png)](#) | | | -| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | | | | +| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | | | [![image](../img/GH.png)](AUG/AUG16/PALINGAM/PALINGAM.c) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15596349) (100 pts) [![image](../img/AC.png)](#)| | [AUG17](https://www.codechef.com/AUG17) | [CHEFFA](https://www.codechef.com/AUG17/problems/CHEFFA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [STRINGRA](https://www.codechef.com/AUG17/problems/STRINGRA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [MATDW](https://www.codechef.com/AUG17/problems/MATDW) | ★★★★ | | | | | From 080001b409bf1c9a8f99bc1ed9062ca7acd08c16 Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Fri, 6 Oct 2017 13:36:18 +0530 Subject: [PATCH 05/10] Update palingam.py --- 2017/AUG/AUG17/PALINGAM/palingam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2017/AUG/AUG17/PALINGAM/palingam.py b/2017/AUG/AUG17/PALINGAM/palingam.py index 2675c87..640bb88 100644 --- a/2017/AUG/AUG17/PALINGAM/palingam.py +++ b/2017/AUG/AUG17/PALINGAM/palingam.py @@ -1,5 +1,5 @@ t = int(input()) -while t > 0 : +while t > 0: a = input() b = input() la = list() From 61accefe0223feb641885c3605a3ed9a24b8d547 Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Fri, 6 Oct 2017 22:00:32 +0530 Subject: [PATCH 06/10] Update AUG.md --- 2017/AUG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2017/AUG.md b/2017/AUG.md index 5efc1b9..212a1db 100644 --- a/2017/AUG.md +++ b/2017/AUG.md @@ -12,7 +12,7 @@ | [AUG17](https://www.codechef.com/AUG17) | [RAINBOWA](https://www.codechef.com/AUG17/problems/RAINBOWA) | ★★ | | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14909134) (100 pts) [![image](../img/AC.png)](#) | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.java) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14859923) (100 pts) [![image](../img/AC.png)](#) | | | [AUG17](https://www.codechef.com/AUG17) | [CHEFMOVR](https://www.codechef.com/AUG17/problems/CHEFMOVR) | ★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [GCAC](https://www.codechef.com/AUG17/problems/GCAC) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/GCAC/GCAC.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14947059) (100 pts) [![image](../img/AC.png)](#) | | | -| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/PALINGAM/PALINGAM.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14908284) (100 pts) [![image](../img/AC.png)](#) | | [![image](../img/GH.png)](AUG/AUG16/PALINGAM/PALINGAM.c) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15596349) (100 pts) [![image](../img/AC.png)](#)| +| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/PALINGAM/PALINGAM.cpp)  [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14908284) (100 pts) [![image](../img/AC.png)](#) | | [![image](../img/GH.png)](AUG/AUG16/PALINGAM/PALINGAM.py) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15596349) (100 pts) [![image](../img/AC.png)](#)| | [AUG17](https://www.codechef.com/AUG17) | [CHEFFA](https://www.codechef.com/AUG17/problems/CHEFFA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [STRINGRA](https://www.codechef.com/AUG17/problems/STRINGRA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [MATDW](https://www.codechef.com/AUG17/problems/MATDW) | ★★★★ | | | | | From 400ce82783623148fca365f4cd0ef3f75c8fa666 Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Sun, 15 Oct 2017 12:28:40 +0530 Subject: [PATCH 07/10] Update AUG.md --- 2017/AUG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2017/AUG.md b/2017/AUG.md index 212a1db..379c91f 100644 --- a/2017/AUG.md +++ b/2017/AUG.md @@ -12,7 +12,7 @@ | [AUG17](https://www.codechef.com/AUG17) | [RAINBOWA](https://www.codechef.com/AUG17/problems/RAINBOWA) | ★★ | | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14909134) (100 pts) [![image](../img/AC.png)](#) | [![image](../img/GH.png)](AUG/AUG17/RAINBOWA/RAINBOWA.java) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14859923) (100 pts) [![image](../img/AC.png)](#) | | | [AUG17](https://www.codechef.com/AUG17) | [CHEFMOVR](https://www.codechef.com/AUG17/problems/CHEFMOVR) | ★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [GCAC](https://www.codechef.com/AUG17/problems/GCAC) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/GCAC/GCAC.cpp) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14947059) (100 pts) [![image](../img/AC.png)](#) | | | -| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/PALINGAM/PALINGAM.cpp)  [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14908284) (100 pts) [![image](../img/AC.png)](#) | | [![image](../img/GH.png)](AUG/AUG16/PALINGAM/PALINGAM.py) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15596349) (100 pts) [![image](../img/AC.png)](#)| +| [AUG17](https://www.codechef.com/AUG17) | [PALINGAM](https://www.codechef.com/AUG17/problems/PALINGAM) | ★★★ | | [![image](../img/GH.png)](AUG/AUG17/PALINGAM/PALINGAM.cpp)  [![image](../img/CC.png)](https://www.codechef.com/viewsolution/14908284) (100 pts) [![image](../img/AC.png)](#) | | [![image](../img/GH.png)](AUG/AUG16/PALINGAM/PALINGAM.py) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15596349) (100 pts) [![image](../img/AC.png)](#) | | [AUG17](https://www.codechef.com/AUG17) | [CHEFFA](https://www.codechef.com/AUG17/problems/CHEFFA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [STRINGRA](https://www.codechef.com/AUG17/problems/STRINGRA) | ★★★★ | | | | | | [AUG17](https://www.codechef.com/AUG17) | [MATDW](https://www.codechef.com/AUG17/problems/MATDW) | ★★★★ | | | | | From d3d53a539a646261e25aaf24328f1e149850d283 Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Sun, 15 Oct 2017 12:51:43 +0530 Subject: [PATCH 08/10] Create OBTTRNGL.PY --- 2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY diff --git a/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY new file mode 100644 index 0000000..268da9f --- /dev/null +++ b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY @@ -0,0 +1,14 @@ +t = int(input()) +for i in range(t): + n,x,y = map(int ,input().split()) + a = min(x,y) + b = max(x,y) + b = b - a + 1 + a = 1 + if (n%2 == 0 and n/2 == b-a) or (b - a == 1 or b == n): + print("0") + else: + if b > n/2 + 1: + print(n - b) + elif b < n/2 + 1: + print(b - 2) From 88a15b46c717e0b010a8b4bd5bf85de6fe931fda Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Sun, 15 Oct 2017 12:57:11 +0530 Subject: [PATCH 09/10] Update OBTTRNGL.PY --- 2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY index 268da9f..3b97bc3 100644 --- a/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY +++ b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY @@ -1,14 +1,19 @@ -t = int(input()) -for i in range(t): - n,x,y = map(int ,input().split()) - a = min(x,y) - b = max(x,y) - b = b - a + 1 - a = 1 - if (n%2 == 0 and n/2 == b-a) or (b - a == 1 or b == n): - print("0") - else: - if b > n/2 + 1: - print(n - b) - elif b < n/2 + 1: - print(b - 2) +def main(): + t = int(input()) + for i in range(t): + n,x,y = map(int ,input().split()) + a = min(x,y) + b = max(x,y) + b = b - a + 1 + a = 1 + if (n%2 == 0 and n/2 == b - a) or (b - a == 1 or b == n): + print("0") + else: + if b > n/2 + 1: + print(n - b) + elif b < n/2 + 1: + print(b - 2) + + +if __name__ == '__main__': + main() From 01141c0557b77eedbd6d178b9d754bc0dd48821c Mon Sep 17 00:00:00 2001 From: Avkaran singh Date: Sun, 15 Oct 2017 12:59:51 +0530 Subject: [PATCH 10/10] Update OBTTRNGL.PY