Submission #394098

#TimeUsernameProblemLanguageResultExecution timeMemory
394098jeqchoBoat (APIO16_boat)C++17
0 / 100
23 ms8224 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define fi first #define se second int const N=5e2+3; int const A=1e3+3; int a[N],b[N]; map<int,ll> dp[N]; ll mod =1e9+7; set<int> vis[N]; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; F0R(i,n) { cin>>a[i]>>b[i]; } dp[0][0]=1; F0R(i,n) { trav(e,dp[i]) { dp[i+1][e.fi]=e.se; if(e.fi < a[i]) { dp[i+1][a[i]]+=e.se; dp[i+1][a[i]]%=mod; } } } ll ans = 0; trav(e,dp[n]) { ans+=e.se; ans%=mod; } cout<<ans<<'\n'; 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...