제출 #1175620

#제출 시각아이디문제언어결과실행 시간메모리
1175620sp2028Art Exhibition (JOI18_art)Java
컴파일 에러
0 ms0 KiB
import java.io.*; import java.util.*; public class AE { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); long N = Long.parseLong(br.readLine()); long[][] artworks = new long[(int) N][2]; for (int i = 0; i < N; i++) { StringTokenizer st = new StringTokenizer(br.readLine()); artworks[i][0] = Long.parseLong(st.nextToken()); artworks[i][1] = Long.parseLong(st.nextToken()); } Arrays.sort(artworks, Comparator.comparingLong(a -> a[0])); long max = Long.MIN_VALUE; int l = 0; long total = 0; for (int r = 0; r < N; r++) { total += artworks[r][1]; while (l <= r && total < (artworks[r][0] - artworks[l][0])) { total -= artworks[l][1]; //update window l++; } max = Math.max(max, total - (artworks[r][0] - artworks[l][0]));//find the new max of the window } pw.println(max); pw.close(); } }

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

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

=======