제출 #483391

#제출 시각아이디문제언어결과실행 시간메모리
483391ericpenguinCloud Computing (CEOI18_clo)Java
컴파일 에러
0 ms0 KiB
import java.io.*; import java.util.*; public class cloudcomputing { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); ArrayList<int[]> logs = new ArrayList<>(); for (int i=0; i<N; i++) { StringTokenizer st = new StringTokenizer(br.readLine()); logs.add(new int[]{0, 0, 0}); logs.get(i)[0] = Integer.parseInt(st.nextToken()); logs.get(i)[1] = Integer.parseInt(st.nextToken()); logs.get(i)[2] = -Integer.parseInt(st.nextToken()); } int m = Integer.parseInt(br.readLine()); for (int i=N; i<m+N; i++) { StringTokenizer st = new StringTokenizer(br.readLine()); logs.add(new int[]{0, 0, 0}); logs.get(i)[0] = -Integer.parseInt(st.nextToken()); logs.get(i)[1] = Integer.parseInt(st.nextToken()); logs.get(i)[2] = Integer.parseInt(st.nextToken()); } Collections.sort(logs, (x, y) -> y[1]-x[1]); long[][] dp = new long[2][100001]; Arrays.fill(dp[1], Long.MIN_VALUE); dp[1][0] = 0; for (int i=0; i<N+m; i++) { dp[i%2] = dp[1-i%2].clone(); for (int c=0; c<=100000; c++) { if (c-logs.get(i)[0]<0 || c-logs.get(i)[0]>100000 || dp[1-i%2][c-logs.get(i)[0]]==Long.MIN_VALUE) continue; dp[i%2][c] = Math.max(dp[i%2][c], dp[1-i%2][c-logs.get(i)[0]] + logs.get(i)[2]); } } long ans = -1; for (int i=0; i<=100000; i++) ans = Math.max(ans, dp[(N+m-1)%2][i]); System.out.println(ans); } }

컴파일 시 표준 에러 (stderr) 메시지

clo.java:3: error: class cloudcomputing is public, should be declared in a file named cloudcomputing.java
public class cloudcomputing {
       ^
1 error