# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
146968 | gs14004 | Journey (NOI18_journey) | C++17 | 76 ms | 3952 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 10005;
const int mod = 5e8 + 1;
int n, m, h;
vector<pi> nxt[MAXN];
int dp[MAXN][405];
int add[MAXN][405];
int main(){
scanf("%d %d %d",&n,&m,&h);
for(int i=0; i<n-1; i++){
for(int j=0; j<h; j++){
int x, y; scanf("%d %d",&x,&y);
if(x > i){
nxt[i].emplace_back(x, y);
}
}
}
dp[0][0] = 1;
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
add[i+1][j] = min(add[i+1][j] + add[i][j], mod);
dp[i][j] = min(dp[i][j] + add[i][j], mod);
for(auto &k : nxt[j]){
if(i + k.second < m){
add[i + k.second][k.first] =
min(add[i + k.second][k.first] + dp[i][j], mod);
}
}
}
cout << dp[i][n-1] << " ";
}
}
컴파일 시 표준 에러 (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... |