結果

問題 No.200 カードファイト!
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-05-11 11:05:00
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,308 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 165,088 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-13 11:00:19
合計ジャッジ時間 3,315 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \    | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/







int N, A, B[50], C, D[50];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> A;
    rep(i, 0, A) cin >> B[i];
    cin >> C;
    rep(i, 0, C) cin >> D[i];

    int cntA = A, cntC = C;
    int usedA[50], usedC[50];
    rep(i, 0, 50) usedA[i] = usedC[i] = 0;

    int ans = 0;
    rep(i, 0, N) {
        int ma = 0;
        rep(i, 0, A) if (!usedA[i]) ma = max(ma, B[i]);

        int mi = 1010;
        rep(i, 0, C) if (!usedC[i]) mi = min(mi, D[i]);

        if (mi < ma) {
            ans++;
            rep(i, 0, A) if (!usedA[i] && B[i] == ma) {
                usedA[i] = 1;
                cntA--;
                break;
            }
            rep(i, 0, C) if (!usedC[i] && D[i] == mi) {
                usedC[i] = 1;
                cntC--;
                break;
            }
        } else {
            mi = 1010;
            rep(i, 0, A) if (!usedA[i]) mi = min(mi, B[i]);
            ma = 0;
            rep(i, 0, C) if (!usedC[i]) ma = max(ma, D[i]);
            rep(i, 0, A) if (!usedA[i] && B[i] == mi) {
                usedA[i] = 1;
                cntA--;
                break;
            }
            rep(i, 0, C) if (!usedC[i] && D[i] == ma) {
                usedC[i] = 1;
                cntC--;
                break;
            }
        }

        if (cntA == 0) {
            cntA = A;
            rep(i, 0, A) usedA[i] = 0;
        }

        if (cntC == 0) {
            cntC = C;
            rep(i, 0, C) usedC[i] = 0;
        }
    }

    cout << ans << endl;
}
0