結果
| 問題 |
No.984 Inversion
|
| コンテスト | |
| ユーザー |
tubuann1
|
| 提出日時 | 2020-01-22 14:03:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,044 bytes |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 166,932 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 05:57:22 |
| 合計ジャッジ時間 | 2,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;
template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
ll mod_pow(ll a,ll x,ll p){
ll ret=1;
while(x>0){
if(x&1){(ret*=a)%=p;}
(a*=a)%=p;
x>>=1;
}
return ret;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll P,N;
cin>>P>>N;
if(P==2){cout<<0<<endl;}
else if(mod_pow(N,(P-1)/2,P)==1){cout<<0<<endl;}
else{cout<<1<<endl;}
return 0;
}
tubuann1