Task: | Bit Strings |
Sender: | bits pls |
Submission time: | 2019-05-25 15:43:43 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.03 s | details |
#2 | ACCEPTED | 0.02 s | details |
#3 | ACCEPTED | 0.02 s | details |
#4 | ACCEPTED | 0.02 s | details |
#5 | ACCEPTED | 0.02 s | details |
#6 | ACCEPTED | 0.03 s | details |
#7 | ACCEPTED | 0.02 s | details |
#8 | ACCEPTED | 0.03 s | details |
#9 | ACCEPTED | 0.02 s | details |
#10 | ACCEPTED | 0.01 s | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | ACCEPTED | 0.94 s | details |
#13 | TIME LIMIT EXCEEDED | -- | details |
#14 | TIME LIMIT EXCEEDED | -- | details |
#15 | TIME LIMIT EXCEEDED | -- | details |
#16 | TIME LIMIT EXCEEDED | -- | details |
#17 | TIME LIMIT EXCEEDED | -- | details |
#18 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <iostream> #include <map> using namespace std; long n, k; map<pair<long, long>, long> cache; long add_nr(long zs, long ln) { if (ln == n) { return 1; } pair<long, long> t = make_pair(zs, ln); if (cache[t] == 0) { if (zs != k - 1) cache[t] = add_nr(zs + 1, ln + 1) + add_nr(0, ln + 1) % 1000000007; else cache[t] = add_nr(0, ln + 1) % 1000000007; } return cache[t]; } int main() { cin >> n; cin >> k; cout << add_nr(0, 0) << endl; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 3
Verdict: ACCEPTED
input |
---|
2 2 |
correct output |
---|
3 |
user output |
---|
3 |
Test 4
Verdict: ACCEPTED
input |
---|
3 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 5
Verdict: ACCEPTED
input |
---|
3 2 |
correct output |
---|
5 |
user output |
---|
5 |
Test 6
Verdict: ACCEPTED
input |
---|
3 3 |
correct output |
---|
7 |
user output |
---|
7 |
Test 7
Verdict: ACCEPTED
input |
---|
4 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 8
Verdict: ACCEPTED
input |
---|
4 2 |
correct output |
---|
8 |
user output |
---|
8 |
Test 9
Verdict: ACCEPTED
input |
---|
4 3 |
correct output |
---|
13 |
user output |
---|
13 |
Test 10
Verdict: ACCEPTED
input |
---|
4 4 |
correct output |
---|
15 |
user output |
---|
15 |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
654321 123456 |
correct output |
---|
796245691 |
user output |
---|
(empty) |
Test 12
Verdict: ACCEPTED
input |
---|
1000000 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 10 |
correct output |
---|
256933600 |
user output |
---|
(empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 100 |
correct output |
---|
142013415 |
user output |
---|
(empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 1000 |
correct output |
---|
899626120 |
user output |
---|
(empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 10000 |
correct output |
---|
374265948 |
user output |
---|
(empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 100000 |
correct output |
---|
388134512 |
user output |
---|
(empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 1000000 |
correct output |
---|
235042058 |
user output |
---|
(empty) |