제출 #335757

#제출 시각아이디문제언어결과실행 시간메모리
335757AgnimandurLabels (NOI20_labels)Java
컴파일 에러
0 ms0 KiB
import java.util.*; import java.io.DataInputStream; import java.io.IOException; public class Labels { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public int ni() throws IOException { int ret = 0; boolean flip = false; byte c = read(); while (c < '0' || c > '9') { if (c == '-') flip = true; c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return flip ? -ret : ret; } public long nl() throws IOException { long ret = 0; boolean flip = false; byte c = read(); while (c < '0' || c > '9') { if (c == '-') flip = true; c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return flip ? -ret : ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) { buffer[0] = -1; } } private byte read() throws IOException { if (bufferPointer == bytesRead) { fillBuffer(); } return buffer[bufferPointer++]; } } public static void main(String[] args) throws IOException { Reader sc = new Reader(); PrintStream out = new PrintStream(new BufferedOutputStream(System.out)); int N = sc.ni(); // read an integer int[] arr = new int[N]; int min = 0; int max = 0; for (int i = 1; i < N; i++) { arr[i] = arr[i-1]+sc.ni(); min = Math.min(arr[i],min); max = Math.max(arr[i],max); } if (max-min == N-1) { int add = 1-min; for (int i = 0; i < N; i++) { out.print((arr[i]+add) + " "); } } else { out.print("-1"); } out.flush(); // remember to flush just once, at the very end of your program } }

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

Labels.java:62: error: cannot find symbol
        PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
        ^
  symbol:   class PrintStream
  location: class Labels
Labels.java:62: error: cannot find symbol
        PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
                              ^
  symbol:   class PrintStream
  location: class Labels
Labels.java:62: error: cannot find symbol
        PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
                                              ^
  symbol:   class BufferedOutputStream
  location: class Labels
3 errors