結果

問題 No.2375 watasou and hibit's baseball
ユーザー warabi0906warabi0906
提出日時 2023-06-22 18:35:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,421 bytes
コンパイル時間 1,636 ms
コンパイル使用メモリ 165,768 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-22 17:29:52
合計ジャッジ時間 5,600 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,756 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 629 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 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;

long double Limit=3.8;
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)*Limit<(long double)(clock()-time_st)/CLOCKS_PER_SEC)return;
    //cout<<(long double)(clock()-time_st)/CLOCKS_PER_SEC<<endl;
    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();
    cout<<fixed<<setprecision(10);
    scanf("%d%d%d",&N,&A,&B);
    Limit/=N*(N-1);
    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(i==j)continue;
            second=j;
            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);
    //cout<<Limit<<endl;
}
0