diff --git a/2017/AUG.md b/2017/AUG.md index d2640c7..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)](#) | | | +| [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) | ★★★★ | | | | | diff --git a/2017/AUG/AUG17/PALINGAM/palingam.py b/2017/AUG/AUG17/PALINGAM/palingam.py new file mode 100644 index 0000000..640bb88 --- /dev/null +++ b/2017/AUG/AUG17/PALINGAM/palingam.py @@ -0,0 +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() + 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 diff --git a/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY new file mode 100644 index 0000000..3b97bc3 --- /dev/null +++ b/2017/AUG/COOK85/OBTTRNGL/OBTTRNGL.PY @@ -0,0 +1,19 @@ +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()