Submission #598055

# Submission time Handle Problem Language Result Execution time Memory
598055 2022-07-17T13:03:59 Z Summers Money (IZhO17_money) C++14
100 / 100
955 ms 61952 KB
#include<bits/stdc++.h>
#include<set>
#define endl '\n'
using namespace std;
set<long long>st;
long long a[1000001];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long i,j,n,ans=0;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    st.insert(a[1]); st.insert(1000001);

    for(i=1;i<=n;)
    {
        auto it=st.upper_bound(a[i]);

        st.insert(a[i]);i++;
        while(i<=n && a[i]>=a[i-1] && a[i]<=(*it))
        {
            st.insert(a[i]); i++;
        }
        ans++;
    }
    cout<<ans<<endl;

}

Compilation message

money.cpp: In function 'int main()':
money.cpp:13:17: warning: unused variable 'j' [-Wunused-variable]
   13 |     long long i,j,n,ans=0;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 328 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 328 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 0 ms 340 KB Output is correct
39 Correct 53 ms 7256 KB Output is correct
40 Correct 90 ms 11820 KB Output is correct
41 Correct 41 ms 5836 KB Output is correct
42 Correct 37 ms 5304 KB Output is correct
43 Correct 30 ms 3860 KB Output is correct
44 Correct 124 ms 14744 KB Output is correct
45 Correct 110 ms 14764 KB Output is correct
46 Correct 113 ms 14972 KB Output is correct
47 Correct 102 ms 14904 KB Output is correct
48 Correct 92 ms 14860 KB Output is correct
49 Correct 412 ms 33368 KB Output is correct
50 Correct 403 ms 33412 KB Output is correct
51 Correct 389 ms 33324 KB Output is correct
52 Correct 429 ms 33336 KB Output is correct
53 Correct 371 ms 33484 KB Output is correct
54 Correct 432 ms 33248 KB Output is correct
55 Correct 916 ms 61916 KB Output is correct
56 Correct 947 ms 61844 KB Output is correct
57 Correct 955 ms 61796 KB Output is correct
58 Correct 861 ms 61752 KB Output is correct
59 Correct 917 ms 61772 KB Output is correct
60 Correct 904 ms 61792 KB Output is correct
61 Correct 906 ms 61952 KB Output is correct
62 Correct 901 ms 61928 KB Output is correct