結果
問題 |
No.984 Inversion
|
ユーザー |
|
提出日時 | 2020-02-11 15:14:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 829 bytes |
コンパイル時間 | 1,272 ms |
コンパイル使用メモリ | 165,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 07:52:10 |
合計ジャッジ時間 | 1,924 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll p,n;cin >> p >> n; if(p==2){ cout << 0 << endl; return 0; } bool f=true; if(n>p-n){ f=false; n=p-n; } if(n==1){ if(f){ cout << 0 << endl; } else{ if(((p-1)*p/2)%2==1){ cout << 1 << endl; } else{ cout << 0 << endl; } } return 0; } ll t=p/n; ll k=t*(t+1)/2; if(f){ if(k%2==1){ cout << 1 << endl; } else{ cout << 0 << endl; } } else{ if((k%2==1)^(((p-1)*p/2)%2==0)){ cout << 1 << endl; } else{ cout << 0 << endl; } } }