답안 #640378

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
640378 2022-09-14T12:28:33 Z tvladm2009 Money (IZhO17_money) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using ll = long long;

const int MAX_N = 1e6;
const int INF = (1 << 30);

int a[1 + MAX_N];
std::set<int> s;

int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    std::cin >> a[i];
  }
  int answer = 0, next = INF;
  s.insert(INF);
  for (int i = 1; i <= n; i++) {
    if (i == 1 || a[i - 1] > a[i] || (*s.lower_bound(a[i])) != next) {
      answer++;
      next = *s.lower_bound(a[i]);
    }
    s.insert(a[i]);
  }
  std::cout << answer;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 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 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 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 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 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 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -