#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |