# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1226967 | cpdreamer | Boat (APIO16_boat) | C++20 | 1 ms | 324 KiB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long INF = 1e17;
typedef long long ll;
const ll MOD = 998244353;
#define F first
#define pb push_back
#define S second
#define P pair
#define V vector
#define all(v) v.begin(), v.end()
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;
void file() {
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
}
void solve() {
int n;
cin>>n;
int A[n];
int B[n];
for (int i=0;i<n;i++) {
cin>>A[i]>>B[i];
}
ll dp[n];
dp[0]=1LL;
ll ans=1;
for (int i=1;i<n;i++) {
dp[i]=1;
for (int j=i-1;j>=0;j--) {
if (A[j]<A[i]) {
dp[i]+=dp[j];
}
}
ans+=dp[i];
}
cout<<ans<<endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//file();
solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |