# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
36243 | touristk2000 | Money (IZhO17_money) | C++14 | 1500 ms | 53220 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define inf 1111111
using namespace std;
int n,tom;
int a[inf];
set<int> kom;
int main(){
//freopen("money.in","r",stdin);
//freopen("money.out","w",stdout);
scanf("%d",&n);
for(int i =0; i < n; i ++) scanf("%d",a + i);
kom.insert(inf);
int i = 0;
while(i < n){
kom.insert(a[i]);
int up = *kom.upper_bound(a[i]);
int j = i + 1;
while(a[j - 1] <= a[j] && a[j] <= up){
kom.insert(a[j ++]);
}
tom ++;
i = j;
}
cout << tom;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |