結果

問題 No.110 しましまピラミッド
ユーザー sggkshiosggkshio
提出日時 2017-04-11 02:10:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,167 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 7,764 KB
最終ジャッジ日時 2023-09-25 06:57:22
合計ジャッジ時間 7,648 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;



int main() {
	
	int a, b;
	vector<int>A, B;
	cin >> a;
	for (int i = 0; i < a; i++) {
		int x;
		cin >> x;
		A.push_back(x);
	}
	cin >> b;
	for (int i = 0; i < b; i++) {
		int x;
		cin >> x;
		B.push_back(x);
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	int t = 0, m = 0;
	int a1 = 0, a2 = 0;
	int r = 0;
	while (1) {
		for (; t < a; t++) {
			if (A[t] > r) {
				r = A[t];
				a1++;
				break;
			}
		}
		for (; m < b; m++) {
			if (B[m] > r) {
				r = B[m];
				a1++;
				break;
			}
		}
		if (t == a-1 || m == b-1)break;
	}
	r = 0;
	t = 0, m = 0;
	while (1) {
		
		for (; m < b; m++) {
			if (B[m] > r) {
				r = B[m];
				a2++;
				break;
			}
		}

		for (; t < a; t++) {
			if (A[t] > r) {
				r = A[t];
				a2++;
				break;
			}
		}

		if (t == a-1 || m == b-1)break;
	}
	cout << max(a1, a2) << endl;

	return 0;

}
0