답안 #335758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335758 2020-12-13T22:05:52 Z Agnimandur Labels (NOI20_labels) Java 11
100 / 100
664 ms 21088 KB
import java.util.*;
import java.io.*;
 
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
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 8936 KB Output is correct
2 Correct 110 ms 9708 KB Output is correct
3 Correct 110 ms 9580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 8936 KB Output is correct
2 Correct 110 ms 9708 KB Output is correct
3 Correct 110 ms 9580 KB Output is correct
4 Correct 84 ms 8548 KB Output is correct
5 Correct 108 ms 9580 KB Output is correct
6 Correct 107 ms 9452 KB Output is correct
7 Correct 76 ms 8684 KB Output is correct
8 Correct 73 ms 8812 KB Output is correct
9 Correct 109 ms 9576 KB Output is correct
10 Correct 71 ms 8556 KB Output is correct
11 Correct 71 ms 8428 KB Output is correct
12 Correct 72 ms 8684 KB Output is correct
13 Correct 89 ms 8556 KB Output is correct
14 Correct 106 ms 9580 KB Output is correct
15 Correct 71 ms 8556 KB Output is correct
16 Correct 108 ms 9580 KB Output is correct
17 Correct 71 ms 8428 KB Output is correct
18 Correct 126 ms 9580 KB Output is correct
19 Correct 73 ms 8400 KB Output is correct
20 Correct 108 ms 9580 KB Output is correct
21 Correct 110 ms 9676 KB Output is correct
22 Correct 79 ms 8556 KB Output is correct
23 Correct 129 ms 9728 KB Output is correct
24 Correct 73 ms 8528 KB Output is correct
25 Correct 71 ms 8556 KB Output is correct
26 Correct 109 ms 9580 KB Output is correct
27 Correct 79 ms 8536 KB Output is correct
28 Correct 111 ms 9580 KB Output is correct
29 Correct 131 ms 9472 KB Output is correct
30 Correct 72 ms 8668 KB Output is correct
31 Correct 113 ms 9600 KB Output is correct
32 Correct 75 ms 8428 KB Output is correct
33 Correct 112 ms 9804 KB Output is correct
34 Correct 70 ms 8448 KB Output is correct
35 Correct 111 ms 9580 KB Output is correct
36 Correct 74 ms 8668 KB Output is correct
37 Correct 107 ms 9472 KB Output is correct
38 Correct 86 ms 8684 KB Output is correct
39 Correct 112 ms 9512 KB Output is correct
40 Correct 108 ms 9580 KB Output is correct
41 Correct 74 ms 8556 KB Output is correct
42 Correct 73 ms 8556 KB Output is correct
43 Correct 69 ms 8556 KB Output is correct
44 Correct 71 ms 8556 KB Output is correct
45 Correct 73 ms 8428 KB Output is correct
46 Correct 71 ms 8556 KB Output is correct
47 Correct 108 ms 9580 KB Output is correct
48 Correct 118 ms 9576 KB Output is correct
49 Correct 112 ms 9692 KB Output is correct
50 Correct 70 ms 8556 KB Output is correct
51 Correct 71 ms 8684 KB Output is correct
52 Correct 111 ms 9560 KB Output is correct
53 Correct 72 ms 8552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 8936 KB Output is correct
2 Correct 110 ms 9708 KB Output is correct
3 Correct 110 ms 9580 KB Output is correct
4 Correct 84 ms 8548 KB Output is correct
5 Correct 108 ms 9580 KB Output is correct
6 Correct 107 ms 9452 KB Output is correct
7 Correct 76 ms 8684 KB Output is correct
8 Correct 73 ms 8812 KB Output is correct
9 Correct 109 ms 9576 KB Output is correct
10 Correct 71 ms 8556 KB Output is correct
11 Correct 71 ms 8428 KB Output is correct
12 Correct 72 ms 8684 KB Output is correct
13 Correct 89 ms 8556 KB Output is correct
14 Correct 106 ms 9580 KB Output is correct
15 Correct 71 ms 8556 KB Output is correct
16 Correct 108 ms 9580 KB Output is correct
17 Correct 71 ms 8428 KB Output is correct
18 Correct 126 ms 9580 KB Output is correct
19 Correct 73 ms 8400 KB Output is correct
20 Correct 108 ms 9580 KB Output is correct
21 Correct 110 ms 9676 KB Output is correct
22 Correct 79 ms 8556 KB Output is correct
23 Correct 129 ms 9728 KB Output is correct
24 Correct 73 ms 8528 KB Output is correct
25 Correct 71 ms 8556 KB Output is correct
26 Correct 109 ms 9580 KB Output is correct
27 Correct 79 ms 8536 KB Output is correct
28 Correct 111 ms 9580 KB Output is correct
29 Correct 131 ms 9472 KB Output is correct
30 Correct 72 ms 8668 KB Output is correct
31 Correct 113 ms 9600 KB Output is correct
32 Correct 75 ms 8428 KB Output is correct
33 Correct 112 ms 9804 KB Output is correct
34 Correct 70 ms 8448 KB Output is correct
35 Correct 111 ms 9580 KB Output is correct
36 Correct 74 ms 8668 KB Output is correct
37 Correct 107 ms 9472 KB Output is correct
38 Correct 86 ms 8684 KB Output is correct
39 Correct 112 ms 9512 KB Output is correct
40 Correct 108 ms 9580 KB Output is correct
41 Correct 74 ms 8556 KB Output is correct
42 Correct 73 ms 8556 KB Output is correct
43 Correct 69 ms 8556 KB Output is correct
44 Correct 71 ms 8556 KB Output is correct
45 Correct 73 ms 8428 KB Output is correct
46 Correct 71 ms 8556 KB Output is correct
47 Correct 108 ms 9580 KB Output is correct
48 Correct 118 ms 9576 KB Output is correct
49 Correct 112 ms 9692 KB Output is correct
50 Correct 70 ms 8556 KB Output is correct
51 Correct 71 ms 8684 KB Output is correct
52 Correct 111 ms 9560 KB Output is correct
53 Correct 72 ms 8552 KB Output is correct
54 Correct 135 ms 9580 KB Output is correct
55 Correct 74 ms 8508 KB Output is correct
56 Correct 141 ms 9856 KB Output is correct
57 Correct 72 ms 8568 KB Output is correct
58 Correct 134 ms 9580 KB Output is correct
59 Correct 135 ms 9708 KB Output is correct
60 Correct 140 ms 9600 KB Output is correct
61 Correct 71 ms 8556 KB Output is correct
62 Correct 74 ms 8684 KB Output is correct
63 Correct 133 ms 9708 KB Output is correct
64 Correct 135 ms 9580 KB Output is correct
65 Correct 76 ms 8556 KB Output is correct
66 Correct 138 ms 9680 KB Output is correct
67 Correct 132 ms 9836 KB Output is correct
68 Correct 138 ms 9600 KB Output is correct
69 Correct 142 ms 9708 KB Output is correct
70 Correct 141 ms 9616 KB Output is correct
71 Correct 73 ms 8556 KB Output is correct
72 Correct 71 ms 8556 KB Output is correct
73 Correct 152 ms 9708 KB Output is correct
74 Correct 85 ms 8484 KB Output is correct
75 Correct 140 ms 9708 KB Output is correct
76 Correct 149 ms 9664 KB Output is correct
77 Correct 134 ms 9708 KB Output is correct
78 Correct 138 ms 9948 KB Output is correct
79 Correct 161 ms 9692 KB Output is correct
80 Correct 135 ms 9728 KB Output is correct
81 Correct 134 ms 9580 KB Output is correct
82 Correct 138 ms 9704 KB Output is correct
83 Correct 73 ms 8428 KB Output is correct
84 Correct 71 ms 8556 KB Output is correct
85 Correct 72 ms 8556 KB Output is correct
86 Correct 138 ms 9708 KB Output is correct
87 Correct 73 ms 8556 KB Output is correct
88 Correct 72 ms 8556 KB Output is correct
89 Correct 136 ms 9708 KB Output is correct
90 Correct 147 ms 9708 KB Output is correct
91 Correct 78 ms 8556 KB Output is correct
92 Correct 71 ms 8528 KB Output is correct
93 Correct 72 ms 8428 KB Output is correct
94 Correct 74 ms 8556 KB Output is correct
95 Correct 71 ms 8528 KB Output is correct
96 Correct 74 ms 8556 KB Output is correct
97 Correct 123 ms 9472 KB Output is correct
98 Correct 147 ms 9708 KB Output is correct
99 Correct 117 ms 9580 KB Output is correct
100 Correct 142 ms 9948 KB Output is correct
101 Correct 137 ms 9612 KB Output is correct
102 Correct 72 ms 8556 KB Output is correct
103 Correct 71 ms 8556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 616 ms 19476 KB Output is correct
2 Correct 109 ms 9580 KB Output is correct
3 Correct 638 ms 19524 KB Output is correct
4 Correct 104 ms 11524 KB Output is correct
5 Correct 107 ms 11300 KB Output is correct
6 Correct 113 ms 11244 KB Output is correct
7 Correct 104 ms 11552 KB Output is correct
8 Correct 105 ms 11116 KB Output is correct
9 Correct 70 ms 8556 KB Output is correct
10 Correct 113 ms 9580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 8936 KB Output is correct
2 Correct 110 ms 9708 KB Output is correct
3 Correct 110 ms 9580 KB Output is correct
4 Correct 84 ms 8548 KB Output is correct
5 Correct 108 ms 9580 KB Output is correct
6 Correct 107 ms 9452 KB Output is correct
7 Correct 76 ms 8684 KB Output is correct
8 Correct 73 ms 8812 KB Output is correct
9 Correct 109 ms 9576 KB Output is correct
10 Correct 71 ms 8556 KB Output is correct
11 Correct 71 ms 8428 KB Output is correct
12 Correct 72 ms 8684 KB Output is correct
13 Correct 89 ms 8556 KB Output is correct
14 Correct 106 ms 9580 KB Output is correct
15 Correct 71 ms 8556 KB Output is correct
16 Correct 108 ms 9580 KB Output is correct
17 Correct 71 ms 8428 KB Output is correct
18 Correct 126 ms 9580 KB Output is correct
19 Correct 73 ms 8400 KB Output is correct
20 Correct 108 ms 9580 KB Output is correct
21 Correct 110 ms 9676 KB Output is correct
22 Correct 79 ms 8556 KB Output is correct
23 Correct 129 ms 9728 KB Output is correct
24 Correct 73 ms 8528 KB Output is correct
25 Correct 71 ms 8556 KB Output is correct
26 Correct 109 ms 9580 KB Output is correct
27 Correct 79 ms 8536 KB Output is correct
28 Correct 111 ms 9580 KB Output is correct
29 Correct 131 ms 9472 KB Output is correct
30 Correct 72 ms 8668 KB Output is correct
31 Correct 113 ms 9600 KB Output is correct
32 Correct 75 ms 8428 KB Output is correct
33 Correct 112 ms 9804 KB Output is correct
34 Correct 70 ms 8448 KB Output is correct
35 Correct 111 ms 9580 KB Output is correct
36 Correct 74 ms 8668 KB Output is correct
37 Correct 107 ms 9472 KB Output is correct
38 Correct 86 ms 8684 KB Output is correct
39 Correct 112 ms 9512 KB Output is correct
40 Correct 108 ms 9580 KB Output is correct
41 Correct 74 ms 8556 KB Output is correct
42 Correct 73 ms 8556 KB Output is correct
43 Correct 69 ms 8556 KB Output is correct
44 Correct 71 ms 8556 KB Output is correct
45 Correct 73 ms 8428 KB Output is correct
46 Correct 71 ms 8556 KB Output is correct
47 Correct 108 ms 9580 KB Output is correct
48 Correct 118 ms 9576 KB Output is correct
49 Correct 112 ms 9692 KB Output is correct
50 Correct 70 ms 8556 KB Output is correct
51 Correct 71 ms 8684 KB Output is correct
52 Correct 111 ms 9560 KB Output is correct
53 Correct 72 ms 8552 KB Output is correct
54 Correct 135 ms 9580 KB Output is correct
55 Correct 74 ms 8508 KB Output is correct
56 Correct 141 ms 9856 KB Output is correct
57 Correct 72 ms 8568 KB Output is correct
58 Correct 134 ms 9580 KB Output is correct
59 Correct 135 ms 9708 KB Output is correct
60 Correct 140 ms 9600 KB Output is correct
61 Correct 71 ms 8556 KB Output is correct
62 Correct 74 ms 8684 KB Output is correct
63 Correct 133 ms 9708 KB Output is correct
64 Correct 135 ms 9580 KB Output is correct
65 Correct 76 ms 8556 KB Output is correct
66 Correct 138 ms 9680 KB Output is correct
67 Correct 132 ms 9836 KB Output is correct
68 Correct 138 ms 9600 KB Output is correct
69 Correct 142 ms 9708 KB Output is correct
70 Correct 141 ms 9616 KB Output is correct
71 Correct 73 ms 8556 KB Output is correct
72 Correct 71 ms 8556 KB Output is correct
73 Correct 152 ms 9708 KB Output is correct
74 Correct 85 ms 8484 KB Output is correct
75 Correct 140 ms 9708 KB Output is correct
76 Correct 149 ms 9664 KB Output is correct
77 Correct 134 ms 9708 KB Output is correct
78 Correct 138 ms 9948 KB Output is correct
79 Correct 161 ms 9692 KB Output is correct
80 Correct 135 ms 9728 KB Output is correct
81 Correct 134 ms 9580 KB Output is correct
82 Correct 138 ms 9704 KB Output is correct
83 Correct 73 ms 8428 KB Output is correct
84 Correct 71 ms 8556 KB Output is correct
85 Correct 72 ms 8556 KB Output is correct
86 Correct 138 ms 9708 KB Output is correct
87 Correct 73 ms 8556 KB Output is correct
88 Correct 72 ms 8556 KB Output is correct
89 Correct 136 ms 9708 KB Output is correct
90 Correct 147 ms 9708 KB Output is correct
91 Correct 78 ms 8556 KB Output is correct
92 Correct 71 ms 8528 KB Output is correct
93 Correct 72 ms 8428 KB Output is correct
94 Correct 74 ms 8556 KB Output is correct
95 Correct 71 ms 8528 KB Output is correct
96 Correct 74 ms 8556 KB Output is correct
97 Correct 123 ms 9472 KB Output is correct
98 Correct 147 ms 9708 KB Output is correct
99 Correct 117 ms 9580 KB Output is correct
100 Correct 142 ms 9948 KB Output is correct
101 Correct 137 ms 9612 KB Output is correct
102 Correct 72 ms 8556 KB Output is correct
103 Correct 71 ms 8556 KB Output is correct
104 Correct 616 ms 19476 KB Output is correct
105 Correct 109 ms 9580 KB Output is correct
106 Correct 638 ms 19524 KB Output is correct
107 Correct 104 ms 11524 KB Output is correct
108 Correct 107 ms 11300 KB Output is correct
109 Correct 113 ms 11244 KB Output is correct
110 Correct 104 ms 11552 KB Output is correct
111 Correct 105 ms 11116 KB Output is correct
112 Correct 70 ms 8556 KB Output is correct
113 Correct 113 ms 9580 KB Output is correct
114 Correct 128 ms 12768 KB Output is correct
115 Correct 632 ms 20796 KB Output is correct
116 Correct 113 ms 12880 KB Output is correct
117 Correct 129 ms 12632 KB Output is correct
118 Correct 618 ms 20604 KB Output is correct
119 Correct 115 ms 12612 KB Output is correct
120 Correct 664 ms 20768 KB Output is correct
121 Correct 633 ms 20780 KB Output is correct
122 Correct 620 ms 20808 KB Output is correct
123 Correct 115 ms 12688 KB Output is correct
124 Correct 631 ms 21088 KB Output is correct
125 Correct 617 ms 20688 KB Output is correct
126 Correct 624 ms 20884 KB Output is correct
127 Correct 622 ms 20792 KB Output is correct
128 Correct 115 ms 12612 KB Output is correct
129 Correct 622 ms 20792 KB Output is correct
130 Correct 620 ms 20792 KB Output is correct
131 Correct 617 ms 20920 KB Output is correct
132 Correct 625 ms 20768 KB Output is correct
133 Correct 616 ms 20920 KB Output is correct
134 Correct 112 ms 12740 KB Output is correct
135 Correct 620 ms 20900 KB Output is correct
136 Correct 114 ms 12740 KB Output is correct
137 Correct 111 ms 12740 KB Output is correct
138 Correct 117 ms 12612 KB Output is correct
139 Correct 113 ms 12740 KB Output is correct
140 Correct 111 ms 12612 KB Output is correct
141 Correct 113 ms 12740 KB Output is correct
142 Correct 633 ms 20768 KB Output is correct
143 Correct 112 ms 12712 KB Output is correct
144 Correct 114 ms 12740 KB Output is correct
145 Correct 618 ms 20792 KB Output is correct
146 Correct 623 ms 20920 KB Output is correct
147 Correct 616 ms 20596 KB Output is correct
148 Correct 624 ms 20684 KB Output is correct
149 Correct 624 ms 19576 KB Output is correct
150 Correct 624 ms 19648 KB Output is correct
151 Correct 102 ms 11552 KB Output is correct
152 Correct 105 ms 11136 KB Output is correct
153 Correct 104 ms 11368 KB Output is correct
154 Correct 103 ms 11520 KB Output is correct
155 Correct 106 ms 11356 KB Output is correct
156 Correct 71 ms 8556 KB Output is correct
157 Correct 108 ms 9580 KB Output is correct
158 Correct 115 ms 12996 KB Output is correct
159 Correct 106 ms 9672 KB Output is correct
160 Correct 619 ms 20900 KB Output is correct
161 Correct 113 ms 12868 KB Output is correct
162 Correct 112 ms 12740 KB Output is correct
163 Correct 114 ms 12612 KB Output is correct