Submission #884824

# Submission time Handle Problem Language Result Execution time Memory
884824 2023-12-08T13:45:40 Z KezzyBlue Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 2476 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,q;
struct dt{
	ll s,v;
};
ll b[1000006],d,maxs=0;
bool cmp(dt x,dt y)
{
	if(x.v<y.v)return true;
	if(x.v==y.v)
	{
		return x.s<y.s;
	}
	return false;
}
dt a[1000006];
void tinh(ll x,ll y,ll z)
{
	if(y>n||x>q)return;
	if(a[y].s<=b[x]&&a[y].v>=z)
	{
		ll t=z;
		z=a[y].v;
		d++;
		maxs=max(maxs,d);
		//cout<<a[y].s<<" "<<b[x]<<"\n";
		tinh(x+1,y+1,z);
		d--;
		z=t;
	}
	if(a[y].v<z)
		tinh(x,y+1,z);
	if(a[y].s>b[x])
		tinh(x+1,y,z);
}
int main()
{
	cin>>n>>q;
	for(ll i=1;i<=n;i++)
		cin>>a[i].s>>a[i].v;
	sort(a+1,a+n+1,cmp);
	for(ll i=1;i<=q;i++)
		cin>>b[i];
	sort(b+1,b+q+1);
	for(ll i=1;i<=n;i++)
		tinh(1,i,0);
	cout<<maxs;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2476 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2476 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2476 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Halted 0 ms 0 KB -