結果

問題 No.771 しおり
ユーザー maimai
提出日時 2018-12-18 23:43:49
言語 cLay
(20231016-1)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 2,260 ms
コンパイル使用メモリ 163,936 KB
実行使用メモリ 24,012 KB
最終ジャッジ日時 2023-09-19 00:16:20
合計ジャッジ時間 6,884 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
24,012 KB
testcase_01 AC 19 ms
9,444 KB
testcase_02 AC 2 ms
5,368 KB
testcase_03 AC 2 ms
5,432 KB
testcase_04 AC 2 ms
5,592 KB
testcase_05 AC 2 ms
5,444 KB
testcase_06 AC 2 ms
5,656 KB
testcase_07 AC 2 ms
5,596 KB
testcase_08 AC 2 ms
5,416 KB
testcase_09 AC 2 ms
5,452 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,504 KB
testcase_12 AC 2 ms
5,400 KB
testcase_13 WA -
testcase_14 AC 2 ms
5,448 KB
testcase_15 AC 2 ms
5,392 KB
testcase_16 AC 2 ms
5,456 KB
testcase_17 AC 2 ms
5,412 KB
testcase_18 AC 2 ms
5,356 KB
testcase_19 AC 2 ms
5,588 KB
testcase_20 AC 2 ms
5,460 KB
testcase_21 AC 2 ms
5,360 KB
testcase_22 AC 2 ms
5,432 KB
testcase_23 AC 2 ms
5,404 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 3 ms
5,684 KB
testcase_27 AC 19 ms
9,516 KB
testcase_28 AC 40 ms
11,720 KB
testcase_29 WA -
testcase_30 AC 175 ms
23,872 KB
testcase_31 WA -
testcase_32 AC 5 ms
6,036 KB
testcase_33 AC 175 ms
23,860 KB
testcase_34 AC 174 ms
23,944 KB
testcase_35 AC 5 ms
6,208 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 5 ms
5,968 KB
testcase_39 WA -
testcase_40 AC 80 ms
15,624 KB
testcase_41 AC 175 ms
23,780 KB
testcase_42 AC 176 ms
23,932 KB
testcase_43 AC 19 ms
9,472 KB
testcase_44 AC 175 ms
23,884 KB
testcase_45 AC 175 ms
23,868 KB
権限があれば一括ダウンロードができます

ソースコード

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(b, 1 << N) {
        if (__builtin_popcount(b) <= 1) {
            REP(i, N) {
                dp[b][i] = 0;
            }
        }
        REP(i, N) {
            REP(j, N) {
                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