結果

問題 No.2375 watasou and hibit's baseball
ユーザー FplusFplusFFplusFplusF
提出日時 2023-07-07 22:30:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,465 bytes
コンパイル時間 2,375 ms
コンパイル使用メモリ 206,316 KB
実行使用メモリ 37,988 KB
最終ジャッジ日時 2023-09-28 23:58:31
合計ジャッジ時間 8,652 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 44 ms
9,716 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 8 ms
4,612 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 22 ms
6,068 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 10 ms
4,656 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 219 ms
37,736 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
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;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,a,b;
    cin >> n >> a >> b;
    vector<ll> x(n),y(n),k(n);
    rep(i,n) cin >> x[i] >> y[i] >> k[i];
    auto dist=[&](ll i,ll j){
        return abs(x[i]-x[j])+abs(y[i]+y[j]);
    };
    vector<vector<vector<ll>>> dp(1<<n,vector<vector<ll>>(n,vector<ll>(n,0)));
    rep(i,n){
        rep(j,n){
            if(i==j) continue;
            if(a<=dist(i,j)/*||b<=abs(k[i]-k[j])*/) dp[(1<<i)|(1<<j)][i][j]=1;
        }
    }
    rep(i,1<<n){
        rep(j,n){
            rep(l,n){
                rep(m,n){
                    if(i&(1<<m)) continue;
                    if(b<=abs(k[m]-k[j])||a<=dist(m,j)+dist(m,l)) dp[i|(1<<m)][m][j]|=dp[i][j][l];
                }
            }
        }
    }
    auto cnt=[&](ll p){
        ll ret=0;
        rep(i,n){
            if(p&(1<<i)) ret++;
        }
        return ret;
    };
    ll ans=1;
    rep(i,1<<n){
        rep(j,n){
            rep(k,n){
                if(dp[i][j][k]) chmax(ans,cnt(i));
            }
        }
    }
    cout << ans << '\n';
}
0