0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:48:48 +00:00

#1535. 【2022.09.05NOIP模拟题】订货

https://sjzezoj.com/submission/55839
This commit is contained in:
Baoshuo Ren 2022-09-05 15:26:00 +08:00
parent de68548fc6
commit 1f959f4f49
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
22 changed files with 103 additions and 0 deletions

40
S2OJ/1535/1535.cpp Normal file
View 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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.