Pagini recente » Borderou de evaluare (job #230418) | Borderou de evaluare (job #230490) | Borderou de evaluare (job #412) | Borderou de evaluare (job #2508696) | Borderou de evaluare (job #2602696)
Borderou de evaluare (job #2602696)
Raport evaluator
Compilare:
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
#import<stdio.h>
^~~~~~
main.cpp:2:151: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
int n,k,f=1,b,i,m,q=1,o,a[100001],d[100001],h[100001],x,y,z,g,j=1,c,e,l;int Q(int e[],int c,int b,int j) {for(;c<=b&&e[c]<j;c++);return a[e[c]];}main(){freopen("sir.in","r",stdin),freopen("sir.out","w",stdout),scanf("%d%d%d%d",&n,&x,&y,&z);for(i=1;i<=n;i++) {scanf("%d",a+i);for(;f<=b&&a[i]>=a[d[b]];b--);for(;q<=o&&a[i]<=a[h[o]];o--);d[++b]=h[++o]=i;for(;(j<=i-y||(l=Q(d,f,b,j)-Q(h,q,o,j))>z)&&j<=i-x+1;j++);if(j<=i-x+1&&l<=z&&g<=i-j+1)g=i-j+1,c=j,e=i;}if(g)printf("%d %d %d",g,c,e);else printf("-1");}
^
main.cpp: In function 'int main()':
main.cpp:2:240: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
int n,k,f=1,b,i,m,q=1,o,a[100001],d[100001],h[100001],x,y,z,g,j=1,c,e,l;int Q(int e[],int c,int b,int j) {for(;c<=b&&e[c]<j;c++);return a[e[c]];}main(){freopen("sir.in","r",stdin),freopen("sir.out","w",stdout),scanf("%d%d%d%d",&n,&x,&y,&z);for(i=1;i<=n;i++) {scanf("%d",a+i);for(;f<=b&&a[i]>=a[d[b]];b--);for(;q<=o&&a[i]<=a[h[o]];o--);d[++b]=h[++o]=i;for(;(j<=i-y||(l=Q(d,f,b,j)-Q(h,q,o,j))>z)&&j<=i-x+1;j++);if(j<=i-x+1&&l<=z&&g<=i-j+1)g=i-j+1,c=j,e=i;}if(g)printf("%d %d %d",g,c,e);else printf("-1");}
^
main.cpp:2:240: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
main.cpp:2:240: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
main.cpp:2:275: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
int n,k,f=1,b,i,m,q=1,o,a[100001],d[100001],h[100001],x,y,z,g,j=1,c,e,l;int Q(int e[],int c,int b,int j) {for(;c<=b&&e[c]<j;c++);return a[e[c]];}main(){freopen("sir.in","r",stdin),freopen("sir.out","w",stdout),scanf("%d%d%d%d",&n,&x,&y,&z);for(i=1;i<=n;i++) {scanf("%d",a+i);for(;f<=b&&a[i]>=a[d[b]];b--);for(;q<=o&&a[i]<=a[h[o]];o--);d[++b]=h[++o]=i;for(;(j<=i-y||(l=Q(d,f,b,j)-Q(h,q,o,j))>z)&&j<=i-x+1;j++);if(j<=i-x+1&&l<=z&&g<=i-j+1)g=i-j+1,c=j,e=i;}if(g)printf("%d %d %d",g,c,e);else printf("-1");}
^
Test |
Timp executie |
Memorie folosita |
Mesaj |
Punctaj/test |
1 | 2ms | 131kb | OK | 5 |
2 | 2ms | 131kb | OK | 5 |
3 | 2ms | 131kb | OK | 5 |
4 | 2ms | 131kb | OK | 5 |
5 | 4ms | 131kb | OK | 5 |
6 | 6ms | 131kb | OK | 5 |
7 | 10ms | 262kb | OK | 5 |
8 | 16ms | 262kb | OK | 5 |
9 | 18ms | 262kb | OK | 5 |
10 | 23ms | 262kb | OK | 5 |
11 | 27ms | 393kb | OK | 5 |
12 | 30ms | 393kb | OK | 5 |
13 | 29ms | 393kb | OK | 5 |
14 | 40ms | 524kb | OK | 5 |
15 | 51ms | 524kb | OK | 5 |
16 | 42ms | 524kb | OK | 5 |
17 | 6ms | 131kb | OK | 5 |
18 | 42ms | 524kb | OK | 5 |
19 | 44ms | 524kb | OK | 5 |
20 | 44ms | 524kb | OK | 5 |
Punctaj total | 100 |