답안 #198620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198620 2020-01-26T23:35:41 Z ijxjdjd Bitaro the Brave (JOI19_ho_t1) Java 11
100 / 100
560 ms 66128 KB
import java.io.*;
import java.util.StringTokenizer;

public class joi2019_ho_t1 {
    static BufferedReader fin = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    public static void main(String[] args) throws IOException {
//        BufferedReader fin = new BufferedReader(new FileReader("03-01.txt"));
        st = new StringTokenizer(fin.readLine());
        int H = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());
        char[][] board = new char[H][W];
        for (int i = 0; i < H; i++) {
            board[i] = new StringTokenizer(fin.readLine()).nextToken().toCharArray();
        }
        int[] countI = new int[W];
        int[] countO = new int[H];
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (board[i][j] == 'O') {
                    countO[i]++;
                }
                else if (board[i][j] == 'I') {
                    countI[j]++;
                }
            }
        }
        long res = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (board[i][j] == 'J') {
                    res += countI[j]*countO[i];
                }
                else if (board[i][j] == 'O') {
                    countO[i]--;
                }
                else {
                    countI[j]--;
                }
            }
        }
        PrintWriter out = new PrintWriter(System.out);
        out.println(res);
        out.close();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 10236 KB Output is correct
2 Correct 88 ms 10104 KB Output is correct
3 Correct 87 ms 10224 KB Output is correct
4 Correct 85 ms 10300 KB Output is correct
5 Correct 96 ms 10520 KB Output is correct
6 Correct 94 ms 10368 KB Output is correct
7 Correct 93 ms 10584 KB Output is correct
8 Correct 93 ms 10396 KB Output is correct
9 Correct 98 ms 10552 KB Output is correct
10 Correct 93 ms 10268 KB Output is correct
11 Correct 101 ms 10644 KB Output is correct
12 Correct 93 ms 10616 KB Output is correct
13 Correct 93 ms 10400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 10236 KB Output is correct
2 Correct 88 ms 10104 KB Output is correct
3 Correct 87 ms 10224 KB Output is correct
4 Correct 85 ms 10300 KB Output is correct
5 Correct 96 ms 10520 KB Output is correct
6 Correct 94 ms 10368 KB Output is correct
7 Correct 93 ms 10584 KB Output is correct
8 Correct 93 ms 10396 KB Output is correct
9 Correct 98 ms 10552 KB Output is correct
10 Correct 93 ms 10268 KB Output is correct
11 Correct 101 ms 10644 KB Output is correct
12 Correct 93 ms 10616 KB Output is correct
13 Correct 93 ms 10400 KB Output is correct
14 Correct 156 ms 14180 KB Output is correct
15 Correct 98 ms 10652 KB Output is correct
16 Correct 134 ms 13588 KB Output is correct
17 Correct 89 ms 10428 KB Output is correct
18 Correct 193 ms 15488 KB Output is correct
19 Correct 171 ms 15320 KB Output is correct
20 Correct 172 ms 15480 KB Output is correct
21 Correct 171 ms 15360 KB Output is correct
22 Correct 173 ms 15496 KB Output is correct
23 Correct 163 ms 16008 KB Output is correct
24 Correct 192 ms 15212 KB Output is correct
25 Correct 169 ms 15848 KB Output is correct
26 Correct 165 ms 15820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 10236 KB Output is correct
2 Correct 88 ms 10104 KB Output is correct
3 Correct 87 ms 10224 KB Output is correct
4 Correct 85 ms 10300 KB Output is correct
5 Correct 96 ms 10520 KB Output is correct
6 Correct 94 ms 10368 KB Output is correct
7 Correct 93 ms 10584 KB Output is correct
8 Correct 93 ms 10396 KB Output is correct
9 Correct 98 ms 10552 KB Output is correct
10 Correct 93 ms 10268 KB Output is correct
11 Correct 101 ms 10644 KB Output is correct
12 Correct 93 ms 10616 KB Output is correct
13 Correct 93 ms 10400 KB Output is correct
14 Correct 156 ms 14180 KB Output is correct
15 Correct 98 ms 10652 KB Output is correct
16 Correct 134 ms 13588 KB Output is correct
17 Correct 89 ms 10428 KB Output is correct
18 Correct 193 ms 15488 KB Output is correct
19 Correct 171 ms 15320 KB Output is correct
20 Correct 172 ms 15480 KB Output is correct
21 Correct 171 ms 15360 KB Output is correct
22 Correct 173 ms 15496 KB Output is correct
23 Correct 163 ms 16008 KB Output is correct
24 Correct 192 ms 15212 KB Output is correct
25 Correct 169 ms 15848 KB Output is correct
26 Correct 165 ms 15820 KB Output is correct
27 Correct 560 ms 64076 KB Output is correct
28 Correct 119 ms 11924 KB Output is correct
29 Correct 231 ms 19016 KB Output is correct
30 Correct 97 ms 10396 KB Output is correct
31 Correct 484 ms 60228 KB Output is correct
32 Correct 461 ms 65640 KB Output is correct
33 Correct 405 ms 65020 KB Output is correct
34 Correct 460 ms 62296 KB Output is correct
35 Correct 444 ms 65540 KB Output is correct
36 Correct 404 ms 65128 KB Output is correct
37 Correct 485 ms 66128 KB Output is correct
38 Correct 363 ms 59992 KB Output is correct
39 Correct 372 ms 60944 KB Output is correct