結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー nanophoto12nanophoto12
提出日時 2019-12-13 23:33:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 150,680 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-10 06:04:08
合計ジャッジ時間 4,295 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 4 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 5 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 5 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 5 ms
4,376 KB
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:9: warning: #pragma once in main file
 #pragma once
         ^~~~

ソースコード

diff #

#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = 1000000007;

int main(void)
{
	ll n;
	cin >> n;
	vector<ll> as(n+1);
	vector<ll> bs(n+1);
	vector<ll> ds(n);
	rep(i, n + 1) cin >> as[i];
	rep(i, n + 1) cin >> bs[i];
	rep(i, n) cin >> ds[i];

	vector<ll> p(n);
	int a = 0;
	int b = 0;
	rep(i, n) {
		if (as[a + 1] + bs[b] < as[a] + bs[b + 1]) {
			b++;
		}
		else {
			a++;
		}
		p[i] = as[a] + bs[b];
	}
	sort(ds.begin(), ds.end(), std::greater<ll>());
	int sum = 0;
	rep(i, n) {
		auto l = lower_bound(ds.begin(), ds.end(), p[i], std::greater<ll>());

		if (l != ds.end()) {
			sum++;
			ds.erase(l);
		}
	}
	cout << sum << endl;
	return 0;
}
0