結果
| 問題 |
No.949 飲酒プログラミングコンテスト
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-12 01:41:36 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 873 bytes |
| コンパイル時間 | 864 ms |
| コンパイル使用メモリ | 124,180 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 03:30:40 |
| 合計ジャッジ時間 | 1,879 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 WA * 19 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.split.map!(to!long).array;
auto B = readln.split.map!(to!long).array;
auto D = readln.split.map!(to!long).array;
D.sort!"a > b";
auto C = new long[](N);
for (int i = 0, j = 0, k = -1; k < N; ++k) {
if (i + j > 0) C[k] = A[i] + B[j];
if (i == N) ++j;
else if (j == N) ++i;
else if (A[i] + B[j+1] >= A[i+1] + B[j]) ++j;
else ++i;
}
int ans = 0;
for (int i = N - 1, j = N - 1; i >= 0 && j >= 0; ) {
if (C[i] >= D[j]) {
++ans;
--i;
--j;
} else {
--i;
}
}
ans.writeln;
}