結果

問題 No.771 しおり
ユーザー maimai
提出日時 2018-12-18 23:52:28
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 164,316 KB
実行使用メモリ 24,140 KB
最終ジャッジ日時 2023-09-19 00:16:49
合計ジャッジ時間 5,155 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
5,436 KB
testcase_03 AC 2 ms
5,532 KB
testcase_04 AC 2 ms
5,408 KB
testcase_05 AC 2 ms
5,400 KB
testcase_06 AC 2 ms
5,456 KB
testcase_07 AC 2 ms
5,372 KB
testcase_08 AC 2 ms
5,424 KB
testcase_09 AC 2 ms
5,392 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,736 KB
testcase_15 AC 2 ms
5,388 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,440 KB
testcase_20 AC 2 ms
5,512 KB
testcase_21 AC 2 ms
5,400 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 3 ms
5,756 KB
testcase_27 WA -
testcase_28 AC 32 ms
11,524 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,536 KB
testcase_37 AC 3 ms
5,532 KB
testcase_38 WA -
testcase_39 AC 3 ms
5,656 KB
testcase_40 WA -
testcase_41 AC 138 ms
24,084 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) {
            if (~b & (1 << i)) continue;
            REP(j, N) {
                if (b & (1 << 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