Submission #672245

# Submission time Handle Problem Language Result Execution time Memory
672245 2022-12-15T08:14:37 Z Dan4Life Boat (APIO16_boat) C++17
0 / 100
995 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
const int maxn = 5e2+10;
const int MOD = (int)1e9+7;
pair<int,int> a[maxn];
unordered_map<int,int> dp[maxn];
int n;

int32_t main() {
	cin >> n; int ans = 0;
	for(int i = 0; i < n; i++) cin >> a[i].fi >> a[i].se;
	for(int i = 0; i < n; i++){
		for(int j = a[i].fi; j <= a[i].se; j++){
			dp[i][j]=1; if(j>a[i].fi) dp[i][j]+=dp[i][j-1]; dp[i][j]%=MOD;
			for(int k = 0; k < i; k++) 
				if(j>a[k].fi) dp[i][j]+=dp[k][min(j-1,a[i].se)], dp[i][j]%=MOD;
		}
	}
	for(int i = 0; i < n; i++) ans+=dp[i][a[i].se], ans%=MOD;
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 995 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -