結果
問題 |
No.1400 すごろくで世界旅行
|
ユーザー |
![]() |
提出日時 | 2019-12-31 17:47:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 807 bytes |
コンパイル時間 | 681 ms |
コンパイル使用メモリ | 69,320 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 15:51:20 |
合計ジャッジ時間 | 2,570 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 10 WA * 2 RE * 6 |
ソースコード
#include<iostream> #include<bitset> using namespace std; int main() { int V, D; cin >> V >> D; bitset<1000> G[1000]; string E; for (int i = 0;i < V;++ i) { cin >> E; G[i] = bitset<1000>(E); } bool ans = G[0].any(); for (int i = 0;i < V;++ i) { bitset<1000> now, one, two, three, tmp; now = G[i]; one[i] = true; for (int j = 1;j < D;++ j) { tmp = now ^ two; if (tmp.none()) break; three |= one; for (int k = 0;k < V;++ k) if (tmp[k]) three |= G[k]; tmp = three; three = two; two = one; one = now; now = tmp; } ans &= now.count() == V; } cout << (ans ? "Yes" : ":(") << endl; return 0; }