結果
| 問題 | No.2948 move move rotti |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-20 05:05:40 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,596 bytes |
| 記録 | |
| コンパイル時間 | 2,500 ms |
| コンパイル使用メモリ | 346,924 KB |
| 最終ジャッジ日時 | 2026-06-19 06:12:57 |
| 合計ジャッジ時間 | 3,705 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:76,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bit: In instantiation of 'constexpr int std::__popcount(_Tp) [with _Tp = long long int]':
main.cpp:52:34: required from here
52 | ll tmp=__popcount(i);
| ~~~~~~~~~~^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bit:308:34: error: argument 1 in call to function '__builtin_popcountg' has signed type
308 | return __builtin_popcountg(__x);
| ^~~
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
const ll inf = 9e18;
int main(){
ll n,m,k;
cin >> n >> m >> k;
ll bn=1<<n;
vector<ll> x(k);
for(ll i=0;i<k;i++){
cin >> x[i];
x[i]--;
}
vector<vector<ll>> g(n,vector<ll>(n,false));
for(ll i=0;i<m;i++){
ll u,v;
cin >> u >> v;
u--,v--;
g[u][v]=true;
g[v][u]=true;
}
vector<vector<ll>> cnt(n+1,vector<ll>(n));
for(ll p=0;p<k;p++){
vector<vector<bool>> dp(bn,vector<bool>(n,false));
dp[1<<x[p]][x[p]]=true;
for(ll x=0;x<bn;x++){
for(ll i=0;i<n;i++){
if(!(x>>i&1)) continue;
if(!dp[x][i]) continue;
for(ll j=0;j<n;j++){
if(i==j) continue;
if(x>>j&1) continue;
if(!g[i][j]) continue;
dp[x|1<<j][j]=true;
}
}
}
vector<vector<ll>> f(n+1,vector<ll>(n));
for(ll i=0;i<bn;i++){
for(ll j=0;j<n;j++){
if(!dp[i][j]) continue;
ll tmp=__popcount(i);
f[tmp][j]=true;
}
}
for(ll i=0;i<=n;i++){
for(ll j=0;j<n;j++){
cnt[i][j]+=f[i][j];
}
}
}
for(ll i=0;i<=n;i++){
for(ll j=0;j<n;j++){
if(cnt[i][j]!=k) continue;
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
}