Submission #124178

#TimeUsernameProblemLanguageResultExecution timeMemory
124178AyaBenSaadBoat (APIO16_boat)C++14
0 / 100
4 ms1400 KiB
#include <bits/stdc++.h> using namespace std; const int M = 5e2 + 2; int n, t[M], dp[M][M]; int solve (int id = 1, int per = 0) { if (id == 1+n) return 1; if (dp[id][per] != -1) return dp[id][per]; int x = (t[id] >= t[per] ? solve (id + 1, id) : 0); dp[id][per] = solve (id + 1, per) + x; return dp[id][per]; } int main () { scanf ("%d", &n); int a; for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a); t[0] = -2e9; memset (dp, -1, sizeof dp); printf ("%d\n", solve()-1); }

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", &n);
   ~~~~~~^~~~~~~~~~
boat.cpp:19:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a);
                                ~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...