Submission #425455

#TimeUsernameProblemLanguageResultExecution timeMemory
425455errorgornJourney (NOI18_journey)C++17
100 / 100
208 ms8908 KiB
#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 (stderr)

journey.cpp: In function 'int main()':
journey.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%d%d%d",&n,&m,&h);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
journey.cpp:25:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             scanf("%d%d",&a,&b);
      |             ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...