結果

問題 No.2375 watasou and hibit's baseball
ユーザー warabi0906warabi0906
提出日時 2023-06-22 18:03:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,290 bytes
コンパイル時間 1,419 ms
コンパイル使用メモリ 164,944 KB
実行使用メモリ 7,916 KB
最終ジャッジ日時 2023-09-22 17:28:56
合計ジャッジ時間 5,285 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,916 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 228 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 TLE -
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 time_st;

const int Limit=3800;
int N,A,B,X[15],Y[15],K[15],ans=1,start,second;
short ok[15][15][15];
void dfs(int v,int p,int vis){
    ans=max(ans,__builtin_popcount(vis));
    if((long double)(start*(N-1)+second)*(long double)(Limit/N/(N-1))/1000<(long double)(clock()-time_st)/CLOCKS_PER_SEC)return;
    for(int nxt=0;nxt<N;nxt++){
        if(vis&(1<<nxt))continue;
        if(!ok[p][v][nxt])continue;
        dfs(nxt,v,vis|(1<<nxt));
    }
    return;
}
int main(void){
    time_st=clock();
    scanf("%d%d%d",&N,&A,&B);
    for(int i=0;i<N;i++)scanf("%d%d%d",&X[i],&Y[i],&K[i]);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j)continue;
            for(int k=0;k<N;k++){
                if(i==k or j==k)continue;
                ok[i][j][k]=0;
                if(abs(X[i]-X[k])+abs(X[j]-X[k])+abs(Y[i]-Y[k])+abs(Y[j]-Y[k])>=A or abs(K[j]-K[k])>=B)ok[i][j][k]=1;
            }
        }
    }
    for(int i=0;i<N;i++){
        start=i;
        for(int j=0;j<N;j++){
            if(start==second)continue;
            if(abs(X[start]-X[second])+abs(Y[start]-Y[second])<A and abs(K[start]-K[second])<B)continue;
            dfs(second,start,(1<<start)|(1<<second));
        }
    }
    printf("%d\n",ans);
}
0