Submission #1610828
Source Code Expand
#include <cstdio> #include <cctype> #include <algorithm> #define repu(i,x,y) for (int i=x; i<=y; ++i) using namespace std; typedef long long LL; const int p=1000000007; int n,f[100100],g[100100]; LL a[100100],x,y; LL getLL() { char ch; while (!isdigit(ch=getchar())); int x=ch-'0'; for (; isdigit(ch=getchar()); x=x*10+ch-'0'); return x; } int main() { scanf("%d%lld%lld",&n,&x,&y); repu(i,1,n) a[i]=getLL(); f[0]=g[0]=1,f[1]=g[1]=p-1,a[0]=-1LL<<61,a[n+1]=1LL<<61; for (int i=0,l1=1,r1=1,l2=1,r2=1; i<n; ++i) { for (l1=max(l1,i+1); a[l1+1]-a[i]<x; ++l1); for (r1=max(r1,i+1); r1<n && a[r1+1]-a[r1]>=y; ++r1); for (l2=max(l2,i+1); a[l2+1]-a[i]<y; ++l2); for (r2=max(r2,i+1); r2<n && a[r2+1]-a[r2]>=x; ++r2); if (l1<=r1) (g[l1]+=f[i])%=p,(g[r1+1]+=p-f[i])%=p; if (l2<=r2) (f[l2]+=g[i])%=p,(f[r2+1]+=p-g[i])%=p; (f[i+1]+=f[i])%=p,(g[i+1]+=g[i])%=p; } printf("%d\n",(f[n]+g[n])%p); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Division into Two |
User | dwjshift |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1072 Byte |
Status | WA |
Exec Time | 19 ms |
Memory | 1664 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%lld%lld",&n,&x,&y); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1100 | ||||||
Status |
|
|
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 | WA | 17 ms | 1664 KB |
02.txt | WA | 15 ms | 1664 KB |
03.txt | WA | 17 ms | 1664 KB |
04.txt | WA | 16 ms | 1664 KB |
05.txt | WA | 15 ms | 1664 KB |
06.txt | WA | 16 ms | 1664 KB |
07.txt | WA | 17 ms | 1664 KB |
08.txt | WA | 16 ms | 1664 KB |
09.txt | WA | 17 ms | 1664 KB |
10.txt | WA | 17 ms | 1664 KB |
11.txt | WA | 17 ms | 1664 KB |
12.txt | WA | 17 ms | 1664 KB |
13.txt | WA | 17 ms | 1664 KB |
14.txt | WA | 16 ms | 1664 KB |
15.txt | WA | 16 ms | 1664 KB |
16.txt | AC | 7 ms | 1664 KB |
17.txt | AC | 10 ms | 1664 KB |
18.txt | WA | 12 ms | 1664 KB |
19.txt | AC | 10 ms | 1664 KB |
20.txt | AC | 11 ms | 1664 KB |
21.txt | AC | 10 ms | 1664 KB |
22.txt | WA | 11 ms | 1664 KB |
23.txt | AC | 8 ms | 1664 KB |
24.txt | AC | 10 ms | 1664 KB |
25.txt | WA | 14 ms | 1664 KB |
26.txt | WA | 14 ms | 1664 KB |
27.txt | WA | 13 ms | 1664 KB |
28.txt | WA | 13 ms | 1664 KB |
29.txt | WA | 11 ms | 1664 KB |
30.txt | WA | 11 ms | 1664 KB |
31.txt | WA | 11 ms | 1664 KB |
32.txt | WA | 12 ms | 1664 KB |
33.txt | WA | 13 ms | 1664 KB |
34.txt | AC | 9 ms | 1664 KB |
35.txt | WA | 14 ms | 1664 KB |
36.txt | AC | 7 ms | 1664 KB |
37.txt | AC | 7 ms | 1664 KB |
38.txt | AC | 7 ms | 1664 KB |
39.txt | WA | 17 ms | 1664 KB |
40.txt | AC | 7 ms | 1664 KB |
41.txt | AC | 8 ms | 1664 KB |
42.txt | AC | 7 ms | 1664 KB |
43.txt | WA | 18 ms | 1664 KB |
44.txt | WA | 17 ms | 1664 KB |
45.txt | WA | 17 ms | 1664 KB |
46.txt | WA | 19 ms | 1664 KB |
47.txt | AC | 17 ms | 1664 KB |
48.txt | AC | 17 ms | 1664 KB |
49.txt | WA | 1 ms | 128 KB |
50.txt | WA | 1 ms | 128 KB |
51.txt | AC | 1 ms | 128 KB |
52.txt | AC | 1 ms | 128 KB |
53.txt | AC | 1 ms | 128 KB |
54.txt | AC | 1 ms | 128 KB |
55.txt | AC | 1 ms | 128 KB |
56.txt | WA | 1 ms | 128 KB |
57.txt | AC | 1 ms | 128 KB |
58.txt | AC | 1 ms | 128 KB |
59.txt | AC | 1 ms | 128 KB |
60.txt | AC | 1 ms | 128 KB |
61.txt | AC | 1 ms | 128 KB |
62.txt | AC | 1 ms | 128 KB |
63.txt | AC | 1 ms | 128 KB |
64.txt | AC | 1 ms | 128 KB |
s1.txt | AC | 1 ms | 128 KB |
s2.txt | AC | 1 ms | 128 KB |
s3.txt | AC | 1 ms | 128 KB |
s4.txt | AC | 1 ms | 128 KB |