結果

問題 No.110 しましまピラミッド
ユーザー shimomireshimomire
提出日時 2014-12-28 01:59:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,686 bytes
コンパイル時間 898 ms
コンパイル使用メモリ 113,516 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 03:46:53
合計ジャッジ時間 2,128 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>// c
#include <ctime>
#include <iostream>// io
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>// container
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <algorithm>// other
#include <utility>
#include <complex>
#include <numeric>
#include <functional>
#include <random>
#include <regex>

using namespace std;
typedef long long ll;

#define ALL(c) (c).begin(),(c).end()
#define FOR(i,l,r) for(int i=(int)l;i<(int)r;++i)
#define REP(i,n) FOR(i,0,n)
#define FORr(i,l,r) for(int i=(int)r-1;i>=(int)l;--i)
#define REPr(i,n) FORr(i,0,n)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end())
//debug
#define DUMP(x)  cerr << #x << " = " << (x)
#define LINE()    cerr<< " (L" << __LINE__ << ")"

template<typename T,typename U> T pmod(T x,U M){return (x%M+M)%M;}


int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	cout <<fixed <<setprecision(20);

	int N;cin >> N;
	vector<int> ws(N);REP(i,N) cin >> ws[i];
	int M;cin >> M;
	vector<int> bs(M);REP(i,M) cin >> bs[i];

	sort(ALL(ws));sort(ALL(bs));
	
	int Mv=0;
	//白start
	{
		int w=0,sz=0;
		int bi=0;
		REP(wi,N)if(w<ws[wi]){
			w=ws[wi];sz++;
			while(w >= bs[bi] && bi < M)bi++;
			if(w < bs[bi] && bi<M){
				w=bs[bi];sz++;
			}else{
				break;
			}
		}
		Mv=max(Mv,sz);
	}
	//黒start
	{
		int w=0,sz=0;
		int wi=0;
		REP(bi,M)if(w<bs[bi]){
			w=bs[bi];sz++;
			while(w >= ws[wi] && wi < N)wi++;
			if(w < ws[wi] && wi<N){
				w=ws[wi];sz++;
			}else{
				break;
			}
		}
		Mv=max(Mv,sz);
	}

	cout << Mv <<endl;

 	return 0;
 }
0