Task: | jedan |
Sender: | eXeP |
Submission time: | 2016-08-02 18:21:57 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.06 s | details |
#4 | ACCEPTED | 0.05 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | WRONG ANSWER | 0.06 s | details |
#7 | ACCEPTED | 0.06 s | details |
#8 | ACCEPTED | 0.06 s | details |
#9 | ACCEPTED | 0.06 s | details |
#10 | WRONG ANSWER | 0.06 s | details |
#11 | WRONG ANSWER | 0.06 s | details |
#12 | WRONG ANSWER | 0.06 s | details |
#13 | WRONG ANSWER | 0.06 s | details |
#14 | WRONG ANSWER | 0.07 s | details |
#15 | WRONG ANSWER | 0.08 s | details |
#16 | WRONG ANSWER | 0.07 s | details |
#17 | WRONG ANSWER | 0.07 s | details |
#18 | WRONG ANSWER | 0.08 s | details |
#19 | WRONG ANSWER | 0.07 s | details |
#20 | WRONG ANSWER | 0.08 s | details |
#21 | WRONG ANSWER | 0.07 s | details |
#22 | WRONG ANSWER | 0.07 s | details |
#23 | WRONG ANSWER | 0.07 s | details |
#24 | WRONG ANSWER | 0.21 s | details |
#25 | TIME LIMIT EXCEEDED | -- | details |
#26 | TIME LIMIT EXCEEDED | -- | details |
#27 | TIME LIMIT EXCEEDED | -- | details |
#28 | TIME LIMIT EXCEEDED | -- | details |
#29 | TIME LIMIT EXCEEDED | -- | details |
#30 | TIME LIMIT EXCEEDED | -- | details |
#31 | TIME LIMIT EXCEEDED | -- | details |
#32 | TIME LIMIT EXCEEDED | -- | details |
#33 | TIME LIMIT EXCEEDED | -- | details |
#34 | TIME LIMIT EXCEEDED | -- | details |
#35 | TIME LIMIT EXCEEDED | -- | details |
#36 | TIME LIMIT EXCEEDED | -- | details |
#37 | TIME LIMIT EXCEEDED | -- | details |
#38 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> #define i64 long long #define u64 unsigned long long #define i32 int #define u32 unsigned int #define pii pair<int, int> #define pll pair<long long, long long> #define ld long double #define defmod 1000000007 #define mati64(a,b) vector<vector<i64>>(a, vector<i64>(b, 0)); using namespace std; int main(){ cin.sync_with_stdio(0); cin.tie(0); int n; cin >> n; int h[10101]; for(int i = 0; i < n; ++i) cin >> h[i]; map<int, int> rip[101010]; rip[0][0] = 1; for(int i = 0; i < n-1; ++i){ if(h[i] == -1){ for(auto f: rip[i]){ if(f.first < 0) continue; //cout << i << " " << f.first << " " << rip[i][f.first] << endl; rip[i][f.first]%=defmod; rip[i+1][f.first]+=rip[i][f.first]; rip[i+1][f.first+1]+=rip[i][f.first]; rip[i+1][f.first-1]+=rip[i][f.first]; } } else{ rip[i][h[i]]%=defmod; rip[i+1][h[i]]+=rip[i][h[i]]; rip[i+1][h[i]-1]+=rip[i][h[i]]; rip[i+1][h[i]+1]+=rip[i][h[i]]; } } cout << rip[n-1][0]%defmod << endl; return 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: WRONG ANSWER
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: WRONG ANSWER
input |
---|
50
-1 -1 -1 -1 4 -1 -1 -1 -1 -1 -... |
correct output |
---|
885261321 |
user output |
---|
-42971046 |
Test 11
Verdict: WRONG ANSWER
input |
---|
100
-1 -1 -1 -1 -1 -1 -1 -1 7 -1 -... |
correct output |
---|
630105363 |
user output |
---|
61201664 |
Test 12
Verdict: WRONG ANSWER
input |
---|
200
0 -1 -1 -1 4 -1 -1 -1 -1 0 -1 ... |
correct output |
---|
584749136 |
user output |
---|
173872142 |
Test 13
Verdict: WRONG ANSWER
input |
---|
300
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -... |
correct output |
---|
440962689 |
user output |
---|
-713299319 |
Test 14
Verdict: WRONG ANSWER
input |
---|
500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
861085225 |
user output |
---|
438768388 |
Test 15
Verdict: WRONG ANSWER
input |
---|
499
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
686858355 |
user output |
---|
547847704 |
Test 16
Verdict: WRONG ANSWER
input |
---|
500
0 0 -1 -1 -1 3 -1 -1 -1 6 6 -1... |
correct output |
---|
287620623 |
user output |
---|
-56758185 |
Test 17
Verdict: WRONG ANSWER
input |
---|
500
0 -1 -1 1 -1 0 -1 0 -1 -1 3 -1... |
correct output |
---|
132437565 |
user output |
---|
-138725841 |
Test 18
Verdict: WRONG ANSWER
input |
---|
500
0 -1 1 -1 2 2 -1 4 -1 -1 -1 1 ... |
correct output |
---|
545015067 |
user output |
---|
868768135 |
Test 19
Verdict: WRONG ANSWER
input |
---|
500
-1 1 1 -1 1 -1 1 -1 -1 1 -1 -1... |
correct output |
---|
394701022 |
user output |
---|
82164841 |
Test 20
Verdict: WRONG ANSWER
input |
---|
500
0 -1 -1 2 -1 -1 -1 -1 -1 -1 -1... |
correct output |
---|
287409105 |
user output |
---|
-779798028 |
Test 21
Verdict: WRONG ANSWER
input |
---|
500
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
correct output |
---|
455719894 |
user output |
---|
248179434 |
Test 22
Verdict: WRONG ANSWER
input |
---|
500
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
correct output |
---|
174226870 |
user output |
---|
-345795165 |
Test 23
Verdict: WRONG ANSWER
input |
---|
500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
861085225 |
user output |
---|
438768388 |
Test 24
Verdict: WRONG ANSWER
input |
---|
1000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
812718674 |
user output |
---|
-443044009 |
Test 25
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
correct output |
---|
93994771 |
user output |
---|
(empty) |
Test 26
Verdict: TIME LIMIT EXCEEDED
input |
---|
3000
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -... |
correct output |
---|
335231082 |
user output |
---|
(empty) |
Test 27
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000
0 -1 2 -1 1 2 -1 -1 5 -1 -1 7 ... |
correct output |
---|
799295101 |
user output |
---|
(empty) |
Test 28
Verdict: TIME LIMIT EXCEEDED
input |
---|
7000
0 -1 0 0 -1 0 -1 1 0 1 0 0 -1 ... |
correct output |
---|
436287141 |
user output |
---|
(empty) |
Test 29
Verdict: TIME LIMIT EXCEEDED
input |
---|
8000
0 -1 1 -1 3 -1 1 -1 1 0 -1 -1 ... |
correct output |
---|
88524447 |
user output |
---|
(empty) |
Test 30
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
0 0 1 -1 -1 3 2 -1 3 -1 4 -1 5... |
correct output |
---|
129950957 |
user output |
---|
(empty) |
Test 31
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 0 -1 -1 3 2 -1 -1 -1 -1 1 -... |
correct output |
---|
598246902 |
user output |
---|
(empty) |
Test 32
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 1 0 -1 2 1 -1 1 -1 0 -1 -1 ... |
correct output |
---|
105842640 |
user output |
---|
(empty) |
Test 33
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
0 -1 0 -1 -1 -1 4 3 -1 -1 -1 -... |
correct output |
---|
133310608 |
user output |
---|
(empty) |
Test 34
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
484205143 |
user output |
---|
(empty) |
Test 35
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
904817827 |
user output |
---|
(empty) |
Test 36
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
966971895 |
user output |
---|
(empty) |
Test 37
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
664825423 |
user output |
---|
(empty) |
Test 38
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
correct output |
---|
681928184 |
user output |
---|
(empty) |