Submission #875945

#TimeUsernameProblemLanguageResultExecution timeMemory
875945LoboBoat (APIO16_boat)C++17
9 / 100
2063 ms292032 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define fr first #define sc second const int mod = 1e9+7; int n; int32_t main() { cin >> n; map<int,int> dp; dp[0] = 1; for(int i = 1; i <= n; i++) { int a,b; cin >> a >> b; int sum = 0; for(auto X : dp) { if(X.fr >= a) continue; sum+= X.sc; sum%= mod; } for(int j = a; j <= b; j++) { sum+= dp[j]; sum%= mod; dp[j] = sum; } } int ans = 0; for(auto x : dp) { if(x.fr != 0) { ans+= x.sc; ans%= mod; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...