답안 #332456

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332456 2020-12-02T15:56:56 Z dolphingarlic Bigger segments (IZhO19_segments) C++14
100 / 100
92 ms 12140 KB
#include <stdio.h>
const int N=6e5;long a[N],b[N];int c[N],l,r,d[N],n,i;main(){scanf("%d", &n);for(i=1;i<=n;++i){scanf("%d",a+i);a[i]+=a[i-1];while (r-l&&a[i]-a[d[l + 1]]>=b[d[l + 1]])++l;c[i]=c[d[l]]+1;b[i]=a[i]-a[d[l]];while(b[d[r]]-b[i]>=a[i]-a[d[r]])--r;d[++r]=i;}printf("%d", c[n]);}

Compilation message

segments.cpp:2:59: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | const int N=6e5;long a[N],b[N];int c[N],l,r,d[N],n,i;main(){scanf("%d", &n);for(i=1;i<=n;++i){scanf("%d",a+i);a[i]+=a[i-1];while (r-l&&a[i]-a[d[l + 1]]>=b[d[l + 1]])++l;c[i]=c[d[l]]+1;b[i]=a[i]-a[d[l]];while(b[d[r]]-b[i]>=a[i]-a[d[r]])--r;d[++r]=i;}printf("%d", c[n]);}
      |                                                           ^
segments.cpp: In function 'int main()':
segments.cpp:2:103: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long int*' [-Wformat=]
    2 | const int N=6e5;long a[N],b[N];int c[N],l,r,d[N],n,i;main(){scanf("%d", &n);for(i=1;i<=n;++i){scanf("%d",a+i);a[i]+=a[i-1];while (r-l&&a[i]-a[d[l + 1]]>=b[d[l + 1]])++l;c[i]=c[d[l]]+1;b[i]=a[i]-a[d[l]];while(b[d[r]]-b[i]>=a[i]-a[d[r]])--r;d[++r]=i;}printf("%d", c[n]);}
      |                                                                                                      ~^  ~~~
      |                                                                                                       |   |
      |                                                                                                       |   long int*
      |                                                                                                       int*
      |                                                                                                      %ld
segments.cpp:2:66: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    2 | const int N=6e5;long a[N],b[N];int c[N],l,r,d[N],n,i;main(){scanf("%d", &n);for(i=1;i<=n;++i){scanf("%d",a+i);a[i]+=a[i-1];while (r-l&&a[i]-a[d[l + 1]]>=b[d[l + 1]])++l;c[i]=c[d[l]]+1;b[i]=a[i]-a[d[l]];while(b[d[r]]-b[i]>=a[i]-a[d[r]])--r;d[++r]=i;}printf("%d", c[n]);}
      |                                                             ~~~~~^~~~~~~~~~
segments.cpp:2:100: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    2 | const int N=6e5;long a[N],b[N];int c[N],l,r,d[N],n,i;main(){scanf("%d", &n);for(i=1;i<=n;++i){scanf("%d",a+i);a[i]+=a[i-1];while (r-l&&a[i]-a[d[l + 1]]>=b[d[l + 1]])++l;c[i]=c[d[l]]+1;b[i]=a[i]-a[d[l]];while(b[d[r]]-b[i]>=a[i]-a[d[r]])--r;d[++r]=i;}printf("%d", c[n]);}
      |                                                                                               ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 0 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 0 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 0 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 0 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 0 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 0 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 13 ms 2668 KB Output is correct
47 Correct 14 ms 2540 KB Output is correct
48 Correct 16 ms 2284 KB Output is correct
49 Correct 24 ms 2540 KB Output is correct
50 Correct 23 ms 2740 KB Output is correct
51 Correct 27 ms 2540 KB Output is correct
52 Correct 9 ms 1516 KB Output is correct
53 Correct 6 ms 1004 KB Output is correct
54 Correct 13 ms 2540 KB Output is correct
55 Correct 17 ms 2668 KB Output is correct
56 Correct 14 ms 2668 KB Output is correct
57 Correct 14 ms 2668 KB Output is correct
58 Correct 14 ms 2668 KB Output is correct
59 Correct 14 ms 2668 KB Output is correct
60 Correct 16 ms 2668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 0 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 0 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 13 ms 2668 KB Output is correct
47 Correct 14 ms 2540 KB Output is correct
48 Correct 16 ms 2284 KB Output is correct
49 Correct 24 ms 2540 KB Output is correct
50 Correct 23 ms 2740 KB Output is correct
51 Correct 27 ms 2540 KB Output is correct
52 Correct 9 ms 1516 KB Output is correct
53 Correct 6 ms 1004 KB Output is correct
54 Correct 13 ms 2540 KB Output is correct
55 Correct 17 ms 2668 KB Output is correct
56 Correct 14 ms 2668 KB Output is correct
57 Correct 14 ms 2668 KB Output is correct
58 Correct 14 ms 2668 KB Output is correct
59 Correct 14 ms 2668 KB Output is correct
60 Correct 16 ms 2668 KB Output is correct
61 Correct 72 ms 12140 KB Output is correct
62 Correct 67 ms 12012 KB Output is correct
63 Correct 71 ms 11500 KB Output is correct
64 Correct 84 ms 10604 KB Output is correct
65 Correct 81 ms 12012 KB Output is correct
66 Correct 92 ms 11756 KB Output is correct
67 Correct 71 ms 9452 KB Output is correct
68 Correct 36 ms 4844 KB Output is correct
69 Correct 66 ms 11628 KB Output is correct
70 Correct 83 ms 11884 KB Output is correct
71 Correct 68 ms 12140 KB Output is correct
72 Correct 66 ms 11628 KB Output is correct
73 Correct 71 ms 11756 KB Output is correct
74 Correct 74 ms 12012 KB Output is correct
75 Correct 74 ms 12012 KB Output is correct