結果

問題 No.2375 watasou and hibit's baseball
ユーザー warabi0906warabi0906
提出日時 2023-06-20 18:26:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 658 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 167,472 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-22 17:22:42
合計ジャッジ時間 5,657 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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);
    }while(next_permutation(P.begin(),P.end()));
    printf("%d\n",ans);
}
0