結果

問題 No.1727 [Cherry 3rd Tune] Stray
ユーザー kotatsugamekotatsugame
提出日時 2021-11-06 03:58:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 6,000 ms
コード長 389 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 81,056 KB
実行使用メモリ 45,056 KB
最終ジャッジ日時 2024-04-24 13:32:39
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 7 ms
5,888 KB
testcase_06 AC 21 ms
13,568 KB
testcase_07 AC 101 ms
45,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/dsu>
using namespace std;
int N;
int rev[1<<10];
main()
{
	cin>>N>>N;
	atcoder::dsu uf(1<<N+N);
	for(int i=0;i<1<<N;i++)
	{
		for(int j=0;j<N;j++)rev[i]|=(i>>j&1)<<N-j-1;
	}
	for(int i=0;i<1<<N+N;i++)
	{
		int l=i&(1<<N)-1,r=i>>N;
		uf.merge(i,l>>1|(l&1)<<N-1|(r>>1|(r&1)<<N-1)<<N);
		uf.merge(i,rev[l]<<N|rev[r]);
	}
	cout<<uf.groups().size()<<endl;
}
0