Submission #385032

#TimeUsernameProblemLanguageResultExecution timeMemory
385032zoooma13Money (IZhO17_money)C++14
100 / 100
1227 ms58164 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    vector <int> a(n);
    for(int&i : a)
        scanf("%d",&i);

    set <int> s{INT_MAX};
    int ans = 1 ,lst = 0;
    for(int i = 1; i < n; i++){
        if(a[i] < a[i-1] || *s.upper_bound(a[lst]) < a[i]){
            for(int j = lst; j < i; j++)
                s.insert(a[j]);
            lst = i;
            ans++;
        }
    }

    printf("%d\n",ans);
}

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
money.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d",&i);
      |         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...