提出 #74276912


ソースコード 拡げる

import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputReader reader = new InputReader(System.in);
        PrintWriter writer = new PrintWriter(System.out, false);
        int N = reader.nextInt();
        int[][] C = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                C[i][j] = reader.nextInt();
            }
        }
        boolean good = false;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                for (int k = j + 1; k < N; k++) {
                    if (C[i][j] + C[j][k] < C[i][k]) {
                        good = true;
                        break;
                    }
                }
            }
        }
        writer.println(good ? "Yes" : "No");
        writer.close();
        System.exit(0);
    }
    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());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
        public String nextLine() {
            String str = "";
            try {
                str = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

提出情報

提出日時
問題 B - Split Ticketing
ユーザ UttamS
言語 Java24 (OpenJDK 24.0.2)
得点 200
コード長 2148 Byte
結果 AC
実行時間 83 ms
メモリ 41264 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 17
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_01.txt, 01_02.txt, 01_03.txt, 02_01.txt, 02_02.txt, 02_03.txt, 03_01.txt, 03_02.txt, 03_03.txt, 04_01.txt, 04_02.txt, 04_03.txt, 04_04.txt, 04_05.txt, 04_06.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 47 ms 38920 KiB
00_sample_02.txt AC 45 ms 38920 KiB
01_01.txt AC 44 ms 39044 KiB
01_02.txt AC 51 ms 39508 KiB
01_03.txt AC 66 ms 40960 KiB
02_01.txt AC 44 ms 39040 KiB
02_02.txt AC 53 ms 39524 KiB
02_03.txt AC 65 ms 40832 KiB
03_01.txt AC 44 ms 39016 KiB
03_02.txt AC 65 ms 41236 KiB
03_03.txt AC 83 ms 41104 KiB
04_01.txt AC 45 ms 38912 KiB
04_02.txt AC 45 ms 38952 KiB
04_03.txt AC 63 ms 40848 KiB
04_04.txt AC 69 ms 41264 KiB
04_05.txt AC 44 ms 39000 KiB
04_06.txt AC 45 ms 39036 KiB