# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
425455 | 2021-06-13T04:01:15 Z | errorgorn | Journey (NOI18_journey) | C++17 | 208 ms | 8908 KB |
#include <cstdio> #include <vector> #include <utility> using namespace std; typedef pair<int,int> ii; int n,m,h; vector<ii> flight[100005]; int memo[405][100005]; inline int add(int i,int j){ return min(i+j,500000001); } void print(){ for (int x=0;x<m;x++){ for (int y=0;y<n;y++){ printf("%d ",memo[y][x]); } printf("\n"); } } int main(){ scanf("%d%d%d",&n,&m,&h); int a,b; for (int x=0;x<n-1;x++){ for (int y=0;y<h;y++){ scanf("%d%d",&a,&b); if (a<=x) continue; flight[x].push_back(ii(a,b)); } } memo[0][0]=1; memo[1][0]=-1; for (int x=0;x<=m;x++){ for (int y=0;y<n;y++){ for (ii it:flight[y]){ if (it.second+x>m) continue; memo[it.second+x][it.first]=add(memo[it.second+x][it.first],memo[x][y]); } memo[x+1][y]=add(memo[x+1][y],memo[x][y]); } } for (int x=0;x<m;x++){ printf("%d ",memo[x][n-1]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2636 KB | Output is correct |
4 | Correct | 2 ms | 2636 KB | Output is correct |
5 | Correct | 4 ms | 3148 KB | Output is correct |
6 | Correct | 4 ms | 3276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2636 KB | Output is correct |
4 | Correct | 2 ms | 2636 KB | Output is correct |
5 | Correct | 4 ms | 3148 KB | Output is correct |
6 | Correct | 4 ms | 3276 KB | Output is correct |
7 | Correct | 71 ms | 6924 KB | Output is correct |
8 | Correct | 109 ms | 8908 KB | Output is correct |
9 | Correct | 34 ms | 5956 KB | Output is correct |
10 | Correct | 208 ms | 7112 KB | Output is correct |