結果

問題 No.2375 watasou and hibit's baseball
ユーザー KowerKoint2010KowerKoint2010
提出日時 2023-07-01 13:25:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,118 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 207,088 KB
実行使用メモリ 28,912 KB
最終ジャッジ日時 2023-09-22 17:40:02
合計ジャッジ時間 4,881 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 41 ms
13,284 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 98 ms
28,572 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 99 ms
28,744 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 9 ms
5,508 KB
testcase_16 AC 5 ms
4,428 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 39 ms
28,740 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int n, a, b; cin >> n >> a >> b;
    vector<int> x(n), y(n), s(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> s[i];
    vector dp(vector(1<<n, vector(n+1, vector<int>(n+1))));
    dp[0][n][n] = 1;
    int ans = 0;
    for(int b = 0; b < (1<<n); b++) {
        for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) {
            if(!dp[b][i][j]) continue;
            for(int k = 0; k < n; k++) {
                if(b >> k & 1) continue;
                bool strike = true;
                if(j == n);
                else if(i == n) {
                    strike &= a <= abs(x[k]-x[j]) + abs(y[k]-y[j]);
                } else {
                    strike &= a <= abs(x[k]-x[j]) + abs(y[k]-y[j]) + abs(x[k]-x[i]) + abs(y[k]-y[i]);
                }
                if(j < n) strike |= b <= abs(s[k]-s[j]);
                if(strike) {
                    dp[b|(1<<k)][j][k] = 1;
                    ans = max(ans, __builtin_popcount(b|(1<<k)));
                }
            }
        }
    }
    cout << ans << endl;
}
0