mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:28:47 +00:00
parent
de68548fc6
commit
1f959f4f49
40
S2OJ/1535/1535.cpp
Normal file
40
S2OJ/1535/1535.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 2e6 + 5;
|
||||||
|
|
||||||
|
int n, a[N], b[N], ans;
|
||||||
|
std::deque<int> q;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> b[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
while (!q.empty() && b[i] >= b[q.front()]) q.pop_front();
|
||||||
|
q.push_front(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
while (!q.empty() && q.back() <= i) q.pop_back();
|
||||||
|
if (!q.empty()) ans = std::max(ans, b[q.back()] - a[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/1535/data/goods1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/goods9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/goods9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1535/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1535/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user