結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 58 ms
5,376 KB
testcase_02 AC 58 ms
5,376 KB
testcase_03 AC 56 ms
5,376 KB
testcase_04 AC 53 ms
5,376 KB
testcase_05 AC 65 ms
5,376 KB
testcase_06 AC 64 ms
5,376 KB
testcase_07 AC 62 ms
5,376 KB
testcase_08 AC 65 ms
5,376 KB
testcase_09 AC 72 ms
5,376 KB
testcase_10 AC 58 ms
5,376 KB
testcase_11 AC 59 ms
5,376 KB
testcase_12 AC 60 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 69 ms
5,376 KB
testcase_20 AC 56 ms
5,376 KB
testcase_21 AC 59 ms
5,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 68 ms
5,376 KB
testcase_27 AC 78 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 79 ms
5,376 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