Submission #749829

# Submission time Handle Problem Language Result Execution time Memory
749829 2023-05-28T15:44:20 Z MysticCoder Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 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,sz=v1.size();
for(int i=0;i<sz;i++) {
    auto it=st.upper_bound(v1[i]);
    if(it==st.end()) ans++;
    else st.erase(it);
    st.insert(v[i]);
}
cout<<n-ans<<endl;
}
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -