結果

問題 No.1579 New Type of Nim
ユーザー OmameBeansOmameBeans
提出日時 2021-07-04 03:42:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,764 bytes
コンパイル時間 1,449 ms
コンパイル使用メモリ 165,352 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 11:19:17
合計ジャッジ時間 2,640 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define DREP(i,s,n) for(int i = (s); i < (n); i++)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);
ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}

int main() {
    ll A,B; cin >> A >> B;
    if(A > B) swap(A,B);
    if(A == 1 && B == 1) cout << 'Q' << endl;
    else if(A == 1 && B == 2) cout << 'Q' << endl;
    else {
        if(A%2 == 0) cout << 'P' << endl;
        else {
            if(B < A+2) cout << 'Q' << endl;
            else cout << 'P' << endl;
        }
    }
    return 0;
}

// int main() {
//     ll A,B; cin >> A >> B;
//     vecveci dp(11,veci(11));

//     dp[0][0] = 0;
//     dp[0][1] = 1;

//     for(int i = 0; i < 11; i++) for(int j = i; j < 11; j++) {
//         if(j == 0) continue;
//         for(int k = j-1; k >= 0; k--) {
//             if(k < i) {
//                 if(dp[k][i] == 0) dp[i][j] = 1;
//             }
//             else if(i == k) {
//                 if(dp[i][k] == 1) dp[i][j] = 1; 
//             } else {
//                 if(dp[i][k] == 0) dp[i][j] = 1;
//             }
//         }
//     }

//     for(int i = 1; i <= 10; i++) {
//         for(int j = i; j <= 10; j++) cout << dp[i][j] << " ";
//         cout << endl;
//     }
// }
0