結果
| 問題 |
No.2375 watasou and hibit's baseball
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2023-07-10 18:12:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 925 bytes |
| コンパイル時間 | 4,162 ms |
| コンパイル使用メモリ | 256,052 KB |
| 最終ジャッジ日時 | 2025-02-15 09:34:28 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 9 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
int main(){
int N,A,B;
cin>>N>>A>>B;
vector<int> x(N),y(N),K(N);
rep(i,N){
cin>>x[i]>>y[i]>>K[i];
}
vector dp(1<<N,vector(N,vector<bool>(N,false)));
rep(i,N){
dp[1<<i][i][i] = true;
}
rep(i,1<<N){
rep(j,N){
rep(k,N){
if(dp[i][j][k]==false)continue;
rep(l,N){
if((i>>l)&1)continue;
bool f = false;
if(abs(K[k]-K[l])>=B)f = true;
if(abs(x[k]-x[l]) + abs(y[k]-y[l]) + abs(x[j]-x[k]) + abs(y[j]-y[k]) >= A)f = true;
if(f)dp[i|(1<<l)][k][l] = true;
}
}
}
}
int ans = 1;
rep(i,1<<N){
rep(j,N){
rep(k,N){
if(dp[i][j][k])ans = max(ans,__builtin_popcount(i));
}
}
}
cout<<ans<<endl;
return 0;
}
沙耶花