Submission #636812

#TimeUsernameProblemLanguageResultExecution timeMemory
636812lovrotBoat (APIO16_boat)C++11
9 / 100
3 ms2372 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 510; const int MOD = 1e9 + 7; ll add(ll x, ll y){ return (x + y) % MOD; } int n, a[N], b[N]; ll dp[N][N]; ll DP(int x, int last){ if(x > n) return 1; if(dp[x][last] != -1) return dp[x][last]; dp[x][last] = DP(x + 1, last); if(a[last] < a[x]) dp[x][last] = add(dp[x][last], DP(x + 1, x)); return dp[x][last]; } int main(){ memset(dp, -1, sizeof(dp)); scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%d%d", &a[i], &b[i]); } printf("%d\n", DP(1, 0) - 1); return 0; }

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:32:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   32 |  printf("%d\n", DP(1, 0) - 1);
      |          ~^     ~~~~~~~~~~~~
      |           |              |
      |           int            long long int
      |          %lld
boat.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
boat.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |   scanf("%d%d", &a[i], &b[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...