結果

問題 No.1400 すごろくで世界旅行
ユーザー kotatsugamekotatsugame
提出日時 2021-02-25 00:40:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 1,103 ms
コンパイル使用メモリ 73,584 KB
実行使用メモリ 5,196 KB
最終ジャッジ日時 2023-10-25 06:04:09
合計ジャッジ時間 39,061 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,673 ms
5,196 KB
testcase_01 WA -
testcase_02 AC 1,667 ms
5,196 KB
testcase_03 AC 1,668 ms
5,196 KB
testcase_04 WA -
testcase_05 AC 1,667 ms
5,196 KB
testcase_06 AC 1,673 ms
5,196 KB
testcase_07 AC 1,668 ms
5,196 KB
testcase_08 AC 1,667 ms
5,196 KB
testcase_09 AC 1,667 ms
5,196 KB
testcase_10 AC 1,670 ms
5,196 KB
testcase_11 AC 1,669 ms
5,196 KB
testcase_12 AC 1,668 ms
5,196 KB
testcase_13 AC 1,712 ms
5,196 KB
testcase_14 AC 1,666 ms
5,196 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,666 ms
5,196 KB
testcase_18 WA -
testcase_19 AC 1,666 ms
5,196 KB
testcase_20 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")
#include<iostream>
#include<bitset>
using namespace std;
int V;
long D;
bitset<2000>E[2000],ET[2000],A[2000];
main()
{
	//cin>>V>>D;
	V=2000;D=(1LL<<59)-1;
	for(int i=0;i<V;i++)
	{
		//string s;cin>>s;
		string s(V,'1');
		for(int j=i;j<V;j++)E[i][j]=s[j]-'0';
		A[i][i]=1;
	}
	if(D>V)D=V;
	while(D)
	{
		for(int i=0;i<V;i++)for(int j=i;j<V;j++)ET[j][i]=E[i][j];
		if(D&1)
		{
			//for(int i=0;i<V;i++)T[i]=A[i];
			for(int i=0;i<V;i++)
			{
				bitset<2000>now=A[i];
				for(int j=i;j<V;j++)
				{
					A[i][j]=(now&ET[j]).any()?1:0;
				}
			}
		}
		D>>=1;
		if(D)
		{
			//for(int i=0;i<V;i++)T[i]=E[i];
			for(int i=0;i<V;i++)
			{
				bitset<2000>now=E[i];
				for(int j=i;j<V;j++)
				{
					E[i][j]=(now&ET[j]).any()?1:0;
				}
			}
		}
	}
	for(int i=0;i<V;i++)if(A[i].none())
	{
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
}
0