# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124197 | AyaBenSaad | Boat (APIO16_boat) | C++14 | 3 ms | 376 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 MOD = 1e9 + 7;
const int M = 5e2 + 2;
int n, t[M];
long long dp[M];
int main () {
scanf ("%d", &n);
int a;
for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a);
for (int i = 1; i <= n; i++) {
dp[i] = 1;
for (int j = 1; j <= i-1; j++)
if (t[j] < t[i])
dp[i] = (dp[i] + dp[j]) % MOD;
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
ans = (ans + dp[i]) % MOD;
}
printf("%lld\n", ans);
}
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... |