# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
141113 | tincamatei | Journey (NOI18_journey) | C++14 | 145 ms | 11128 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 10000;
const int MAX_M = 400;
const int INF = 500000001;
vector<pair<int, int> > graph[MAX_N];
int dp[MAX_M][MAX_N];
int sp[MAX_M][MAX_N];
int main() {
int n, m, h;
scanf("%d%d%d", &n, &m, &h);
for(int i = 0; i < n - 1; ++i) {
for(int j = 0; j < h; ++j) {
int to, sl;
scanf("%d%d", &to, &sl);
if(i < to)
graph[to].push_back({i, sl});
}
}
for(int i = 0; i < m; ++i)
sp[i][0] = 1;
dp[0][0] = 1;
for(int i = 0; i < m; ++i)
for(int j = 1; j < n; ++j) {
for(auto it: graph[j])
if(it.second <= i)
dp[i][j] = min(INF, dp[i][j] + sp[i - it.second][it.first]);
if(i > 0)
sp[i][j] = sp[i - 1][j];
sp[i][j] = min(INF, sp[i][j] + dp[i][j]);
}
for(int i = 0; i < m; ++i)
printf("%d ", dp[i][n - 1]);
return 0;
}
컴파일 시 표준 에러 (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... |