Submission #340270

# Submission time Handle Problem Language Result Execution time Memory
340270 2020-12-27T11:14:10 Z Tosic Money (IZhO17_money) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#define maxn 1000010
using namespace std;

int n, a[maxn], ans;
multiset<int> aN;

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> n;
	vector<int> res;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		if(res.empty() or (a[i] >= res.back() and aN.upper_bound(res.back())==aN.upper_bound(a[i]))){
			res.push_back(a[i]);
		} else {
			for(auto j:res){
				aN.insert(j);
			}
			res.clear();
			++ans;
			res.push_back(a[i]);
		}
	}
	if(!res.empty()){
		++ans;
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -