답안 #344800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344800 2021-01-06T14:52:12 Z scales Money (IZhO17_money) C++17
100 / 100
1270 ms 64420 KB
#include <bits/stdc++.h>
/*#ifndef LOCAL_RUN
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC optimize("fast-math")
    #pragma GCC target("avx2,tune=native")
#endif*/
using namespace std;
long long M=1000000007;

int main()
{
        ios::sync_with_stdio(false);
        cin.tie(0);
    long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    vector<long long> a(n),b(n);
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    kol=1;
    maxi=M;
    set<long long> s;
    auto g=s.end();
    s.insert(a[0]);
    for(i=1;i<n;i++)
    {
        if(a[i]<a[i-1] || a[i]>maxi)
        {
            g=s.upper_bound(a[i]);
            if(g==s.end())
            {
                maxi=M;
            }
            else
            {
                maxi=*g;
            }
            kol++;
        }
        else
        {

        }
        s.insert(a[i]);
    }
    cout<<kol<<endl;
    return 0;
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:15:17: warning: unused variable 't' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                 ^
money.cpp:15:21: warning: unused variable 'j' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                     ^
money.cpp:15:23: warning: unused variable 'y' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                       ^
money.cpp:15:25: warning: unused variable 'x1' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                         ^~
money.cpp:15:28: warning: unused variable 'y1' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                            ^~
money.cpp:15:31: warning: unused variable 'sum' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                               ^~~
money.cpp:15:35: warning: unused variable 'x' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                   ^
money.cpp:15:37: warning: unused variable 'q' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                     ^
money.cpp:15:39: warning: unused variable 'l' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                       ^
money.cpp:15:41: warning: unused variable 'r' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                         ^
money.cpp:15:43: warning: unused variable 'tip' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                           ^~~
money.cpp:15:47: warning: unused variable 'k' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                               ^
money.cpp:15:49: warning: unused variable 'mini' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                                 ^~~~
money.cpp:15:63: warning: unused variable 'p' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                                               ^
money.cpp:15:65: warning: unused variable 'v' [-Wunused-variable]
   15 |     long long   t,i,j,y,x1,y1,sum,x,q,l,r,tip,k,mini,maxi,kol,p,v,n;
      |                                                                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 384 KB Output is correct
39 Correct 63 ms 9580 KB Output is correct
40 Correct 115 ms 14032 KB Output is correct
41 Correct 49 ms 8172 KB Output is correct
42 Correct 48 ms 7680 KB Output is correct
43 Correct 34 ms 5740 KB Output is correct
44 Correct 129 ms 17388 KB Output is correct
45 Correct 126 ms 17400 KB Output is correct
46 Correct 142 ms 17388 KB Output is correct
47 Correct 111 ms 17260 KB Output is correct
48 Correct 118 ms 17376 KB Output is correct
49 Correct 556 ms 35792 KB Output is correct
50 Correct 553 ms 35820 KB Output is correct
51 Correct 552 ms 35948 KB Output is correct
52 Correct 536 ms 35756 KB Output is correct
53 Correct 563 ms 35948 KB Output is correct
54 Correct 554 ms 35948 KB Output is correct
55 Correct 1243 ms 64340 KB Output is correct
56 Correct 1270 ms 64268 KB Output is correct
57 Correct 1232 ms 64172 KB Output is correct
58 Correct 1257 ms 64236 KB Output is correct
59 Correct 1267 ms 64420 KB Output is correct
60 Correct 1224 ms 64396 KB Output is correct
61 Correct 1249 ms 64236 KB Output is correct
62 Correct 1244 ms 64344 KB Output is correct