結果
| 問題 | 
                            No.859 路線A、路線B、路線C
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bluemegane
                         | 
                    
| 提出日時 | 2021-05-07 09:34:11 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,821 bytes | 
| コンパイル時間 | 1,101 ms | 
| コンパイル使用メモリ | 111,076 KB | 
| 実行使用メモリ | 28,920 KB | 
| 最終ジャッジ日時 | 2024-09-14 22:29:11 | 
| 合計ジャッジ時間 | 2,315 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 WA * 5 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using static System.Math;
using System.Linq;
using System;
public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        line = Console.ReadLine().Trim().Split(' ');
        var s0 = line[0];
        var t0 = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var s1 = line[0];
        var t1 = int.Parse(line[1]);
        if (s0 == s1)
        {
            if (s0 == "A") Same(a, t0, t1, 0, 1, 2);
            else if (s0 == "B") Same(a, t0, t1, 1, 0, 2);
            else Same(a, t0, t1, 2, 0, 1);
        }
        else
        {
            if ((s0 == "A" && s1 == "B") | (s0 == "B" && s1 == "A")) Diff(a, t0, t1, 0, 1, 2);
            else if ((s0 == "B" && s1 == "C") | (s0 == "C" && s1 == "B")) Diff(a, t0, t1, 2, 0, 1);
            else Diff(a, t0, t1, 0, 2, 1);
        }
    }
    static void Diff(long[] a, int t0, int t1, int p, int q, int r)
    {
        var root = new long[4];
        root[0] = t0 + t1 - 1;
        root[1] = a[p] + a[q] - root[0];
        root[2] = t0 + a[r] + a[q] - t1;
        root[3] = a[r] - t0 + a[r] + t1;
        Console.WriteLine(root.Min());
    }
    static void Same(long[] a, int t0, int t1, int p, int q, int r)
    {
        var root1 = Abs(t0 - t1);
        var mint = Min(t0, t1);
        var maxt = Max(t0, t1);
        var minbc = Min(a[q], a[r]);
        var root2 = mint + minbc + a[p] - maxt;
        Console.WriteLine(Min(root1, root2));
    }
    static void goWarshall(long[,] dp)
    {
        var n = dp.GetLength(0);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    dp[j, k] = Math.Min(dp[j, k], dp[j, i] + dp[i, k]);
    }
}
            
            
            
        
            
bluemegane