Submission #997686

# Submission time Handle Problem Language Result Execution time Memory
997686 2024-06-12T17:15:34 Z akamizane Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
212 ms 164160 KB
// brute f0rce spammer
 
#include<bits/stdc++.h>
 
using namespace std;
 
typedef pair<long long,long long> pii;

#define int long long 
#define el cout << '\n'
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define debug(f,n) for (int i = 0; i < n; i++){cout << f[i] << " ";} el;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FOD(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define maxn 4003
#define mod 998244353

template <class T1, class T2>bool maximize(T1 &a, T2 b){if (a < b) {a = b; return true;}return false;}
template <class T1, class T2>bool minimize(T1 &a, T2 b){if (a > b) {a = b; return true;}return false;}

vector<vector<bool>> vis;
vector<vector<char>> x;
int minr, maxr, minc, maxc, cnt;
int m, n;

void solve(){
 int n, k;
 cin >> n >> k;
 vector<int> x(n + 1);
 FOR(i, 1, n) cin >> x[i];
 vector<int> ans;
 FOR(i, 1, n){
  if (k * i - x[i] >= 0){
    ans.pb(x[i]);
  }
 }
 vector<int> res;
 for (auto k : ans){
  int idx = upper_bound(all(res), k) - res.begin();
  if (idx == res.size()){
    res.pb(k);
  }
   else res[idx] = k;
 }
 cout << n - res.size();
}

signed main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q = 1;
  //cin >> q;
  while(q--){
   solve();
   el;
  }
  return 0;
}

Compilation message

triusis.cpp: In function 'void solve()':
triusis.cpp:44:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   if (idx == res.size()){
      |       ~~~~^~~~~~~~~~~~~
triusis.cpp: In function 'int main()':
triusis.cpp:54:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |   freopen("input.txt", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:55:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |   freopen("output.txt", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 212 ms 164160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 212 ms 164160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 212 ms 164160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 212 ms 164160 KB Output isn't correct
2 Halted 0 ms 0 KB -