제출 #106956

#제출 시각아이디문제언어결과실행 시간메모리
106956maksim_gaponovBoat (APIO16_boat)C++14
9 / 100
3 ms640 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

const int MOD = 1e9 + 7;

void run() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		assert(a[i] == b[i]);
	}
	vector<int> dp(n, 1);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < i; ++j) {
			if (a[i] > a[j]) {
				dp[i] += dp[j];
			}
		}
		dp[i] %= MOD;
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += dp[i];
	}
	ans %= MOD;
	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	run();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...