Submission #772229

#TimeUsernameProblemLanguageResultExecution timeMemory
772229sushikidRabbit Carrot (LMIO19_triusis)Java
0 / 100
50 ms8664 KiB
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...