File size: 2,052 Bytes
01a492e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import subprocess
import sys
from pathlib import Path

cases = [{'input': '5 5\n', 'output': 'YES\n1 2 131072 131078 0 \n'}, {'input': '3 6\n', 'output': 'YES\n131072 131078 0 \n'}, {'input': '3 0\n', 'output': 'YES\n393216 131072 262144\n'}, {'input': '1 0\n', 'output': 'YES\n0\n'}, {'input': '3 3\n', 'output': 'YES\n131072 131075 0 \n'}, {'input': '32 32\n', 'output': 'YES\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 131072 131105 0 \n'}, {'input': '32 31\n', 'output': 'YES\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 131072 131102 0 \n'}, {'input': '1 1\n', 'output': 'YES\n1\n'}, {'input': '2 0\n', 'output': 'NO\n'}, {'input': '3 1\n', 'output': 'YES\n131072 131073 0 \n'}, {'input': '3 2\n', 'output': 'YES\n131072 131074 0 \n'}, {'input': '3 5\n', 'output': 'YES\n131072 131077 0 \n'}, {'input': '3 4\n', 'output': 'YES\n131072 131076 0 \n'}, {'input': '3 10203\n', 'output': 'YES\n131072 141275 0 \n'}, {'input': '3 10100\n', 'output': 'YES\n131072 141172 0 \n'}, {'input': '5 0\n', 'output': 'YES\n1 2 131072 131075 0 \n'}, {'input': '5 1\n', 'output': 'YES\n1 2 131072 131074 0 \n'}, {'input': '5 2\n', 'output': 'YES\n1 2 131072 131073 0 \n'}, {'input': '5 3\n', 'output': 'YES\n1 2 393216 131072 262144\n'}, {'input': '5 4\n', 'output': 'YES\n1 2 131072 131079 0 \n'}]
solution = Path(__file__).with_name("solution.py")
for index, case in enumerate(cases):
    proc = subprocess.run(
        [sys.executable, str(solution)],
        input=case["input"],
        text=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        timeout=10,
    )
    if proc.returncode != 0:
        raise AssertionError(f"case {index} exited {proc.returncode}: {proc.stderr}")
    got = proc.stdout.strip()
    expected = case["output"].strip()
    if got.split() != expected.split():
        raise AssertionError(
            f"case {index} output mismatch\nexpected={expected!r}\ngot={got!r}\nstderr={proc.stderr}"
        )
print('deepcoder_primeintellect_io')