Submission #107004

# Submission time Handle Problem Language Result Execution time Memory
107004 2019-04-21T12:38:29 Z kek Boat (APIO16_boat) C++14
9 / 100
4 ms 384 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define int ll
#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
#define pb push_back
#define kek pop_back
#define pii pair<int, int>
#define mp make_pair
 
#define debug(x) cout << #x << " = " << x << endl;
 
const int INF = 1e9 + 666;
 
template<class t1, class t2>
bool cmin(t1 &a, const t2 &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 
template<class t1, class t2>
bool cmax(t1 &a, const t2 &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
 
// void MinMax(ll, ll, ll*, ll*);
 
// ll firstGroup(int);
// ll secondGroup(int);
 
// ll calc_ans(vector<ll> a) {
// 	sort(all(a));
// 	ll ans = 0;
// 	for (int i = 0; i + 1 < len(a); ++i) {
// 		cmax(ans, a[i + 1] - a[i]);
// 	}
// 	return ans;
// }
 
// ll findGap(int t, int n) {
// 	if (t == 1) {
// 		return firstGroup(n);
// 	} else {
// 		return secondGroup(n);
// 	}
// }
 
// ll firstGroup(int n) {
// 	vector<ll> a;
// 	ll l = 0, r = 1e18;
// 	while (len(a) < n) {
// 		MinMax(l, r, &l, &r);
// 		if (l == -1) {
// 			break;
// 		}
// 		a.pb(l);
// 		if (l != r) {
// 			a.pb(r);
// 		}
// 		++l;
// 		--r;
// 	}
// 	return calc_ans(a);
// }
 
// vector<ll> restore(ll l, ll r) {
// 	if (l > r) {
// 		return {};
// 	}
// 	MinMax(l, r, &l, &r);
// 	if (l == -1) {
// 		return {};
// 	}
// 	if (l == r) {
// 		return {l};
// 	}
// 	ll m = (l + r) >> 1;
// 	vector<ll> ans = {l, r};
// 	for (auto &x : restore(l + 1, m)) {
// 		ans.pb(x);
// 	}
// 	for (auto &x : restore(m + 1, r - 1)) {
// 		ans.pb(x);
// 	}
// 	return ans;
// }
 
// ll secondGroup(int n) {
// 	return calc_ans(restore(0, 1e18));
// }
 
void run();
 
signed main() {
	iostream::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	run();
}
 
const int mod = 1e9 + 7;
 
void run() {
	int n;
	cin >> n;
	vector<pii> v(n);
	for (auto &x : v) {
		cin >> x.first >> x.second;
	}
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	v.insert(v.begin(), {0, 0});
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < i; ++j) {
			if (v[j].first < v[i].first) {
				dp[i] += dp[j];
				if (dp[i] >= mod) {
					dp[i] -= mod;
				}
			}
		}
	}
	cout << (accumulate(all(dp), 0ll) - 1 + mod) % mod << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Incorrect 3 ms 384 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Incorrect 3 ms 384 KB Output isn't correct
22 Halted 0 ms 0 KB -