# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
966243 | vjudge1 | Financial Report (JOI21_financial) | C++17 | 42 ms | 6096 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
#define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
#define nl "\n"
#define ss " "
#define sz size()
#define pb emplace_back
#define pf push_front
#define fi first
#define se second
#define ms(a,x) memset(a, x, sizeof (a))
#define re exit(0)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
const ll mod=1e9+7, maxn=3e5+5, inf=1e18;
void rf(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
if(fopen("o.inp","r")){
freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
}
}
int n, d, a[maxn];
pii f[maxn];
vi v;
int main()
{
rf();
cin>>n>>d;
ff(i, 1, n) cin>>a[i], f[i].fi=1, f[i].se=a[i];
if(d==n)
{
ff(i, 1, n)
{
auto it=lower_bound(v.begin(), v.end(), a[i]);
if(it==v.end()) v.pb(a[i]);
else *it=a[i];
}
cout<<v.sz;
}
else if(d==1)
{
int ans=1;
ff(i, 2, n)
{
if(f[i].se>f[i-1].se) f[i].fi=f[i-1].fi+1;
ans=max(ans, f[i].fi);
}
cout<<ans;
}
re;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |