Submission #1437840


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long n,a,b,x[100005],dp[100005][2];
vector<long long>g1,g2;
int main()
{
	cin>>n>>a>>b;
	x[1]=-(1LL<<62);
	x[n+2]=(1LL<<62);
	g1.push_back(2);
	g2.push_back(2);
	for(int i=2;i<=n+1;i++)
	{
		cin>>x[i];
		if(x[i]-x[i-1]<a)g1.push_back(i);
		if(x[i]-x[i-1]<b)g2.push_back(i);
	}
	dp[1][0]=1;
	dp[1][1]=1;
	for(int i=2;i<=n+1;i++)
	{
		int p1=upper_bound(x,x+n+3,x[i+1]-a)-x-1;
		if(p1==i)p1--;
		int p2=upper_bound(g2.begin(),g2.end(),i)-g2.begin()-1;
		p2=g2[p2]-1;
		if(p1>=p2)dp[i][0]=(dp[p1][1]-dp[p2-1][1]+md)%md;
		dp[i][0]=(dp[i][0]+dp[i-1][0])%md;
		p1=upper_bound(x,x+n+3,x[i+1]-b)-x-1;
		if(p1==i)p1--;
		p2=upper_bound(g1.begin(),g1.end(),i)-g1.begin()-1;
		p2=g1[p2]-1;
		if(p1>=p2)dp[i][1]=(dp[p1][0]-dp[p2-1][0]+md)%md;
		dp[i][1]=(dp[i][1]+dp[i-1][1])%md;
	}
	cout<<(dp[n+1][0]+dp[n+1][1]-dp[n][0]-dp[n][1]+md*2)%md<<endl;
	return 0;
}

Submission Info

Submission Time
Task C - Division into Two
User vjudge1
Language Bash (GNU bash v4.3.11)
Score 0
Code Size 924 Byte
Status RE
Exec Time 6 ms
Memory 556 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
RE × 4
RE × 68
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, 61.txt, 62.txt, 63.txt, 64.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt RE 6 ms 556 KB
02.txt RE 3 ms 536 KB
03.txt RE 3 ms 548 KB
04.txt RE 3 ms 552 KB
05.txt RE 3 ms 544 KB
06.txt RE 3 ms 556 KB
07.txt RE 3 ms 548 KB
08.txt RE 4 ms 552 KB
09.txt RE 4 ms 548 KB
10.txt RE 3 ms 544 KB
11.txt RE 3 ms 556 KB
12.txt RE 4 ms 548 KB
13.txt RE 3 ms 544 KB
14.txt RE 3 ms 544 KB
15.txt RE 3 ms 548 KB
16.txt RE 4 ms 556 KB
17.txt RE 3 ms 548 KB
18.txt RE 4 ms 548 KB
19.txt RE 3 ms 552 KB
20.txt RE 4 ms 552 KB
21.txt RE 4 ms 548 KB
22.txt RE 4 ms 544 KB
23.txt RE 3 ms 548 KB
24.txt RE 3 ms 548 KB
25.txt RE 4 ms 548 KB
26.txt RE 4 ms 556 KB
27.txt RE 4 ms 556 KB
28.txt RE 3 ms 544 KB
29.txt RE 3 ms 552 KB
30.txt RE 4 ms 548 KB
31.txt RE 3 ms 544 KB
32.txt RE 4 ms 548 KB
33.txt RE 3 ms 548 KB
34.txt RE 3 ms 548 KB
35.txt RE 3 ms 544 KB
36.txt RE 4 ms 552 KB
37.txt RE 4 ms 548 KB
38.txt RE 4 ms 544 KB
39.txt RE 4 ms 544 KB
40.txt RE 4 ms 540 KB
41.txt RE 4 ms 556 KB
42.txt RE 3 ms 544 KB
43.txt RE 3 ms 548 KB
44.txt RE 4 ms 548 KB
45.txt RE 4 ms 548 KB
46.txt RE 4 ms 544 KB
47.txt RE 4 ms 552 KB
48.txt RE 4 ms 552 KB
49.txt RE 4 ms 540 KB
50.txt RE 4 ms 548 KB
51.txt RE 4 ms 548 KB
52.txt RE 4 ms 552 KB
53.txt RE 4 ms 556 KB
54.txt RE 3 ms 544 KB
55.txt RE 3 ms 544 KB
56.txt RE 4 ms 556 KB
57.txt RE 4 ms 548 KB
58.txt RE 4 ms 544 KB
59.txt RE 4 ms 544 KB
60.txt RE 4 ms 548 KB
61.txt RE 4 ms 544 KB
62.txt RE 4 ms 544 KB
63.txt RE 4 ms 544 KB
64.txt RE 4 ms 544 KB
s1.txt RE 3 ms 548 KB
s2.txt RE 4 ms 544 KB
s3.txt RE 3 ms 548 KB
s4.txt RE 4 ms 540 KB