QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#421850 | #6460. Mountain Scenes | nitrousoxide# | WA | 7ms | 12112kb | C++14 | 962b | 2024-05-26 08:26:26 | 2024-05-26 08:26:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int modi = 1'000'000'007;
int dp[112][10240], s[112][10240];
inline void inc(int & x, int v) {
x += v;
if (x >= modi) {
x -= modi;
}
}
int main() {
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i <= n; i++) {
dp[1][i] = min(h+1, i+1);
if (i != 0) s[1][i] = s[1][i-1];
inc(s[1][i], dp[1][i]);
}
for (int i = 2; i <= w; i++) {
dp[i][0] = 1;
for (int j = 1; j <= n; j++) {
if (j <= h) {
dp[i][j] = s[i-1][j];
} else {
dp[i][j] = s[i-1][j] - s[i-1][j-h-1];
if (dp[i][j] < 0) dp[i][j] += modi;
}
}
s[i][0] = dp[i][0];
for (int j = 1; j <= n; j++) {
s[i][j] = s[i][j-1];
inc(s[i][j], dp[i][j]);
}
}
cout << dp[w][n] - ((n/w) + 1) << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5752kb
input:
25 5 5
output:
7770
result:
ok single line: '7770'
Test #2:
score: 0
Accepted
time: 0ms
memory: 5692kb
input:
15 5 5
output:
6050
result:
ok single line: '6050'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
10 10 1
output:
1022
result:
ok single line: '1022'
Test #4:
score: 0
Accepted
time: 1ms
memory: 7728kb
input:
4 2 2
output:
6
result:
ok single line: '6'
Test #5:
score: 0
Accepted
time: 7ms
memory: 12112kb
input:
10000 100 100
output:
502424636
result:
ok single line: '502424636'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 5596kb
input:
10000 1 1
output:
-9999
result:
wrong answer 1st lines differ - expected: '0', found: '-9999'