QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#633646#2774. ScenerycrsfaaWA 0ms3708kbC++141.1kb2024-10-12 15:56:352024-10-12 15:56:36

Judging History

你现在查看的是最新测评结果

  • [2024-10-12 15:56:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2024-10-12 15:56:35]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
const int mxn=1e4+5;
pair<int,int> a[mxn];
#define l first
#define r second
int main()
{
	int n=read(),t=read(),i,j;
	for(i=1;i<=n;i++)
		a[i].l=read(),a[i].r=read();
	sort(a+1,a+1+n);
	for(i=1;i<=n;i++)
		for(j=i+1;j<=n;j++)
			if(a[i].l<=a[j].l&&a[i].r>=a[j].r&&a[i].l+t*2>a[j].r)
			{
				a[i].l=a[j].l+t;
				if(a[i].r-a[i].l<t)
				{
					cout<<"no";
					return 0;
				}
			}
//	sort(a+1,a+1+n);
//	for(i=n;i;i--)
//		for(j=i+1;j<=n;j++)
//			if(a[i].l<=a[j].l&&a[i].r>=a[j].r&&a[i].l+t*2>a[j].r)
//			{
//				a[i].l=a[j].l+t;
//				if(a[i].r-a[i].l<t)
//				{
//					cout<<"no";
//					return 0;
//				}
//			}
	sort(a+1,a+1+n);
	int ti=0;
	for(i=1;i<=n;i++)
	{
		ti=max(ti,a[i].l)+t;
		if(ti>a[i].r)
		{
			cout<<"no";
			return 0;
		}
	}			
	cout<<"yes";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3508kb

input:

2 10
0 15
5 20

output:

yes

result:

ok single line: 'yes'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2 10
1 15
0 20

output:

no

result:

ok single line: 'no'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

2 10
5 30
10 20

output:

yes

result:

ok single line: 'yes'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3624kb

input:

11 6
0 74
2 60
4 34
10 36
21 46
26 40
28 38
30 48
50 68
52 68
54 62

output:

no

result:

wrong answer 1st lines differ - expected: 'yes', found: 'no'