Submission #44498

#TimeUsernameProblemLanguageResultExecution timeMemory
44498arman_ferdousBoat (APIO16_boat)C++17
9 / 100
6 ms1996 KiB
#include <bits/stdc++.h> using namespace std; const int N = 510, inf = 2e9, mod = 1e9+7; int n; pair<int,int> arr[510]; int dp[510][510]; int dp_9pts(int pos, int prev) { if(pos < 0) return 1; if(dp[pos][prev] != -1) return dp[pos][prev]; int ret = dp_9pts(pos-1,prev) % mod; if(arr[pos].first < arr[prev].first) ret = (ret + dp_9pts(pos-1,pos))%mod; return dp[pos][prev] = ret; } void pts9() { memset(dp,-1,sizeof dp); arr[n].first = inf; printf("%d\n", dp_9pts(n-1,n) - 1); } int main() { scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%d %d", &arr[i].first, &arr[i].second); pts9(); return 0; }

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
boat.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &arr[i].first, &arr[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...