| Task: | jedan |
| Sender: | Hansuzu |
| Submission time: | 2016-08-02 16:18:26 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.06 s | details |
| #2 | RUNTIME ERROR | 0.06 s | details |
| #3 | RUNTIME ERROR | 0.06 s | details |
| #4 | RUNTIME ERROR | 0.05 s | details |
| #5 | RUNTIME ERROR | 0.06 s | details |
| #6 | RUNTIME ERROR | 0.06 s | details |
| #7 | RUNTIME ERROR | 0.06 s | details |
| #8 | RUNTIME ERROR | 0.07 s | details |
| #9 | RUNTIME ERROR | 0.06 s | details |
| #10 | RUNTIME ERROR | 0.05 s | details |
| #11 | RUNTIME ERROR | 0.05 s | details |
| #12 | RUNTIME ERROR | 0.06 s | details |
| #13 | RUNTIME ERROR | 0.07 s | details |
| #14 | RUNTIME ERROR | 0.06 s | details |
| #15 | RUNTIME ERROR | 0.07 s | details |
| #16 | RUNTIME ERROR | 0.06 s | details |
| #17 | RUNTIME ERROR | 0.07 s | details |
| #18 | RUNTIME ERROR | 0.06 s | details |
| #19 | RUNTIME ERROR | 0.06 s | details |
| #20 | RUNTIME ERROR | 0.06 s | details |
| #21 | RUNTIME ERROR | 0.06 s | details |
| #22 | RUNTIME ERROR | 0.06 s | details |
| #23 | RUNTIME ERROR | 0.05 s | details |
| #24 | RUNTIME ERROR | 0.06 s | details |
| #25 | RUNTIME ERROR | 0.06 s | details |
| #26 | RUNTIME ERROR | 0.07 s | details |
| #27 | RUNTIME ERROR | 0.07 s | details |
| #28 | RUNTIME ERROR | 0.07 s | details |
| #29 | RUNTIME ERROR | 0.07 s | details |
| #30 | RUNTIME ERROR | 0.06 s | details |
| #31 | RUNTIME ERROR | 0.06 s | details |
| #32 | RUNTIME ERROR | 0.05 s | details |
| #33 | RUNTIME ERROR | 0.07 s | details |
| #34 | RUNTIME ERROR | 0.06 s | details |
| #35 | RUNTIME ERROR | 0.06 s | details |
| #36 | RUNTIME ERROR | 0.05 s | details |
| #37 | RUNTIME ERROR | 0.07 s | details |
| #38 | RUNTIME ERROR | 0.05 s | details |
Code
#include <iostream>
using namespace std;
int N;
const int M=1000000007;
int h[101010];
long long cm[10111][10111];
int calc(int dh, int dp, int h0){
if (dh<0) dh=-dh;
if (dh>dp) return 0;
long long s=0;
for (int i=0; i<=h0; ++i){
s+=cm[dp][dh];
s%=M;
--dp; ++dh;
if (dh>dp) break;
}
return s;
}
int main(){
cm[0][0]=1;
for (int dp=1; dp<10110; ++dp){
for (int dh=dp; dh>=0; --dh){
cm[dp][dh]=cm[dp-1][dh+1]+cm[dp-1][dh];
if (dh>0) cm[dp][dh]+=cm[dp-1][dh-1];
cm[dp][dh]%=M;
}
}
cin >> N;
for (int i=0; i<N; ++i){
cin >> h[i];
if (i==0 || i==N-1){
if (h[i]!=-1 && h[i]!=0){
cout << 0 << "\n";
return 0;
}
h[i]=0;
}
}
long long ans=1;
int li=0;
int lh=0;
for (int i=1; i<N; ++i){
if (h[i]==-1) continue;
ans*=calc(lh-h[i], i-li, min(h[i], lh));
ans%=M;
if (ans==0) break;
lh=h[i];
li=i;
}
cout << ans << "\n";
}Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 3
-1 2 -1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 3
-1 -1 -1 |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 6
-1 -1 -1 2 -1 -1 |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 1
-1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 1
0 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 1
1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 15
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 113634 |
| user output |
|---|
| (empty) |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 30
-1 -1 -1 -1 -1 -1 -1 -1 7 -1 -... |
| correct output |
|---|
| 33792 |
| user output |
|---|
| (empty) |
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 40
-1 -1 -1 -1 -1 -1 -1 6 -1 -1 -... |
| correct output |
|---|
| 44058168 |
| user output |
|---|
| (empty) |
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 50
-1 -1 -1 -1 4 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 885261321 |
| user output |
|---|
| (empty) |
Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 100
-1 -1 -1 -1 -1 -1 -1 -1 7 -1 -... |
| correct output |
|---|
| 630105363 |
| user output |
|---|
| (empty) |
Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 200
0 -1 -1 -1 4 -1 -1 -1 -1 0 -1 ... |
| correct output |
|---|
| 584749136 |
| user output |
|---|
| (empty) |
Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 300
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 440962689 |
| user output |
|---|
| (empty) |
Test 14
Verdict: RUNTIME ERROR
| input |
|---|
| 500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 861085225 |
| user output |
|---|
| (empty) |
Test 15
Verdict: RUNTIME ERROR
| input |
|---|
| 499
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 686858355 |
| user output |
|---|
| (empty) |
Test 16
Verdict: RUNTIME ERROR
| input |
|---|
| 500
0 0 -1 -1 -1 3 -1 -1 -1 6 6 -1... |
| correct output |
|---|
| 287620623 |
| user output |
|---|
| (empty) |
Test 17
Verdict: RUNTIME ERROR
| input |
|---|
| 500
0 -1 -1 1 -1 0 -1 0 -1 -1 3 -1... |
| correct output |
|---|
| 132437565 |
| user output |
|---|
| (empty) |
Test 18
Verdict: RUNTIME ERROR
| input |
|---|
| 500
0 -1 1 -1 2 2 -1 4 -1 -1 -1 1 ... |
| correct output |
|---|
| 545015067 |
| user output |
|---|
| (empty) |
Test 19
Verdict: RUNTIME ERROR
| input |
|---|
| 500
-1 1 1 -1 1 -1 1 -1 -1 1 -1 -1... |
| correct output |
|---|
| 394701022 |
| user output |
|---|
| (empty) |
Test 20
Verdict: RUNTIME ERROR
| input |
|---|
| 500
0 -1 -1 2 -1 -1 -1 -1 -1 -1 -1... |
| correct output |
|---|
| 287409105 |
| user output |
|---|
| (empty) |
Test 21
Verdict: RUNTIME ERROR
| input |
|---|
| 500
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 455719894 |
| user output |
|---|
| (empty) |
Test 22
Verdict: RUNTIME ERROR
| input |
|---|
| 500
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 174226870 |
| user output |
|---|
| (empty) |
Test 23
Verdict: RUNTIME ERROR
| input |
|---|
| 500
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 861085225 |
| user output |
|---|
| (empty) |
Test 24
Verdict: RUNTIME ERROR
| input |
|---|
| 1000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 812718674 |
| user output |
|---|
| (empty) |
Test 25
Verdict: RUNTIME ERROR
| input |
|---|
| 2000
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 93994771 |
| user output |
|---|
| (empty) |
Test 26
Verdict: RUNTIME ERROR
| input |
|---|
| 3000
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -... |
| correct output |
|---|
| 335231082 |
| user output |
|---|
| (empty) |
Test 27
Verdict: RUNTIME ERROR
| input |
|---|
| 5000
0 -1 2 -1 1 2 -1 -1 5 -1 -1 7 ... |
| correct output |
|---|
| 799295101 |
| user output |
|---|
| (empty) |
Test 28
Verdict: RUNTIME ERROR
| input |
|---|
| 7000
0 -1 0 0 -1 0 -1 1 0 1 0 0 -1 ... |
| correct output |
|---|
| 436287141 |
| user output |
|---|
| (empty) |
Test 29
Verdict: RUNTIME ERROR
| input |
|---|
| 8000
0 -1 1 -1 3 -1 1 -1 1 0 -1 -1 ... |
| correct output |
|---|
| 88524447 |
| user output |
|---|
| (empty) |
Test 30
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
0 0 1 -1 -1 3 2 -1 3 -1 4 -1 5... |
| correct output |
|---|
| 129950957 |
| user output |
|---|
| (empty) |
Test 31
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 0 -1 -1 3 2 -1 -1 -1 -1 1 -... |
| correct output |
|---|
| 598246902 |
| user output |
|---|
| (empty) |
Test 32
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 1 0 -1 2 1 -1 1 -1 0 -1 -1 ... |
| correct output |
|---|
| 105842640 |
| user output |
|---|
| (empty) |
Test 33
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
0 -1 0 -1 -1 -1 4 3 -1 -1 -1 -... |
| correct output |
|---|
| 133310608 |
| user output |
|---|
| (empty) |
Test 34
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 484205143 |
| user output |
|---|
| (empty) |
Test 35
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 904817827 |
| user output |
|---|
| (empty) |
Test 36
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 966971895 |
| user output |
|---|
| (empty) |
Test 37
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 664825423 |
| user output |
|---|
| (empty) |
Test 38
Verdict: RUNTIME ERROR
| input |
|---|
| 10000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... |
| correct output |
|---|
| 681928184 |
| user output |
|---|
| (empty) |
