Submission #983177

#TimeUsernameProblemLanguageResultExecution timeMemory
983177AiperiiiBoat (APIO16_boat)C++14
9 / 100
1 ms452 KiB
#include <bits/stdc++.h> #define int long long #define ull unsigned long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; const int mod=1e9+7; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <int> a(n+1),b(n+1),dp(n+1); for(int i=1;i<=n;i++)cin>>a[i]>>b[i]; dp[0]=1; for(int i=1;i<=n;i++){ for(int j=0;j<i;j++){ if(a[j]<a[i]){ dp[i]+=dp[j]; dp[i]%=mod; } } } int ans=0; for(int i=1;i<=n;i++){ ans+=dp[i]; ans%=mod; } cout<<ans<<"\n"; } /* 3 3 3 5 5 2 2 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...