Task: | Practice Sessions |
Sender: | aalto2024m_001 |
Submission time: | 2024-11-25 17:33:30 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.01 s | details |
#12 | WRONG ANSWER | 0.01 s | details |
#13 | WRONG ANSWER | 0.01 s | details |
#14 | WRONG ANSWER | 0.01 s | details |
#15 | WRONG ANSWER | 0.01 s | details |
#16 | WRONG ANSWER | 0.01 s | details |
#17 | WRONG ANSWER | 0.31 s | details |
#18 | WRONG ANSWER | 0.26 s | details |
#19 | WRONG ANSWER | 0.23 s | details |
#20 | WRONG ANSWER | 0.31 s | details |
Code
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i=a;i<(b);++i) #define all(x) begin(x),end(x) #define sz(x) int((x).size()) using ll = long long; using pii = pair<int,int>; using vi = vector<int>; const int M = 1e9+7; int R[5001][5001][2]; int main() { int n, k; cin >> n >> k; if (n == k) { cout << "1\n"; return 0; } rep(n0,1,n+1) { rep(k0,1,n0) { const int n1 = n0 - k0; R[n0][k0][0] = (R[n0][k0-1][0] + R[n1][min(n1,k0-1)][1]) % M; R[n0][k0][1] = (R[n0][k0-1][1] + R[n1][n1][0] - R[n1][k0][0] + M) % M; } R[n0][n0][0] = (R[n0][n0-1][0]+1) % M; R[n0][n0][1] = (R[n0][n0-1][1]+1) % M; } cout << (ll(R[n][k][0]) - R[n][k-1][0] + R[n][k][1] - R[n][k-1][1] + M*2) % M << '\n'; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
6 2 |
correct output |
---|
4 |
user output |
---|
4 |
Test 2
Verdict: ACCEPTED
input |
---|
3 3 |
correct output |
---|
1 |
user output |
---|
1 |
Test 3
Verdict: ACCEPTED
input |
---|
2 1 |
correct output |
---|
0 |
user output |
---|
0 |
Test 4
Verdict: WRONG ANSWER
input |
---|
3 2 |
correct output |
---|
1 |
user output |
---|
2 |
Test 5
Verdict: ACCEPTED
input |
---|
5 2 |
correct output |
---|
2 |
user output |
---|
2 |
Test 6
Verdict: ACCEPTED
input |
---|
7 3 |
correct output |
---|
3 |
user output |
---|
3 |
Test 7
Verdict: WRONG ANSWER
input |
---|
10 1 |
correct output |
---|
23 |
user output |
---|
27 |
Test 8
Verdict: WRONG ANSWER
input |
---|
30 10 |
correct output |
---|
3798 |
user output |
---|
4664 |
Test 9
Verdict: WRONG ANSWER
input |
---|
28 3 |
correct output |
---|
44442 |
user output |
---|
54474 |
Test 10
Verdict: WRONG ANSWER
input |
---|
29 4 |
correct output |
---|
43031 |
user output |
---|
52768 |
Test 11
Verdict: WRONG ANSWER
input |
---|
333 2 |
correct output |
---|
420856463 |
user output |
---|
945477076 |
Test 12
Verdict: WRONG ANSWER
input |
---|
357 1 |
correct output |
---|
21271311 |
user output |
---|
5632819 |
Test 13
Verdict: WRONG ANSWER
input |
---|
500 9 |
correct output |
---|
665929071 |
user output |
---|
405343674 |
Test 14
Verdict: WRONG ANSWER
input |
---|
500 17 |
correct output |
---|
493880105 |
user output |
---|
319103645 |
Test 15
Verdict: WRONG ANSWER
input |
---|
500 49 |
correct output |
---|
43728321 |
user output |
---|
165091094 |
Test 16
Verdict: WRONG ANSWER
input |
---|
499 19 |
correct output |
---|
128412292 |
user output |
---|
135702533 |
Test 17
Verdict: WRONG ANSWER
input |
---|
5000 100 |
correct output |
---|
686974306 |
user output |
---|
795202922 |
Test 18
Verdict: WRONG ANSWER
input |
---|
4589 1 |
correct output |
---|
67768215 |
user output |
---|
292001971 |
Test 19
Verdict: WRONG ANSWER
input |
---|
4321 987 |
correct output |
---|
890135419 |
user output |
---|
216592201 |
Test 20
Verdict: WRONG ANSWER
input |
---|
4987 222 |
correct output |
---|
626500635 |
user output |
---|
905911596 |