답안 #759691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
759691 2023-06-16T15:15:44 Z NK_ Money (IZhO17_money) C++17
0 / 100
1 ms 212 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'
#define pb push_back
#define sz(x) int(x.size())

const int INF = 1e9+10;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int N; cin >> N;
	vector<int> A(N); for(auto& x : A) cin >> x;

	set<int> S = {INF};

	int ans = 0;
	for(int i = 0; i < N; i++) {
		int mx = *S.upper_bound(A[i]);
		while(i+1 < N && A[i] <= A[i+1] && A[i+1] <= mx) i++, S.insert(A[i]);
		ans++;
	}
	cout << ans << nl;


}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -