# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
586478 | hibiki | Journey (NOI18_journey) | C++11 | 61 ms | 22216 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define MX 500000001
#define pb push_back
#define f first
#define s second
int n,m,h;
vector<pair<int,int> > v[10005];
int dp[10005][505];
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 a,b;
scanf("%d %d",&a,&b);
if(i >= a) continue;
v[i].pb({a,b});
}
}
memset(dp, 0, sizeof(dp));
for(auto go: v[0])
dp[go.f][min(503,go.s)]++;
for(int i = 1; i < n; i++)
{
for(int j = 1; j < m; j++)
{
dp[i][j] += dp[i][j - 1];
dp[i][j] = min(dp[i][j], MX);
}
for(auto go: v[i])
{
for(int j = 0; j + go.s < m; j++)
{
dp[go.f][j + go.s] += dp[i][j];
dp[go.f][j + go.s] = min(dp[go.f][j + go.s], MX);
}
}
}
for(int i = 0; i < m; i++)
printf("%d ",dp[n - 1][i]);
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... |