結果

問題 No.771 しおり
ユーザー maimai
提出日時 2018-12-18 23:50:10
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 164,328 KB
実行使用メモリ 24,084 KB
最終ジャッジ日時 2023-09-19 00:16:33
合計ジャッジ時間 5,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
5,428 KB
testcase_03 AC 2 ms
5,372 KB
testcase_04 AC 2 ms
5,460 KB
testcase_05 AC 2 ms
5,580 KB
testcase_06 AC 2 ms
5,384 KB
testcase_07 AC 2 ms
5,496 KB
testcase_08 AC 2 ms
5,420 KB
testcase_09 AC 2 ms
5,456 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,464 KB
testcase_15 AC 3 ms
5,384 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,396 KB
testcase_20 AC 2 ms
5,580 KB
testcase_21 AC 2 ms
5,516 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 3 ms
5,788 KB
testcase_27 WA -
testcase_28 AC 34 ms
11,532 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 3 ms
5,600 KB
testcase_37 AC 2 ms
5,516 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 156 ms
24,068 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

int N;
int A[1000][2];
int dp[1<<18][18];

inline int dist(int i, int j) {
    return A[i][1] - A[i][0] + A[j][0];
}

{
    rd(N);
    REP(i, N) {
        int a, b; rd(a, b);
        A[i][0] = a;
        A[i][1] = b;
    }
    
    fill(dp[1], dp[1<<N], int(1e9));
    
    REP(i, N) {
        dp[0][i] = 0;
        dp[i<<1][i] = 0;
    }
    
    REP(b, 1, 1 << N) {
        REP(i, N) {
            REP(j, N) {
                if (i == j) continue;
                dp[b | (1 << j)][j] = min(dp[b | (1 << j)][j],
                    max(dp[b][i], dist(i, j))
                );
            }
        }
    }
    
    int best = 1e9;
    REP(i, N){
        best = min(best, dp[(1<<N)-1][i]);
    }
    
    wt(best);
    
}
0