Submission #85417

# Submission time Handle Problem Language Result Execution time Memory
85417 2018-11-19T20:12:16 Z ToadDaveski Money (IZhO17_money) C++14
45 / 100
1500 ms 89824 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
set <ll> st;
ll a[1000001];
int main()
{
    ll n,m,i,j,ans=0;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    st.insert(0);
    st.insert(10000000);
    for(i=1;i<=n;i++)
    {
        ans++;
        st.insert(a[i]);
        auto it=st.upper_bound(a[i]);
        while(i<n && a[i+1]>=a[i] && a[i+1]<=(*it))
        {
            st.insert(a[i+1]);
            i++;
        }
    }
    cout<<ans;
    return 0;
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:8:10: warning: unused variable 'm' [-Wunused-variable]
     ll n,m,i,j,ans=0;
          ^
money.cpp:8:14: warning: unused variable 'j' [-Wunused-variable]
     ll n,m,i,j,ans=0;
              ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 2 ms 508 KB Output is correct
9 Correct 2 ms 524 KB Output is correct
10 Correct 2 ms 532 KB Output is correct
11 Correct 2 ms 532 KB Output is correct
12 Correct 2 ms 532 KB Output is correct
13 Correct 2 ms 580 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 728 KB Output is correct
16 Correct 2 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 2 ms 508 KB Output is correct
9 Correct 2 ms 524 KB Output is correct
10 Correct 2 ms 532 KB Output is correct
11 Correct 2 ms 532 KB Output is correct
12 Correct 2 ms 532 KB Output is correct
13 Correct 2 ms 580 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 728 KB Output is correct
16 Correct 2 ms 728 KB Output is correct
17 Correct 2 ms 728 KB Output is correct
18 Correct 2 ms 728 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 728 KB Output is correct
22 Correct 2 ms 728 KB Output is correct
23 Correct 2 ms 728 KB Output is correct
24 Correct 2 ms 728 KB Output is correct
25 Correct 2 ms 728 KB Output is correct
26 Correct 2 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 2 ms 508 KB Output is correct
9 Correct 2 ms 524 KB Output is correct
10 Correct 2 ms 532 KB Output is correct
11 Correct 2 ms 532 KB Output is correct
12 Correct 2 ms 532 KB Output is correct
13 Correct 2 ms 580 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 728 KB Output is correct
16 Correct 2 ms 728 KB Output is correct
17 Correct 2 ms 728 KB Output is correct
18 Correct 2 ms 728 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 728 KB Output is correct
22 Correct 2 ms 728 KB Output is correct
23 Correct 2 ms 728 KB Output is correct
24 Correct 2 ms 728 KB Output is correct
25 Correct 2 ms 728 KB Output is correct
26 Correct 2 ms 728 KB Output is correct
27 Correct 2 ms 728 KB Output is correct
28 Correct 2 ms 728 KB Output is correct
29 Correct 2 ms 728 KB Output is correct
30 Correct 2 ms 728 KB Output is correct
31 Correct 2 ms 728 KB Output is correct
32 Correct 2 ms 728 KB Output is correct
33 Correct 2 ms 728 KB Output is correct
34 Correct 2 ms 728 KB Output is correct
35 Correct 2 ms 728 KB Output is correct
36 Correct 2 ms 728 KB Output is correct
37 Correct 2 ms 728 KB Output is correct
38 Correct 2 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 2 ms 508 KB Output is correct
9 Correct 2 ms 524 KB Output is correct
10 Correct 2 ms 532 KB Output is correct
11 Correct 2 ms 532 KB Output is correct
12 Correct 2 ms 532 KB Output is correct
13 Correct 2 ms 580 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 728 KB Output is correct
16 Correct 2 ms 728 KB Output is correct
17 Correct 2 ms 728 KB Output is correct
18 Correct 2 ms 728 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 728 KB Output is correct
22 Correct 2 ms 728 KB Output is correct
23 Correct 2 ms 728 KB Output is correct
24 Correct 2 ms 728 KB Output is correct
25 Correct 2 ms 728 KB Output is correct
26 Correct 2 ms 728 KB Output is correct
27 Correct 2 ms 728 KB Output is correct
28 Correct 2 ms 728 KB Output is correct
29 Correct 2 ms 728 KB Output is correct
30 Correct 2 ms 728 KB Output is correct
31 Correct 2 ms 728 KB Output is correct
32 Correct 2 ms 728 KB Output is correct
33 Correct 2 ms 728 KB Output is correct
34 Correct 2 ms 728 KB Output is correct
35 Correct 2 ms 728 KB Output is correct
36 Correct 2 ms 728 KB Output is correct
37 Correct 2 ms 728 KB Output is correct
38 Correct 2 ms 728 KB Output is correct
39 Correct 197 ms 7640 KB Output is correct
40 Correct 334 ms 15432 KB Output is correct
41 Correct 160 ms 15432 KB Output is correct
42 Correct 150 ms 16808 KB Output is correct
43 Correct 108 ms 17600 KB Output is correct
44 Correct 448 ms 30428 KB Output is correct
45 Correct 421 ms 36984 KB Output is correct
46 Correct 418 ms 42832 KB Output is correct
47 Correct 411 ms 42832 KB Output is correct
48 Correct 435 ms 42876 KB Output is correct
49 Correct 857 ms 61308 KB Output is correct
50 Correct 871 ms 61308 KB Output is correct
51 Correct 789 ms 61308 KB Output is correct
52 Correct 824 ms 61308 KB Output is correct
53 Correct 763 ms 61308 KB Output is correct
54 Correct 816 ms 61308 KB Output is correct
55 Correct 1413 ms 89704 KB Output is correct
56 Correct 1424 ms 89704 KB Output is correct
57 Correct 1460 ms 89704 KB Output is correct
58 Correct 1404 ms 89704 KB Output is correct
59 Correct 1373 ms 89736 KB Output is correct
60 Execution timed out 1578 ms 89824 KB Time limit exceeded
61 Halted 0 ms 0 KB -