Submission #403895

#TimeUsernameProblemLanguageResultExecution timeMemory
403895sadBoat (APIO16_boat)C++14
9 / 100
5 ms1324 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back using namespace std; int dp[503][503],a[503],b[503]; int n;const int mod=1e9+7; int d(int x,int y) { if(x==n)return 1; int &u=dp[x][y]; if(u!=-1)return u; u=0; u+=d(x+1,y); if(a[x]>a[y])u+=d(x+1,x); u%=mod; return u; } int main() { cin>>n; memset(dp,-1,sizeof dp); for(int i=0;i<n;i++) { cin>>a[i]>>a[i]; } ll re=0; for(int i=0;i<n;i++) { re+=d(i,i); re%=mod; }cout<<re; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...