結果

問題 No.2755 行列の共役類
ユーザー ttkkggww
提出日時 2024-05-24 00:46:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 4,240 ms
コンパイル使用メモリ 254,344 KB
最終ジャッジ日時 2025-02-21 16:31:31
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 60 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
int B,C;
vector<pair<int,int>> units[1000];
using mint = modint;

bool judge(int x,int n_1,int y,int n_2){
    for(int z = 1;z<=B;z++){
        if(gcd(z,B)!=1)
            continue;
        mint bunshi = mint(n_1 - n_2*z);
        mint bunbo = mint(1-x);
        int g = gcd(bunshi.val(),bunbo.val());
        int tmp = bunbo.val()/g;
        if(gcd(tmp,B/C)==1){
            return true;
        }
    }
    return false;
}

void solve(){
    int cnt = 0;
    for(int x = 1;x<=B;x++){
        if(gcd(x,B)!=1)
            continue;
        for(int n_1 = 0;n_1<B/C;n_1++){
            bool is_add = true;
            for(auto &[y,n_2]:units[x]){
                if(judge(x,n_1,y,n_2)){
                    is_add = false;
                    break;
                }
                if(judge(y,n_2,x,n_1)){
                    is_add = false;
                    break;
                }
            }
            if(is_add){
                units[x].emplace_back(x,n_1);
                cnt++;
            }
        }
        if(cnt>100){
            cout<<"100+"<<endl;
            return;
        }
    }

    cout<<cnt<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> B >> C;
    mint::set_mod(B/C);
    solve();
}
0