# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
546416 |
2022-04-07T13:30:39 Z |
syrtin |
Money (IZhO17_money) |
C++17 |
|
0 ms |
212 KB |
#include <bits/stdc++.h>
#define ss second
#define ff first
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1e5 + 123;
const int mod = 998244353;
const int inf = 1e9;
void solve() {
int n;
cin >> n;
int a, ans = 1, x = -1;
set<int> s;
while(n) {
cin >> a;
if(a >= x) {
x = a;
s.insert(x);
}
else {
ans++;
x = a;
s.insert(x);
n--;
break;
}
n--;
}
while(n) {
cin >> a;
if(a < x || (s.upper_bound(x) != s.end() && *s.upper_bound(x) >= a))ans++;
s.insert(a);
x = a;
n--;
}
cout << ans;
}
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |