Submission details
Task:Grid Paths II
Sender:taige
Submission time:2020-09-19 15:58:38 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.08 sdetails
#20.07 sdetails
#30.07 sdetails
#40.08 sdetails
#50.07 sdetails
#60.52 sdetails
#70.52 sdetails
#80.51 sdetails
#90.51 sdetails
#100.51 sdetails

Code



def main():
    n, m = [int(x) for x in input().split()]
    x = [[0 for i in range(10)] for j in range(n)]
    x[0][:] = 1
    x[:][0] = 1
    for _ in range(m):
        a, b = [int(x) for x in input().split()]
        x[a-1][b-1] = None

    for s in range(1, n):
        for j in range(s, n):
            if x[s][j] is not None:
                x[s][j] = x[s][j-1] + x[s-1][j]


    print(x[n-1][n-1] % (10**9 + 7))

main()


    # def calculateCurrent(x, y):
    #     if x == y == 0:
    #         return 1
    #     elif x == -1 or y == -1:
    #         return 0
    #     elif [x, y] in trap:
    #         return 0
    #     else:
    #         return calculateCurrent(x-1, y) + calculateCurrent(x, y-1)

Test details

Test 1

Verdict:

input
100 1000
41 11
11 24
51 72
47 31
...

correct output
342758070

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 2

Verdict:

input
100 1000
83 37
24 1
52 42
86 36
...

correct output
919249325

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 3

Verdict:

input
100 1000
99 28
16 31
92 41
39 65
...

correct output
12649242

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 4

Verdict:

input
100 1000
5 47
32 1
27 70
86 39
...

correct output
466313473

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 5

Verdict:

input
100 1000
14 28
63 16
15 54
68 18
...

correct output
525088588

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 6

Verdict:

input
1000000 1000
332974 646000
669874 23872
662362 92533
670177 367382
...

correct output
476425733

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 7

Verdict:

input
1000000 1000
474616 793877
452016 207512
940198 719201
162471 997296
...

correct output
757933231

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 8

Verdict:

input
1000000 1000
125814 37785
523915 416397
246681 345297
635386 245404
...

correct output
672607703

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 9

Verdict:

input
1000000 1000
468197 471455
970002 408761
420246 765021
8126 930827
...

correct output
138494458

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...

Test 10

Verdict:

input
1000000 1000
837278 905086
893778 245584
867013 721507
404988 868333
...

correct output
796948966

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 21, in <module>
    main()...