이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |