Submission #636826

# Submission time Handle Problem Language Result Execution time Memory
636826 2022-08-30T09:44:12 Z Tob Boat (APIO16_boat) C++14
0 / 100
2 ms 596 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;

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

ll DP(int x) {
	if (dp[x]) return dp[x];
	for (auto it : adj[x]) {
		dp[x] += DP(it);
	}
	dp[x]++;
	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 Incorrect 2 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -