Submission #1027583

#TimeUsernameProblemLanguageResultExecution timeMemory
1027583Halym2007Boat (APIO16_boat)C++17
9 / 100
2 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define sz size() #define ll long long const int N = 5e2 + 5; ll a[N], n, md = 1e9 + 7, dp[N][2]; int main () { int n; cin >> n; for (int i = 1; i <= n; ++i) { int l, r; cin >> l >> r; a[i] = l; } for (int i = 1; i <= n; ++i) { dp[i][0] = dp[i - 1][0] + dp[i - 1][1]; dp[i][0] %= md; dp[i][1] = 1; for (int j = i - 1; j > 0; j--) { if (a[i] > a[j]) { dp[i][1] += dp[j][1]; dp[i][1] %= md; } } } cout << (dp[n][1] + dp[n][0]) % md; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...