Submission #978537

#TimeUsernameProblemLanguageResultExecution timeMemory
978537IUA_HasinBoat (APIO16_boat)C++17
9 / 100
1 ms604 KiB
#include <bits/stdc++.h> #define endl "\n" #define ll long long using namespace std; const ll mod = 1e9+7; int main(){ ll n; cin>>n; ll arr[n]; ll brr[n]; for(int i=0; i<n; i++){ cin>>arr[i]; cin>>brr[i]; } ll dp[n]; dp[n-1] = 1; for(int i=n-2; i>=0; i--){ ll a = arr[i]; // cout << a << " " << 25 << endl; ll sum = 0; for(int j=i+1; j<n; j++){ if(arr[j]>a){ sum = (sum+dp[j])%mod; // cout << arr[j] << " " << 30 << endl; } } dp[i] = sum+1; } ll ans = 0; for(int i=0; i<n; i++){ // cout << dp[i] << " "; ans = (ans+dp[i])%mod; ans = ans%mod; } // cout<<endl; cout << ans%mod << endl; 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...