Submission #853290

# Submission time Handle Problem Language Result Execution time Memory
853290 2023-09-24T01:27:33 Z NeroZein Money (IZhO17_money) C++17
0 / 100
0 ms 348 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> lds; 
  for (int i = 0; i < n; ++i) {
    int ind = upper_bound(lds.begin(), lds.end(), -a[i]) - lds.begin();
    if (ind == (int) lds.size()) {
      lds.push_back(-a[i]); 
    } else {
      lds[ind] = -a[i];
    }
  }
  cout << lds.size() << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -