PythonProgrammingPuzzles icon indicating copy to clipboard operation
PythonProgrammingPuzzles copied to clipboard

New puzzle from codeforces 136 A

Open akalai opened this issue 4 years ago • 0 comments

def sat(indexes):
    """
    Given a list of integers representing a permutation, invert the permutation.

    Inspired by [Codeforces Problem 136 A](https://codeforces.com/problemset/problem/136/A)
    """
    target=[1, 3, 4, 2, 5, 6, 7]
    for i in range(1, len(target) + 1):
        if target[indexes[i - 1] - 1] != i:
            return False
    return True

Solvers, post your solutions in the comments using the following formatting:

<details><summary>Reveal solution</summary>

```python
def sol():
    return "world"  # replace with your solution
```
</details>

akalai avatar Jul 12 '21 23:07 akalai