# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
200420 | wilwxk | Journey (NOI18_journey) | C++14 | 5 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e4+5;
const int MAXM = 405;
ll dp[MAXN][MAXM];
vector<pair<int, int> > g[MAXN];
int n, m, x;
int main() {
scanf("%d %d %d", &n, &m, &x);
for(int i = 0; i < n-1; i ++) {
for(int j = 0; j < x; j++) {
int a, b; scanf("%d %d", &a, &b);
g[a].push_back({i, b});
}
}
dp[0][0] = 1;
for(int i = 1; i < n; i++) {
for(int j = 0; j < m; j++) {
for(auto edge : g[i]) {
int k = j-edge.second;
if(k < 0) continue;
dp[i][j] += dp[edge.first][k];
}
// printf("%d %d >> %lld\n", i, j, dp[i][j]);
}
for(int j = 1; j < m; j++) dp[i][j] += dp[i][j-1];
}
for(int i = 0; i < m; i++) printf("%lld ", min(dp[n-1][i], 500000001LL));
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |