結果

問題 No.1727 [Cherry 3rd Tune] Stray
ユーザー 👑 KazunKazun
提出日時 2021-08-15 16:58:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 3,536 ms
コンパイル使用メモリ 142,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 13:32:24
合計ジャッジ時間 4,433 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<atcoder/all>

using namespace std;

int action(int x,vector<int> a,int N){
    int y=0;
    for (int i=0; i<2*N; i++){
        if (x&(1<<i)) y|=1<<a[i];
    }
    return y;
}

int main(){
    int N; cin >> N;

    atcoder::dsu U(1<<(2*N));

    vector<vector<int>> t(N, vector<int>(2*N,0)),u(N, vector<int>(2*N,0));

    // 2π/N 回転
    for (int i=0; i<N; i++){
        for (int j=0; j<N; j++){
            t[i][j]  =(i+j)%N;
            t[i][j+N]=t[i][j]+N;
        }
    }

    // ひっくり返す
    for (int i=0; i<N; i++){
        for (int j=0; j<N; j++){
            u[i][j+N]=((i-j)+N)%N;
            u[i][j]  =u[i][j+N]+N;
        }
    }

    for (int S=0; S<(1<<(2*N)); S++){
        for (int i=0; i<N; i++){
            U.merge(S,action(S,t[i],N));
            U.merge(S,action(S,u[i],N));
        }
    }

    vector<vector<int>> G=U.groups();

    cout << G.size() << endl;

}
0