# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
718337 | 2023-04-04T00:19:01 Z | irmuun | Boat (APIO16_boat) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() const mod=1e9+7; int main(){ ll n; cin>>n; ll a[n+5],b[n+5]; ll dp[n+5]; for(ll i=1;i<=n;i++){ cin>>a[i]>>b[i]; } dp[1]=1; ll ans=1; for(ll i=2;i<=n;i++){ dp[i]=0; for(ll j=1;j<i;j++){ if(a[j]<a[i]){ dp[i]+=dp[j]; dp[i]%=mod; } } ans=(ans+dp[i])%mod; } cout<<ans; }