Submission #38782

#TimeUsernameProblemLanguageResultExecution timeMemory
38782oTTo_22Boat (APIO16_boat)C++14
0 / 100
0 ms2176 KiB
#include <bits/stdc++.h> #define se second #define fi first const int MOD=1000000007; using namespace std; int dp[501]; int main () { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int p[n+1]; p[0]=0; for (int i=1; i<=n; i++) { int l,r; cin >> l >> r; p[i]=r; } for (int i=1; i<=n; i++) { for (int k=1; k<i; k++) if (p[i]>p[k]) { dp[i]=dp[i]+dp[k]+1; dp[i]%=MOD; } dp[i]++; dp[i]%=MOD; } cout << dp[n]%MOD; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...