結果

問題 No.455 冬の大三角
ユーザー zimphazimpha
提出日時 2017-04-02 13:52:06
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 2,735 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 74,220 KB
実行使用メモリ 51,516 KB
最終ジャッジ日時 2023-09-22 07:33:44
合計ジャッジ時間 8,925 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
49,456 KB
testcase_01 RE -
testcase_02 AC 47 ms
49,388 KB
testcase_03 AC 46 ms
49,356 KB
testcase_04 AC 47 ms
49,364 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 45 ms
49,620 KB
testcase_08 AC 51 ms
49,332 KB
testcase_09 AC 47 ms
49,556 KB
testcase_10 RE -
testcase_11 AC 47 ms
49,424 KB
testcase_12 RE -
testcase_13 AC 49 ms
49,552 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
testcase_17 RE -
testcase_18 AC 47 ms
49,588 KB
testcase_19 AC 46 ms
49,464 KB
testcase_20 AC 47 ms
49,476 KB
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 RE -
testcase_26 AC 50 ms
49,772 KB
testcase_27 AC 47 ms
49,504 KB
testcase_28 AC 48 ms
49,740 KB
testcase_29 RE -
testcase_30 AC 51 ms
49,652 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 50 ms
49,628 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 50 ms
49,632 KB
testcase_41 RE -
testcase_42 AC 50 ms
49,720 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 50 ms
49,424 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 46 ms
49,916 KB
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 47 ms
49,516 KB
testcase_55 AC 49 ms
51,376 KB
testcase_56 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Chiaki.Hoshinomori
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task455 solver = new Task455();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task455 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            char[][] s = new char[n][];
            int x1 = -1, y1 = -1;
            int x2 = -1, y2 = -1;
            for (int i = 0; i < n; i++) {
                s[i] = in.next().toCharArray();
                for (int j = 0; j < n; j++) {
                    if (s[i][j] == '*') {
                        if (x1 == -1) {
                            x1 = i;
                            y1 = j;
                        } else {
                            x2 = i;
                            y2 = j;
                        }
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (s[i][j] == '*') continue;
                    if ((x2 - x1) * (j - y1) - (i - x1) * (y2 - x2) != 0) {
                        s[i][j] = '*';
                        for (int k = 0; k < n; k++) {
                            out.println(s[k]);
                        }
                        return;
                    }
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

0