結果
| 問題 |
No.808 Kaiten Sushi?
|
| コンテスト | |
| ユーザー |
noshi91
|
| 提出日時 | 2019-03-19 18:28:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,016 bytes |
| コンパイル時間 | 819 ms |
| コンパイル使用メモリ | 71,680 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 03:07:26 |
| 合計ジャッジ時間 | 6,574 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 32 WA * 10 RE * 14 |
ソースコード
#include<cstddef>
#include<cstdint>
#include<iostream>
#include<limits>
#include<vector>
using isize = std::ptrdiff_t;
using usize = std::size_t;
using u64 = std::uint_fast64_t;
int main() {
usize N;
std::cin >> N;
u64 L;
std::cin >> L;
std::vector<u64> x(N);
for (auto &e : x) {
std::cin >> e;
}
std::vector<u64> y(N);
for (auto &e : y) {
std::cin >> e;
}
x.emplace_back(std::numeric_limits<u64>::max());
y.emplace_back(std::numeric_limits<u64>::max());
isize count = 0, max = 0, min = 0;
auto xitr = x.cbegin(), yitr = y.cbegin();
u64 last;
for (usize i = 0;i != N * 2;++i) {
if (*xitr < *yitr) {
++count;
if (max <= count) {
max = count;
last = *yitr;
}
++xitr;
}
else {
--count;
if (count <= min) {
min = count;
}
++yitr;
}
}
const usize diff = max - min;
if (max == static_cast<isize>(0)) {
std::abort();
}
else if (min == static_cast<isize>(0)) {
return 0;
}
else {
std::cout << L*diff - (L - last) << std::endl;
}
return 0;
}
noshi91