Submission #171543

# Submission time Handle Problem Language Result Execution time Memory
171543 2019-12-29T05:57:10 Z juggernaut Money (IZhO17_money) C++14
45 / 100
1500 ms 58144 KB
//Just try and the idea will come!
#include<bits/stdc++.h>
using namespace std;
set<int>st;
int mx,n,i,a[1000001],ans;
main(){
    st.insert(1e8);
    scanf("%lld",&n);
    for(i=0;i<n;i++)scanf("%lld",&a[i]);
    i=0;
    while(i<n){
        mx=*st.upper_bound(a[i]);
        st.insert(a[i]);
        while(i+1<n&&a[i]<=a[i+1]&&a[i+1]<=mx)i++,st.insert(a[i]);
        i++;
        ans++;
    }
    printf("%lld",ans);
}

Compilation message

money.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
money.cpp: In function 'int main()':
money.cpp:8:20: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
     scanf("%lld",&n);
                  ~~^
money.cpp:9:39: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
     for(i=0;i<n;i++)scanf("%lld",&a[i]);
                                  ~~~~~^
money.cpp:18:22: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
     printf("%lld",ans);
                      ^
money.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
money.cpp:9:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=0;i<n;i++)scanf("%lld",&a[i]);
                     ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 400 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 400 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 400 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 400 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 81 ms 5416 KB Output is correct
40 Correct 146 ms 8880 KB Output is correct
41 Correct 65 ms 4344 KB Output is correct
42 Correct 63 ms 4088 KB Output is correct
43 Correct 47 ms 2936 KB Output is correct
44 Correct 179 ms 11108 KB Output is correct
45 Correct 173 ms 10876 KB Output is correct
46 Correct 176 ms 11000 KB Output is correct
47 Correct 155 ms 11128 KB Output is correct
48 Correct 164 ms 11000 KB Output is correct
49 Correct 663 ms 29616 KB Output is correct
50 Correct 648 ms 29468 KB Output is correct
51 Correct 634 ms 29696 KB Output is correct
52 Correct 638 ms 29488 KB Output is correct
53 Correct 631 ms 29432 KB Output is correct
54 Correct 610 ms 29452 KB Output is correct
55 Correct 1351 ms 57948 KB Output is correct
56 Correct 1379 ms 57992 KB Output is correct
57 Correct 1425 ms 58120 KB Output is correct
58 Correct 1415 ms 58088 KB Output is correct
59 Correct 1431 ms 58144 KB Output is correct
60 Execution timed out 1538 ms 58008 KB Time limit exceeded
61 Halted 0 ms 0 KB -