結果

問題 No.361 門松ゲーム2
ユーザー satanicsatanic
提出日時 2016-04-18 01:27:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,113 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 77,388 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 03:13:26
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 6 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 7 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 7 ms
6,940 KB
testcase_22 AC 9 ms
6,940 KB
testcase_23 AC 9 ms
6,948 KB
testcase_24 WA -
testcase_25 AC 9 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 9 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>

using ll = long long int;

int max3(int a, int b, int c){
    return std::max(a, std::max(b, c));
}
int min3(int a, int b, int c){
    return std::min(a, std::min(b, c));
}
bool diff3(int a, int b, int c){
    return (a!=b && b!=c && c!=a);
}
bool isKadomatsu(int a, int b, int c){
    return (diff3(a, b, c) && (b==max3(a, b, c) || b==min3(a, b, c)));
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int L, d;
    std::cin >> L >> d;
    std::vector<int> dp(500, 0);
    for(int l=6; l<=L; ++l){
        for(int i=1; i<l-2; ++i){
            for(int j=i+1; j<l-1; ++j){
                int tallest=l-i-j;
                if(j>=tallest){
                    break;
                }
                if(tallest-i>d) continue;
                int tmp = dp[i]+dp[j]+dp[tallest]+1;
                if(tmp%2==0) continue;
                dp[l]=1;
            }
        }
        //std::cout << "dp[" << l << "] = " << dp[l] << "\n";
    }
    std::cout << ((dp[L]==1) ? "kado\n" : "matsu\n");
    return 0;
}
0