結果
問題 |
No.2375 watasou and hibit's baseball
|
ユーザー |
|
提出日時 | 2023-06-20 18:26:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 658 bytes |
コンパイル時間 | 1,592 ms |
コンパイル使用メモリ | 168,456 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-08 08:43:03 |
合計ジャッジ時間 | 4,685 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 35 |
ソースコード
#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); }