結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー FF256grhyFF256grhy
提出日時 2019-12-12 00:48:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,664 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 172,716 KB
実行使用メモリ 38,508 KB
最終ジャッジ日時 2023-09-06 13:39:10
合計ジャッジ時間 5,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,384 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 156 ms
28,052 KB
testcase_12 AC 163 ms
28,404 KB
testcase_13 AC 144 ms
25,456 KB
testcase_14 AC 21 ms
6,476 KB
testcase_15 AC 78 ms
20,188 KB
testcase_16 WA -
testcase_17 AC 27 ms
7,380 KB
testcase_18 AC 207 ms
36,508 KB
testcase_19 AC 101 ms
28,132 KB
testcase_20 AC 22 ms
8,332 KB
testcase_21 AC 7 ms
5,568 KB
testcase_22 AC 12 ms
7,604 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 103 ms
21,568 KB
testcase_25 AC 225 ms
38,404 KB
testcase_26 AC 229 ms
38,496 KB
testcase_27 WA -
testcase_28 AC 222 ms
38,396 KB
testcase_29 AC 148 ms
38,376 KB
testcase_30 AC 77 ms
38,372 KB
testcase_31 AC 51 ms
38,508 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

#define T0(T) T
#define T1(T) vector<T0(T)>
#define T2(T) vector<T1(T)>
#define V0(v, T,    ...) v
#define V1(v, T, n, ...) T1(T)(n, V0(v, T, __VA_ARGS__))
#define V2(v, T, n, ...) T2(T)(n, V1(v, T, __VA_ARGS__))

#define LB(v, x) (lower_bound(ALL(v), x) - v.begin())
#define UB(v, x) (upper_bound(ALL(v), x) - v.begin())

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1), b(n + 1), d(n + 1);
	inc(i, n + 1) { cin >> a[i]; }
	inc(i, n + 1) { cin >> b[i]; }
	inc(i, n + 0) { cin >> d[i]; }
	d[n] = -1e6;
	sort(ALL(d));
	
	auto dp = V2(0, int, n + 1, n + 1);
	dp[0][0] = n + 1;
	int ans = 0;
	incII(i, 0, n) {
	incII(j, 0, n) {
		if_not(inII(i + j, 1, n)) { continue; }
		
		int x = (i == 0 ? 0 : dp[i - 1][j]);
		int y = (j == 0 ? 0 : dp[i][j - 1]);
		int z = max(x, y);
		if(z == 0) { continue; }
		
		int p = LB(d, a[i] + b[j]) - 1;
		if(p >= z) { p = z - 1; }
		dp[i][j] = p;
		if(p > 0) { setmax(ans, i + j); }
	}
	}
	
	cout << ans << endl;
	
	return 0;
}
0