# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124164 | AyaBenSaad | Boat (APIO16_boat) | C++14 | 4 ms | 1272 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |