Submission #636840

# Submission time Handle Problem Language Result Execution time Memory
636840 2022-08-30T10:05:00 Z Tob Boat (APIO16_boat) C++14
9 / 100
3 ms 980 KB
#include <bits/stdc++.h>

#define ll long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

ll nxt() {ll num; cin >> num; return num;}

const int N = 507;
const ll mod = 1e9 + 7;

ll n;
ll arr[N];
vector <int> adj[N];
ll dp[N];

ll Mod(ll x) {
	return (x < mod) ? x : x % mod;
}

ll DP(int x) {
	if (dp[x]) return dp[x];
	for (auto it : adj[x]) {
		dp[x] = Mod(dp[x] + DP(it));
	}
	dp[x] = Mod(dp[x]+1);
	return dp[x];
}

int main () {
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		ll a, b; cin >> a >> b;
		arr[i] = a;
	}
	
	arr[n] = 1e18;
	
	for (int i = n; i; i--) {
		for (int j = i-1; j >= 0; j--) {
			if (arr[i] > arr[j]) adj[i].pb(j);
		}
	}
	
	cout << DP(n)-1;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 912 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 3 ms 852 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 3 ms 980 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 2 ms 852 KB Output is correct
14 Correct 2 ms 980 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 3 ms 596 KB Output is correct
20 Correct 2 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 912 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 3 ms 852 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 3 ms 980 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 2 ms 852 KB Output is correct
14 Correct 2 ms 980 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 3 ms 596 KB Output is correct
20 Correct 2 ms 596 KB Output is correct
21 Incorrect 2 ms 596 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 912 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 3 ms 852 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 3 ms 980 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 2 ms 852 KB Output is correct
14 Correct 2 ms 980 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 3 ms 596 KB Output is correct
20 Correct 2 ms 596 KB Output is correct
21 Incorrect 2 ms 596 KB Output isn't correct
22 Halted 0 ms 0 KB -