Submission #330004

# Submission time Handle Problem Language Result Execution time Memory
330004 2020-11-23T11:45:58 Z oak Journey (NOI18_journey) C++14
100 / 100
92 ms 18028 KB
#include<bits/stdc++.h>
using namespace std;
int dp[10010][410];
int lim = 1+5e8;
int main(){
	int n,i,m,c,t,h,j,k;
	scanf("%d%d%d",&n,&m,&h);
	dp[0][0] = 1;
	for(i=0;i<n-1;i++){
		for(j=1;j<m;j++){
			dp[i][j] = min(lim*1ll,dp[i][j-1]*1ll + dp[i][j]*1ll);
		}
		for(j=0;j<h;j++){
			scanf("%d %d",&c,&t);
			if(c<=i)continue;
			for(k=0;k+t<m;k++){
				dp[c][k+t] = min(lim*1ll,dp[c][k+t]*1ll + dp[i][k] * 1ll);
			}
		}
	}
	for(i=0;i<m;i++){
		printf("%d ",dp[n-1][i]);
	}
}

Compilation message

journey.cpp: In function 'int main()':
journey.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |  scanf("%d%d%d",&n,&m,&h);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
journey.cpp:14:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |    scanf("%d %d",&c,&t);
      |    ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 92 ms 18028 KB Output is correct
8 Correct 59 ms 11116 KB Output is correct
9 Correct 12 ms 1772 KB Output is correct
10 Correct 59 ms 2156 KB Output is correct