QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#357023#2774. SceneryCrysflyWA 1ms4324kbC++173.3kb2024-03-18 17:32:452024-03-18 17:32:46

Judging History

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

  • [2024-03-18 17:32:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4324kb
  • [2024-03-18 17:32:45]
  • 提交

answer

// what is matter? never mind. 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 998244353
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,modint b){return a.x==b.x;}
	friend bool operator !=(modint a,modint b){return a.x!=b.x;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 20005
#define inf 0x3f3f3f3f

int n,t;
pii a[maxn];
int b[maxn],m;
vi buc[maxn];
int f[maxn],mx[maxn];

bool work()
{
	n=read(),t=read();
	For(i,1,n)a[i].fi=read(),a[i].se=read(),b[++m]=a[i].fi,b[++m]=a[i].se;
	sort(b+1,b+m+1),m=unique(b+1,b+m+1)-b-1;
	For(i,1,n){
		a[i].fi=lower_bound(b+1,b+m+1,a[i].fi)-b;
		a[i].se=lower_bound(b+1,b+m+1,a[i].se)-b;
		buc[a[i].fi].pb(a[i].se);
	}
	memset(f,63,sizeof f);
	memset(mx,-63,sizeof mx);
	Rep(i,m,1){
		if(!buc[i].size())continue;
		sort(buc[i].begin(),buc[i].end());
		int p=-1;
		For(j,i,m){
			while(p+1<SZ(buc[i]) && buc[i][p+1]<=j)++p;
		//	cout<<"pos "<<j<<" "<<p<<"\n";
			if(p<0)continue;
			int x=b[buc[i][p]];
			if(x-mx[j]>=t) f[j]=min(f[j],x-t);
			else {
				f[j]=min(f[j]-t,x-t);
				if(f[j]<b[i]) return 0;
			}
			mx[j]=max(mx[j],x);
		}
	//	For(j,i,m)cout<<f[j]<<" "; cout<<"\n";
	}
	return 1;
}

signed main()
{
	if(work())puts("yes");
	else puts("no");
	return 0;
}
/*

*/

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4176kb

input:

2 10
0 15
5 20

output:

yes

result:

ok single line: 'yes'

Test #2:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

2 10
1 15
0 20

output:

no

result:

ok single line: 'no'

Test #3:

score: 0
Accepted
time: 1ms
memory: 4324kb

input:

2 10
5 30
10 20

output:

yes

result:

ok single line: 'yes'

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 4320kb

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'