結果

問題 No.110 しましまピラミッド
ユーザー QDSNQDSN
提出日時 2019-12-03 13:57:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,411 bytes
コンパイル時間 1,287 ms
コンパイル使用メモリ 163,164 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-05 09:52:21
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 65 ms
6,940 KB
testcase_02 AC 64 ms
6,944 KB
testcase_03 AC 62 ms
6,944 KB
testcase_04 AC 60 ms
6,940 KB
testcase_05 AC 73 ms
6,940 KB
testcase_06 AC 69 ms
6,940 KB
testcase_07 AC 65 ms
6,940 KB
testcase_08 AC 69 ms
6,940 KB
testcase_09 AC 76 ms
6,940 KB
testcase_10 AC 64 ms
6,940 KB
testcase_11 AC 66 ms
6,940 KB
testcase_12 AC 67 ms
6,944 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 70 ms
6,940 KB
testcase_20 AC 59 ms
6,940 KB
testcase_21 AC 61 ms
6,944 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 72 ms
6,944 KB
testcase_27 AC 84 ms
6,940 KB
testcase_28 WA -
testcase_29 AC 85 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int nw, nb;
    cin >> nw;
    vector<int> w(nw);
    for(size_t i = 0; i < nw; i++) {
        cin >> w[i];
    }
    cin >> nb;
    vector<int> b(nb);
    for(size_t i = 0; i < nb; i++) {
        cin >> b[i];
    }
    int ans = 0;
    for(int bit = 0; bit < (1 << 20); bit++) {
        int tans = 0;
        int t = bit;
        bool isW = true;
        vector<int> ww = w, bb = b;
        for(int j = 0; j < 20; j++) {
            if(t & 1) {
                if(isW) {
                    auto ex = find(all(ww), j + 1);
                    if(ex != ww.end()) {
                        tans++;
                        isW = false;
                        (*ex) = -1;
                    } else {
                        tans = -114514;
                        break;
                    }
                } else {
                    auto ex = find(all(bb), j + 1);
                    if(ex != bb.end()) {
                        tans++;
                        isW = true;
                        (*ex) = -1;
                    } else {
                        tans = -114514;
                        break;
                    }
                }
            }
            t = t >> 1;
        }
        ans = max(ans, tans);
    }
    cout << ans << endl;
}
0