結果

問題 No.2375 watasou and hibit's baseball
ユーザー watasou1543watasou1543
提出日時 2023-06-21 17:08:48
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 163,828 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 08:45:42
合計ジャッジ時間 3,198 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int N,A,B,X[15],Y[15],K[15];
int main(){
    scanf("%d%d%d",&N,&A,&B);
    for(int i=0;i<N;i++)scanf("%d%d%d",&X[i],&Y[i],&K[i]);
    vector<int> P(N);
    iota(P.begin(),P.end(),0);
    auto d=[&](int a,int b){
        return abs(X[a]-X[b])+abs(Y[a]-Y[b]);
    };
    int ans=1;
    do{
        int cnt=1;
        for(int i=1;i<N;i++){
            int m=0;
            m+=d(P[i-1],P[i]);
            if(1<i)m+=d(P[i-2],P[i]);
            if(m<A and abs(K[P[i]]-K[P[i-1]])<B)break;
            ++cnt;
        }
        ans=max(ans,cnt);
        clock_t t=clock();
        if(3950<t){
            printf("%d\n",ans);
            return 0;
        }
    }while(next_permutation(P.begin(),P.end()));
    printf("%d\n",ans);
}
0