제출 #38776

#제출 시각아이디문제언어결과실행 시간메모리
38776WaschbarBoat (APIO16_boat)C++14
9 / 100
2000 ms180220 KiB
#include <bits/stdc++.h> #define a first #define b second using namespace std; const long long INF = 1e18; const int MOD = 1e9+7; int n; vector < map<int,int> > dp(1000); vector < pair<int,int> > v(1000); int main() { cin >> n; for(int i = 1; i <= n; i++) cin >> v[i].a >> v[i].b; map<int,int> :: iterator it; for(int i = 1; i <= n; i++){ dp[i] = dp[i-1]; for(int j = v[i].a; j <= v[i].b; j++) { it = dp[i-1].begin(); while(it != dp[i-1].end()) { if(it->first >= j) break; dp[i][j] = (dp[i][j] + it->second) % MOD; it++; } //if(i != n) dp[i][j] = (dp[i][j]+1) % MOD; } } it = dp[n].begin(); int ans = 0; while(it != dp[n].end()) { ans = (ans+(it->second)) % MOD; //cout << it->second << " " << it->first << endl; it++; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...