結果

問題 No.200 カードファイト!
ユーザー kyuridenamida
提出日時 2015-04-29 00:27:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 166,640 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 05:24:11
合計ジャッジ時間 2,337 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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];
	
	multiset<int> xx;
	sort(b.begin(),b.end());
	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]);
		}
		auto it = xx.upper_bound(b[i%b.size()]);
		//cout << "(" << xx.size() << ")";
		//cout << b[i%b.size()] << " vs ";
		if( it == xx.end() ){
			//cout << *xx.begin() << endl;
			xx.erase(xx.begin());
		}else{
			//cout << *it << " win!" << endl;
			ans++;
			xx.erase(it);
		}
	}
	cout << ans << endl;
	
	
}
0