이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10011, MAXM = 401;
int dp[MAXN][MAXM];
inline int sat_add(int x, int y){
return min(500000001, x + y);
}
int main(){
int n, m, h; cin >> n >> m >> h;
dp[0][0] = 1;
for(int i = 0; i < n - 1; i++){
for(int k = 0; k < MAXM - 1; k++){
dp[i][k + 1] = sat_add(dp[i][k + 1], dp[i][k]);
}
for(int j = 0; j < h; j++){
int v, t; cin >> v >> t;
if(v <= i) continue;
for(int k = 0; k + t < MAXM; k++){
dp[v][k + t] = sat_add(dp[v][k + t], dp[i][k]);
}
}
}
for(int i = 0; i < m; i++){
cout << dp[n - 1][i] << ' ';
}
cout << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |