結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー 東前頭十一枚目
提出日時 2019-12-12 17:10:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 169,064 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-25 05:48:08
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int n; cin >> n;
	int a[n + 1]; for(int i = 0; i < n + 1; ++i) cin >> a[i];
	int b[n + 1]; for(int i = 0; i < n + 1; ++i) cin >> b[i];
	int d[n]; for(int i = 0; i < n; ++i) cin >> d[i];
	sort(d, d + n);
	reverse(d, d + n);
	int ai = 0, bi = 0;
	int ans = 0;
	for(int i = 0; i < n; ++i) {
		if(a[ai] - a[ai + 1] < b[bi] - b[bi + 1]) {
			++ai;
		} else {
			++bi;
		}
		// cerr << ai << " " << bi << " " << a[ai] + b[bi] << " " << d[i] << endl;
		while(a[ai] + b[bi] < d[i]) {
			i++;
			if(i == n) {
				cout << ans << '\n';
				return 0;
			}
		}
		++ans;
	}
	cout << ans << '\n';
	return 0;
}
0