답안 #571035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
571035 2022-06-01T06:11:52 Z saarang123 Money (IZhO17_money) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int MXN = 1000 * 1000 + 3;
int a[MXN];
signed main() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
    	cin >> a[i];
    }
    
    set<int> s = {MXN};
    int ans = 0;
    for(int j = 1, i = 1; i <= n; i = j) {
    	j = i + 1;
    	int x = *s.upper_bound(a[i]);
    	s.insert(a[j]);
    	while(j <= n && a[j - 1] <= a[j] && a[j] <= x)
    		s.insert(a[j++]);
    	ans++;
    }
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -