結果

問題 No.200 カードファイト!
ユーザー kyuridenamidakyuridenamida
提出日時 2015-04-29 00:48:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,060 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 148,896 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-09-19 03:05:54
合計ジャッジ時間 2,454 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
	cin >> N;
	int A,B;
	cin >> A;
	vector<int> a(A);
	for(int i = 0 ; i < A ; i++) cin >> a[i];
	cin >> B;
	vector<int> b(B);
	for(int i = 0 ; i < B ; i++) cin >> b[i];
	srand(time(NULL));
	int answer = 0;
	for(int k = 0 ; k < b.size() ; k++){
		multiset<int> xx,yy;
		int ans = 0;
		for(int i = 0 ; i < N ; i++){
			if( xx.size() == 0 ){
				for(int j = 0 ; j < a.size() ; j++)
					xx.insert(a[j]);
			}
			if( yy.size() == 0 ){
				for(int j = 0 ; j < b.size() ; j++)
					yy.insert(b[j]);
			}
			if( *xx.rbegin() <= *yy.begin() ){
				
				yy.erase(((++yy.rbegin()).base()));
				xx.erase(xx.begin());
			}else{
				auto it = yy.lower_bound(*xx.begin());
				if( it == yy.begin() ){ // xが勝てない
					yy.erase(((++yy.rbegin()).base()));
					xx.erase(xx.erase(xx.begin()));
				}else{
					--it;
					yy.erase(it);
					xx.erase(xx.begin());
					ans++;
				}
			}
		}
		answer = max(answer,ans);
		//rotate(b.begin(),b.begin()+1,b.end());
		break;
	}
	cout << answer << endl;
	
	
}
0