QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736578 | #8487. Scooter numbers | Bucketsmith# | WA | 4ms | 10068kb | C++20 | 860b | 2024-11-12 11:49:02 | 2024-11-12 11:49:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 1e3 + 10, P = 1e9 + 7;
int n, dp[N][N], pp[N][N];
int main() {
cin >> n;
dp[0][0] = 1;
for(int i = 1; i <= n; i ++)
for(int j = i; j <= n; j ++) {
dp[i][j] = dp[i][j - i] + dp[i - 1][j - i];
if(dp[i][j] >= P) dp[i][j] -= P;
}
pp[n + 1][0] = pp[n + 2][0] = 1;
for(int i = n; i >= 1; i --) {
memcpy(pp[i], pp[i + 1], sizeof pp[i]);
for(int j = i; j <= n; j ++) {
pp[i][j] += pp[i][j - i];
if(pp[i][j] >= P) pp[i][j] -= P;
}
}
int ans = 0;
for(int i = 1; i <= n + 1; i ++)
for(int j = 0; j <= n; j ++)
ans = (ans + i * ((i64)dp[i - 1][j] * pp[i + 1][n - j]) % P) % P;
cout << ans << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5692kb
input:
1
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
3
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 0ms
memory: 5756kb
input:
2
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 0ms
memory: 5712kb
input:
5
output:
14
result:
ok 1 number(s): "14"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
7
output:
32
result:
ok 1 number(s): "32"
Test #6:
score: 0
Accepted
time: 1ms
memory: 5724kb
input:
10
output:
93
result:
ok 1 number(s): "93"
Test #7:
score: 0
Accepted
time: 0ms
memory: 5808kb
input:
15
output:
426
result:
ok 1 number(s): "426"
Test #8:
score: 0
Accepted
time: 3ms
memory: 9380kb
input:
431
output:
939569366
result:
ok 1 number(s): "939569366"
Test #9:
score: 0
Accepted
time: 2ms
memory: 8976kb
input:
339
output:
779167693
result:
ok 1 number(s): "779167693"
Test #10:
score: -100
Wrong Answer
time: 4ms
memory: 10068kb
input:
619
output:
384030197
result:
wrong answer 1st numbers differ - expected: '95446348', found: '384030197'