Submission #171386

# Submission time Handle Problem Language Result Execution time Memory
171386 2019-12-28T13:45:49 Z juggernaut Money (IZhO17_money) C++14
45 / 100
1500 ms 61928 KB
//Just try and the idea will come!
#include<bits/stdc++.h>
#define int long long int
using namespace std;
set<int>st;
int mx,n,i,a[1000001],ans;
main(){
    st.insert(1e15);
    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:7:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
money.cpp: In function 'int main()':
money.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
money.cpp:10: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 1 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 1 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 1 ms 376 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 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 1 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 1 ms 376 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 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 3 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 3 ms 252 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 252 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 1 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 1 ms 376 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 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 3 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 3 ms 252 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 252 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 87 ms 7440 KB Output is correct
40 Correct 154 ms 11844 KB Output is correct
41 Correct 71 ms 5884 KB Output is correct
42 Correct 61 ms 5496 KB Output is correct
43 Correct 50 ms 3832 KB Output is correct
44 Correct 191 ms 14828 KB Output is correct
45 Correct 189 ms 14812 KB Output is correct
46 Correct 189 ms 15124 KB Output is correct
47 Correct 175 ms 15144 KB Output is correct
48 Correct 179 ms 15096 KB Output is correct
49 Correct 810 ms 33584 KB Output is correct
50 Correct 873 ms 33432 KB Output is correct
51 Correct 736 ms 33460 KB Output is correct
52 Correct 728 ms 33704 KB Output is correct
53 Correct 729 ms 33392 KB Output is correct
54 Correct 727 ms 33384 KB Output is correct
55 Execution timed out 1521 ms 61928 KB Time limit exceeded
56 Halted 0 ms 0 KB -