Submission #92509

# Submission time Handle Problem Language Result Execution time Memory
92509 2019-01-03T08:03:21 Z Nodir_Bobiev Money (IZhO17_money) C++14
0 / 100
8 ms 376 KB
# include <iostream>
# include <set>

using namespace std;

const int N = 1e6 + 100;

int n;
int a[N], cnt, ans = 1;
set < int > st;

int main()
{
	cin >> n;
	
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	
	for (int i = 1; i <= n; i++){
		set < int > :: iterator lw;
		
		lw = st.lower_bound(a[i - cnt]);
		if((lw == st.end() || *lw >= a[i]) && a[i] >= a[i - 1])
			cnt++;
		
		else{
			ans++;
			
			for (int j = i - cnt; j < i; j++)
				st.insert(a[j]);
			
			cnt = 1;
		}
		
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Incorrect 8 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Incorrect 8 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Incorrect 8 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Incorrect 8 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -