import java.util.*;
import java.io.*;
public class triusis {
public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(r.readLine());
int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken());
TreeMap<Long, Integer> multiset = new TreeMap<>();
System.out.println("=====");
for (int i = 0; i < n; i++) {
int x = Integer.parseInt(r.readLine());
long z = m * (i + 1) - x;
if(z < 0){
continue;
}
if(multiset.floorKey(z) == null){
multiset.put(z, 1);
}
else{
multiset.put(z, multiset.get(multiset.floorKey(z)) + 1);
}
}
int max = 0;
for(int e : multiset.values()){
max = Math.max(e, max);
}
pw.println(n - max);
pw.close();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
8664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
8664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
8664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
8664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |