답안 #340267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
340267 2020-12-27T11:13:03 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;
set<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.lower_bound(res.back())==aN.lower_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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -