結果

問題 No.110 しましまピラミッド
ユーザー masamasa
提出日時 2015-03-21 18:55:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 68,420 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-11 09:18:54
合計ジャッジ時間 3,671 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int nw, nb;
	vector<int> white, black;

	cin >> nw;
	white.assign(nw, 0);
	for (int i = 0; i < nw; i++) {
		cin >> white[i];
	}
	cin >> nb;
	black.assign(nb, 0);
	for (int i = 0; i < nb; i++) {
		cin >> black[i];
	}

	sort(white.begin(), white.end(), greater<int>());
	sort(black.begin(), black.end(), greater<int>());


	int now = 1000;
	int step = 0;
	for (int i = 0, j = 0; i < nw; i++) {
		if (white[i] < now) {
			now = white[i];
			step++;

			for (; j < nb; j++) {
				if (black[j] < now) {
					now = black[j];
					step++;
				}
			}
		}
	}
	int ans = step;

	now = 1000;
	step = 0;
	for (int i = 0, j = 0; i < nb; i++) {
		if (black[i] < now) {
			now = black[i];
			step++;

			for (; j < nw; j++) {
				if (white[j] < now) {
					now = white[j];
					step++;
				}
			}
		}
	}
	ans = max(ans, step);

	cout << ans << endl;
	return 0;
}
0