답안 #990042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990042 2024-05-29T12:06:25 Z tch1cherin Money (IZhO17_money) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int &value : a) {
    cin >> value;
  }
  set<int> S;
  int answer = 1;
  for (int i = 1; i < N; i++) {
    if (a[i] < a[i - 1]) {
      answer++;
    } else {
      auto it = S.lower_bound(a[i - 1]);
      answer += it != S.end() && *it < a[i];
    }
    S.insert(a[i - 1]);
  }
  cout << answer << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -