Submission #749824

# Submission time Handle Problem Language Result Execution time Memory
749824 2023-05-28T14:50:49 Z MysticCoder Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vll vector<long long>
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;  // find_by_order(), order_of_key()
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);   
int t;
t=1;
while(t--) {
int n,m;
cin>>n>>m;
vector<int> v(n+1);
for(int i=1;i<=n;i++) cin>>v[i];
vector<int> v1;
for(int i=1;i<=n;i++) {
    if((m*i)>=v[i]) v1.push_back((m*i)-v[i]);
}
multiset<int> st;
int ans=0;
for(int i=0;i<v1.size();i++) {
    auto it=st.upper_bound(v1[i]);
    if(it==st.end()) ans++;
    else st.erase(it);
    st.insert(v[i]);
}
cout<<ans<<endl;
}
return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:27:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 | for(int i=0;i<v1.size();i++) {
      |             ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -