結果

問題 No.200 カードファイト!
コンテスト
ユーザー kyuridenamida
提出日時 2015-04-29 00:27:17
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 722 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,095 ms
コンパイル使用メモリ 184,488 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-26 12:16:40
合計ジャッジ時間 2,069 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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