Submission #219288

# Submission time Handle Problem Language Result Execution time Memory
219288 2020-04-05T04:41:10 Z quocnguyen1012 Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 2e5 + 5;

ll a[maxn];
int N, M;
vector<ll> f;

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL
  cin >> N >> M;
  for(int i = 1; i <= N; ++i){
    cin >> a[i];
    a[i] = i * M - a[i];
    int idx = upper_bound(f.begin(), f.end(), a[i]) - f.begin();
    if(idx == f.size()){
      f.eb(a[i]);
    }
    else{
      f[idx] = a[i];
    }
  }
  cout << N - f.size();
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:31:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(idx == f.size()){
        ~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -