Submission #173771

# Submission time Handle Problem Language Result Execution time Memory
173771 2020-01-05T11:34:37 Z AllMight Money (IZhO17_money) C++14
0 / 100
2 ms 380 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>

using namespace std;

const int N = 1000006;
const int INF = 100000009;

int n;
int a[N];

int main()
{
	ios_base::sync_with_stdio(false);

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	set <int> st;
	st.insert(INF);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int mx = *st.upper_bound(a[i]);
		st.insert(a[i]);

		while (i < n - 1 && a[i] < a[i + 1] && a[i + 1] < mx) {
			st.insert(a[i + 1]);
			i++;
		}
		ans++;
	}

	cout << ans << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -