Submission #377321

#TimeUsernameProblemLanguageResultExecution timeMemory
377321timg8710Stove (JOI18_stove)Java
Compilation error
0 ms0 KiB
// package olypmiads; import java.io.*; import java.util.*; public class stovejoi { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int K = Integer.parseInt(st.nextToken())-1; List<Integer> gaps = new ArrayList(); int c = Integer.parseInt(br.readLine()); int ret = 1; for(int i = 0; i<N-1; i++){ int n = Integer.parseInt(br.readLine()); gaps.add(n - c - 1); ret += n - c; c = n; } Collections.sort(gaps, Collections.reverseOrder()); for(int i = 0; i<Math.min(K, gaps.size()); i++) ret -= gaps.get(i); pw.println(ret); pw.close(); br.close(); } }

Compilation message (stderr)

stove.java:6: error: class stovejoi is public, should be declared in a file named stovejoi.java
public class stovejoi {
       ^
Note: stove.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error