#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i = l; i < r; i++)
#define per(i,r,l) for(int i = r; i >= l; i--)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define ff first
#define ss second
const ll mod = 998244353, maxn = 2e5 + 5, inf = 1e9 + 5;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
vector<int> t(n), a;
rep(i,1,n + 1){
int k; cin >> k;
t[i] = m*i - k;
}
rep(i,1,n + 1) if(t[i] >= 0) a.pb(t[i]);
multiset<int> s;
rep(i,0,sz(a)){
auto it = s.upper_bound(a[i]);
if(it != s.end()) s.erase(it);
s.insert(a[i]);
}
cout << n - sz(s);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |