結果
問題 |
No.2755 行列の共役類
|
ユーザー |
|
提出日時 | 2024-05-24 00:43:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,373 bytes |
コンパイル時間 | 4,331 ms |
コンパイル使用メモリ | 254,224 KB |
最終ジャッジ日時 | 2025-02-21 16:31:06 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 51 WA * 15 |
ソースコード
#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)==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(); }