Task: | Grid Paths II |
Sender: | lnan95 |
Submission time: | 2020-09-19 13:42:41 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | RUNTIME ERROR | 0.33 s | details |
#7 | RUNTIME ERROR | 0.33 s | details |
#8 | RUNTIME ERROR | 0.33 s | details |
#9 | RUNTIME ERROR | 0.33 s | details |
#10 | RUNTIME ERROR | 0.35 s | details |
Code
#include <bits/stdc++.h> using namespace std; int dx[4] {1, 0, -1, 0}; int dy[4] {0, 1, 0, -1}; set<pair<int, int>> traps; vector<vector<int>> dp {}; int M = 1e9+7; int main () { int n, m; cin >> n >> m; dp = vector<vector<int>> (n+1, vector<int>(n+1)); for (int i=0; i<m; i++) { int a, b; cin >> a >> b; traps.insert({a, b}); } dp[0][1] = 1; for (int i=1; i<=n; i++) { for (int j=1; j<=n; j++) { if (traps.find({i,j}) != traps.end()) { dp[i][j] = 0; } else { dp[i][j] = dp[i-1][j]%M + dp[i][j-1]%M; dp[i][j] %= M; } } } cout << dp[n][n]; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100 1000 41 11 11 24 51 72 47 31 ... |
correct output |
---|
342758070 |
user output |
---|
342758070 |
Test 2
Verdict: ACCEPTED
input |
---|
100 1000 83 37 24 1 52 42 86 36 ... |
correct output |
---|
919249325 |
user output |
---|
919249325 |
Test 3
Verdict: ACCEPTED
input |
---|
100 1000 99 28 16 31 92 41 39 65 ... |
correct output |
---|
12649242 |
user output |
---|
12649242 |
Test 4
Verdict: ACCEPTED
input |
---|
100 1000 5 47 32 1 27 70 86 39 ... |
correct output |
---|
466313473 |
user output |
---|
466313473 |
Test 5
Verdict: ACCEPTED
input |
---|
100 1000 14 28 63 16 15 54 68 18 ... |
correct output |
---|
525088588 |
user output |
---|
525088588 |
Test 6
Verdict: RUNTIME ERROR
input |
---|
1000000 1000 332974 646000 669874 23872 662362 92533 670177 367382 ... |
correct output |
---|
476425733 |
user output |
---|
(empty) |
Test 7
Verdict: RUNTIME ERROR
input |
---|
1000000 1000 474616 793877 452016 207512 940198 719201 162471 997296 ... |
correct output |
---|
757933231 |
user output |
---|
(empty) |
Test 8
Verdict: RUNTIME ERROR
input |
---|
1000000 1000 125814 37785 523915 416397 246681 345297 635386 245404 ... |
correct output |
---|
672607703 |
user output |
---|
(empty) |
Test 9
Verdict: RUNTIME ERROR
input |
---|
1000000 1000 468197 471455 970002 408761 420246 765021 8126 930827 ... |
correct output |
---|
138494458 |
user output |
---|
(empty) |
Test 10
Verdict: RUNTIME ERROR
input |
---|
1000000 1000 837278 905086 893778 245584 867013 721507 404988 868333 ... |
correct output |
---|
796948966 |
user output |
---|
(empty) |