結果

問題 No.200 カードファイト!
ユーザー mayoko_mayoko_
提出日時 2015-07-28 15:18:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,688 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-23 04:41:00
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 55;
int B[MAXN], D[MAXN];
int A, C, N;

bool done[MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    cin >> A;
    for (int i = 0; i < A; i++) cin >> B[i];
    cin >> C;
    for (int i = 0; i < C; i++) cin >> D[i];
    vector<int> AA;
    for (int i = 1; i * A <= N; i++) {
        for (int j = 0; j < A; j++) AA.push_back(B[j]);
    }
    sort(B, B+A);
    reverse(B, B+A);
    for (int i = 0; i < N%A; i++) AA.push_back(B[i]);
    sort(D, D+C);
    int ans = 0, cnt = 0;
    for (int i = 0; i < N; i++) {
        if (cnt % C == 0) {
            cnt = 0;
            for (int j = 0; j < C; j++) done[j] = false;
        }
        int index = -1;
        for (int j = 0; j < C; j++) {
            if (D[j] < AA[i] && !done[j]) index = j;
        }
        if (index == -1) {
            for (int j = C-1; j >= 0; j--) {
                if (!done[j]) {
                    index = j;
                    break;
                }
            }
        }
        if (D[index] < AA[i]) ans++;
        done[index] = true;
        cnt++;
    }
    cout << ans << endl;
    return 0;
}
0