Submission #89745

# Submission time Handle Problem Language Result Execution time Memory
89745 2018-12-18T09:13:36 Z RAkhshon Money (IZhO17_money) C++14
45 / 100
1500 ms 55408 KB
#include <bits/stdc++.h>
#define ll long long
#define INF  998244353
using namespace std;
ll a[1011011];
set< ll > st;
int main()
{
ll n;
scanf("%lld", &n);
for(ll i = 1; i<= n; i ++ ){
    scanf("%lld", &a[i]);
}
ll ans = 0, i;
st.insert(1000000000);
for(  i = 1; i <= n; i ++ ){
    ans++;
    st.insert(a[i]);
    auto x = st.upper_bound(a[i]);
    while( i < n && a[i]<=a[i+1] && a[i+1]<=*x ){
        st.insert(a[i+1]);
        i++;
    }
}
printf("%lld", ans);
return 0;
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:10:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%lld", &n);
 ~~~~~^~~~~~~~~~~~
money.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &a[i]);
     ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 2 ms 592 KB Output is correct
12 Correct 2 ms 592 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 608 KB Output is correct
15 Correct 2 ms 608 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 2 ms 592 KB Output is correct
12 Correct 2 ms 592 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 608 KB Output is correct
15 Correct 2 ms 608 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 2 ms 608 KB Output is correct
18 Correct 2 ms 608 KB Output is correct
19 Correct 2 ms 608 KB Output is correct
20 Correct 2 ms 620 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 2 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 2 ms 592 KB Output is correct
12 Correct 2 ms 592 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 608 KB Output is correct
15 Correct 2 ms 608 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 2 ms 608 KB Output is correct
18 Correct 2 ms 608 KB Output is correct
19 Correct 2 ms 608 KB Output is correct
20 Correct 2 ms 620 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 2 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 2 ms 636 KB Output is correct
28 Correct 2 ms 636 KB Output is correct
29 Correct 3 ms 636 KB Output is correct
30 Correct 2 ms 636 KB Output is correct
31 Correct 2 ms 636 KB Output is correct
32 Correct 2 ms 636 KB Output is correct
33 Correct 2 ms 636 KB Output is correct
34 Correct 2 ms 640 KB Output is correct
35 Correct 2 ms 640 KB Output is correct
36 Correct 2 ms 640 KB Output is correct
37 Correct 2 ms 640 KB Output is correct
38 Correct 2 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 2 ms 592 KB Output is correct
12 Correct 2 ms 592 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 608 KB Output is correct
15 Correct 2 ms 608 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 2 ms 608 KB Output is correct
18 Correct 2 ms 608 KB Output is correct
19 Correct 2 ms 608 KB Output is correct
20 Correct 2 ms 620 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 2 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 2 ms 636 KB Output is correct
28 Correct 2 ms 636 KB Output is correct
29 Correct 3 ms 636 KB Output is correct
30 Correct 2 ms 636 KB Output is correct
31 Correct 2 ms 636 KB Output is correct
32 Correct 2 ms 636 KB Output is correct
33 Correct 2 ms 636 KB Output is correct
34 Correct 2 ms 640 KB Output is correct
35 Correct 2 ms 640 KB Output is correct
36 Correct 2 ms 640 KB Output is correct
37 Correct 2 ms 640 KB Output is correct
38 Correct 2 ms 640 KB Output is correct
39 Correct 83 ms 4268 KB Output is correct
40 Correct 147 ms 6776 KB Output is correct
41 Correct 66 ms 6776 KB Output is correct
42 Correct 65 ms 6776 KB Output is correct
43 Correct 48 ms 6776 KB Output is correct
44 Correct 180 ms 8436 KB Output is correct
45 Correct 175 ms 8548 KB Output is correct
46 Correct 179 ms 8548 KB Output is correct
47 Correct 156 ms 8548 KB Output is correct
48 Correct 166 ms 8548 KB Output is correct
49 Correct 764 ms 26816 KB Output is correct
50 Correct 794 ms 26860 KB Output is correct
51 Correct 770 ms 26992 KB Output is correct
52 Correct 760 ms 27024 KB Output is correct
53 Correct 729 ms 27024 KB Output is correct
54 Correct 724 ms 27064 KB Output is correct
55 Execution timed out 1567 ms 55408 KB Time limit exceeded
56 Halted 0 ms 0 KB -