結果
問題 | No.984 Inversion |
ユーザー |
![]() |
提出日時 | 2020-01-22 14:03:51 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,044 bytes |
コンパイル時間 | 1,865 ms |
使用メモリ | 3,536 KB |
最終ジャッジ日時 | 2022-11-24 15:00:05 |
合計ジャッジ時間 | 2,534 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,372 KB |
testcase_01 | AC | 1 ms
3,420 KB |
testcase_02 | AC | 1 ms
3,476 KB |
testcase_03 | AC | 1 ms
3,364 KB |
testcase_04 | AC | 1 ms
3,488 KB |
testcase_05 | AC | 1 ms
3,528 KB |
testcase_06 | AC | 1 ms
3,424 KB |
testcase_07 | AC | 1 ms
3,480 KB |
testcase_08 | AC | 1 ms
3,488 KB |
testcase_09 | AC | 2 ms
3,420 KB |
testcase_10 | AC | 1 ms
3,416 KB |
testcase_11 | AC | 1 ms
3,496 KB |
testcase_12 | AC | 1 ms
3,496 KB |
testcase_13 | AC | 1 ms
3,416 KB |
testcase_14 | AC | 1 ms
3,536 KB |
testcase_15 | AC | 1 ms
3,368 KB |
testcase_16 | AC | 1 ms
3,424 KB |
testcase_17 | AC | 1 ms
3,420 KB |
testcase_18 | AC | 1 ms
3,416 KB |
testcase_19 | AC | 1 ms
3,368 KB |
testcase_20 | AC | 1 ms
3,436 KB |
testcase_21 | AC | 2 ms
3,492 KB |
testcase_22 | AC | 1 ms
3,368 KB |
testcase_23 | AC | 1 ms
3,492 KB |
testcase_24 | AC | 1 ms
3,532 KB |
testcase_25 | AC | 1 ms
3,364 KB |
ソースコード
#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; }