Submission #1107016

# Submission time Handle Problem Language Result Execution time Memory
1107016 2024-10-31T11:37:36 Z dubabuba Money (IZhO17_money) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;


int main() {
	int n;
	cin >> n;

	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	
	set<int> s;
	s.insert(-a[0]);

	int cnt = 1;
	for(int i = 1; i < n; i++) {
		auto it = s.lower_bound(-a[i]);
		if(it != s.end() && (*it) == -a[i - 1]) {

		}
		else {
			cnt++;
		}

		// cout << i << ' ';
		// if(it == s.end()) cout << "NULL\n";
		// else cout << (*it) << endl;
		s.insert(-a[i]);
	}

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