QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601987#8780. Training, Round 2gtrhetrTL 0ms0kbC++14976b2024-09-30 17:22:192024-09-30 17:22:20

Judging History

This is the latest submission verdict.

  • [2024-09-30 17:22:20]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 0kb
  • [2024-09-30 17:22:19]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

set<int> st[5010];

int n,x,y;
bool bo[5010][5010];

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	freopen("hh.in","r",stdin);
	n=rd();x=rd();y=rd();
	bo[0][0]=true;
	st[0].insert(0);
	for (int i=1;i<=n;i++)
	{
		int l1=rd(),r1=rd(),l2=rd(),r2=rd();
		for (int j=i-1;j>=0;j--)
		{
			int l=max(l1-x,j-(r2-y)),r=min(r1-x,j-(l2-y));
			if (l>r||r<0||l>=i) continue;
			for (set<int>::iterator it=st[j].lower_bound(l);it!=st[j].end()&&*it<=r;st[j].erase(it++))
			{
				if (!bo[j+1][*it])
				{
					st[j+1].insert(*it);
					bo[j+1][*it]=true;
				}
				if (!bo[j+1][*it+1])
				{
					st[j+1].insert(*it+1);
					bo[j+1][*it+1]=true;
				}
			}
		}
	}
	int ans=0;
	for (int i=1;i<=n;i++) for (int j=0;j<=i;j++) if (bo[i][j]) ans=i;
	printf("%d\n",ans);
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

output:


result: