CSES - Leirikisa 5 - Results
Submission details
Task:jedan
Sender:siirikuoppala
Submission time:2016-08-02 17:22:48 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2ACCEPTED0.06 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.06 sdetails
#5ACCEPTED0.05 sdetails
#60.07 sdetails
#7ACCEPTED0.06 sdetails
#8ACCEPTED0.06 sdetails
#9ACCEPTED0.06 sdetails
#10ACCEPTED0.07 sdetails
#11ACCEPTED0.06 sdetails
#12ACCEPTED0.06 sdetails
#13ACCEPTED0.07 sdetails
#14ACCEPTED0.07 sdetails
#15ACCEPTED0.07 sdetails
#16ACCEPTED0.07 sdetails
#17ACCEPTED0.07 sdetails
#18ACCEPTED0.06 sdetails
#19ACCEPTED0.06 sdetails
#20ACCEPTED0.06 sdetails
#21ACCEPTED0.06 sdetails
#22ACCEPTED0.06 sdetails
#23ACCEPTED0.06 sdetails
#24ACCEPTED0.09 sdetails
#250.08 sdetails
#260.08 sdetails
#270.09 sdetails
#280.08 sdetails
#290.08 sdetails
#300.09 sdetails
#310.09 sdetails
#320.09 sdetails
#330.09 sdetails
#340.09 sdetails
#350.09 sdetails
#360.08 sdetails
#370.08 sdetails
#380.08 sdetails

Code

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define M 1000000007
vector<ll> t[10101];
int A[10101];
int main(){
    int n;
    cin >> n;
    for(int i=0; i<n; ++i){
        cin >> A[i];
    }
    if(A[0]==-1) A[0]=0;
    t[0].resize(10101);
    t[0][0]=1;
    for(int i=1; i<n; ++i){
        t[i].resize(10101);
        int h=A[i-1]+1;
        if(A[i]!=-1){
            int u=A[i];
            t[i][u]= t[i-1][u]+t[i-1][u+1];
            if(u>0) t[i][u]+=t[i-1][u-1];
            t[i][u]%=M;
            continue;
        }
        for(int j=0; j<=h; ++j){
            if(j>0) t[i][j]+= t[i-1][j-1];
            t[i][j]+=t[i-1][j];
            t[i][j]+=t[i-1][j+1];
            t[i][j]%=M;
        }t[i-1].resize(0);
        A[i]=h;
    }
    cout << t[n-1][0];
}

Test details

Test 1

Verdict: ACCEPTED

input
3
-1 2 -1

correct output
0

user output
0

Test 2

Verdict: ACCEPTED

input
3
-1 -1 -1

correct output
2

user output
2

Test 3

Verdict: ACCEPTED

input
6
-1 -1 -1 2 -1 -1

correct output
3

user output
3

Test 4

Verdict: ACCEPTED

input
1
-1

correct output
1

user output
1

Test 5

Verdict: ACCEPTED

input
1
0

correct output
1

user output
1

Test 6

Verdict:

input
1
1

correct output
0

user output
1

Test 7

Verdict: ACCEPTED

input
15
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
113634

user output
113634

Test 8

Verdict: ACCEPTED

input
30
-1 -1 -1 -1 -1 -1 -1 -1 7 -1 -...

correct output
33792

user output
33792

Test 9

Verdict: ACCEPTED

input
40
-1 -1 -1 -1 -1 -1 -1 6 -1 -1 -...

correct output
44058168

user output
44058168

Test 10

Verdict: ACCEPTED

input
50
-1 -1 -1 -1 4 -1 -1 -1 -1 -1 -...

correct output
885261321

user output
885261321

Test 11

Verdict: ACCEPTED

input
100
-1 -1 -1 -1 -1 -1 -1 -1 7 -1 -...

correct output
630105363

user output
630105363

Test 12

Verdict: ACCEPTED

input
200
0 -1 -1 -1 4 -1 -1 -1 -1 0 -1 ...

correct output
584749136

user output
584749136

Test 13

Verdict: ACCEPTED

input
300
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -...

correct output
440962689

user output
440962689

Test 14

Verdict: ACCEPTED

input
500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
861085225

user output
861085225

Test 15

Verdict: ACCEPTED

input
499
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
686858355

user output
686858355

Test 16

Verdict: ACCEPTED

input
500
0 0 -1 -1 -1 3 -1 -1 -1 6 6 -1...

correct output
287620623

user output
287620623

Test 17

Verdict: ACCEPTED

input
500
0 -1 -1 1 -1 0 -1 0 -1 -1 3 -1...

correct output
132437565

user output
132437565

Test 18

Verdict: ACCEPTED

input
500
0 -1 1 -1 2 2 -1 4 -1 -1 -1 1 ...

correct output
545015067

user output
545015067

Test 19

Verdict: ACCEPTED

input
500
-1 1 1 -1 1 -1 1 -1 -1 1 -1 -1...

correct output
394701022

user output
394701022

Test 20

Verdict: ACCEPTED

input
500
0 -1 -1 2 -1 -1 -1 -1 -1 -1 -1...

correct output
287409105

user output
287409105

Test 21

Verdict: ACCEPTED

input
500
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

correct output
455719894

user output
455719894

Test 22

Verdict: ACCEPTED

input
500
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -...

correct output
174226870

user output
174226870

Test 23

Verdict: ACCEPTED

input
500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
861085225

user output
861085225

Test 24

Verdict: ACCEPTED

input
1000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
812718674

user output
812718674

Test 25

Verdict:

input
2000
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -...

correct output
93994771

user output
(empty)

Test 26

Verdict:

input
3000
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -...

correct output
335231082

user output
(empty)

Test 27

Verdict:

input
5000
0 -1 2 -1 1 2 -1 -1 5 -1 -1 7 ...

correct output
799295101

user output
(empty)

Test 28

Verdict:

input
7000
0 -1 0 0 -1 0 -1 1 0 1 0 0 -1 ...

correct output
436287141

user output
(empty)

Test 29

Verdict:

input
8000
0 -1 1 -1 3 -1 1 -1 1 0 -1 -1 ...

correct output
88524447

user output
(empty)

Test 30

Verdict:

input
10000
0 0 1 -1 -1 3 2 -1 3 -1 4 -1 5...

correct output
129950957

user output
(empty)

Test 31

Verdict:

input
10000
-1 0 -1 -1 3 2 -1 -1 -1 -1 1 -...

correct output
598246902

user output
(empty)

Test 32

Verdict:

input
10000
-1 1 0 -1 2 1 -1 1 -1 0 -1 -1 ...

correct output
105842640

user output
(empty)

Test 33

Verdict:

input
10000
0 -1 0 -1 -1 -1 4 3 -1 -1 -1 -...

correct output
133310608

user output
(empty)

Test 34

Verdict:

input
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
484205143

user output
(empty)

Test 35

Verdict:

input
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
904817827

user output
(empty)

Test 36

Verdict:

input
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
966971895

user output
(empty)

Test 37

Verdict:

input
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
664825423

user output
(empty)

Test 38

Verdict:

input
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

correct output
681928184

user output
(empty)