結果

問題 No.110 しましまピラミッド
ユーザー Sounds_Of_RainSounds_Of_Rain
提出日時 2015-08-02 11:03:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 78,968 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-25 00:31:20
合計ジャッジ時間 2,152 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <functional>
using namespace std;
typedef long long int llint;
const int INF = 1000000;
const llint LINF = 100000000;
int dp[100000];//何番目
int black[10000] = { 0 }, bn, wn;
int white[10000] = { 0 };

int main() {
	int fl;
	cin >> wn;
	for (int i = 0; i < wn; i++) {
		cin >> white[i];
	}
	cin >> bn;
	for (int i = 0; i < bn; i++) {
		cin >> black[i];
	}
	int ans = 1;
	sort(black, black + bn,greater<int>());
	sort(white, white + wn,greater<int>());
	dp[0] = max(black[0], white[0]);
	if (dp[0] == black[0])fl = 1;
	else { fl = 2; }
	for (int i = 1; i < bn*wn; i++) {
		if (fl = 1 && dp[i - 1]>white[i]&&white[i]!=0) { dp[i] = white[i]; ans++; fl = 2; }
		else if (fl = 2 && dp[i - 1]>black[i]&&black[i]!=0) { dp[i] = black[i]; ans++; fl = 1; }
	}
	
	cout << ans << endl;
	
	return 0;
}
0