結果
| 問題 |
No.1255 ハイレーツ・オブ・ボリビアン
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-10-24 12:51:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,491 bytes |
| コンパイル時間 | 2,249 ms |
| コンパイル使用メモリ | 206,752 KB |
| 最終ジャッジ日時 | 2025-01-15 14:59:48 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 14 |
ソースコード
// verification-helper: PROBLEM https://yukicoder.me/problems/4474
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
T mod_pow(T a,long long n,T mod){
using ll = long long;
T res(1);
while(n){
if(n&1) res=(ll)res*a%mod;
a=(ll)a*a%mod;
n>>=1;
}
return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
return 0;
}
#endif
#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#define call_from_test
#include "pow.cpp"
#undef call_from_test
#endif
//BEGIN CUT HERE
template<typename T>
T order(T x,T MOD){
static map<T, vector<T>> dp;
static map<T, T> phi;
T &res=phi[MOD];
vector<T> &ps=dp[MOD];
if(ps.empty()){
res=MOD;
T n=MOD;
for(T i=2;i*i<=n;i++){
if(n%i!=0) continue;
ps.emplace_back(i);
res=res/i*(i-1);
while(n%i==0) n/=i;
}
if(n!=1){
ps.emplace_back(n);
res=res/n*(n-1);
}
}
for(T p:ps){
while(res%p==0){
if(mod_pow(x,res/p,MOD)!=1) break;
res/=p;
}
}
return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
return 0;
}
#endif
#undef call_from_test
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
const char newl = '\n';
int T;
cin>>T;
while(T--){
long long n;
cin>>n;
cout<<order(2LL,2*n-1)<<newl;
}
return 0;
}
beet