mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:58:48 +00:00
parent
244e3d7bbc
commit
903e14bb43
75
AtCoder/ABC237/E/E.cpp
Normal file
75
AtCoder/ABC237/E/E.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2e5 + 5;
|
||||
const long long INF = 0x3f3f3f3f3f3f3f3f;
|
||||
|
||||
int n, m, h[N];
|
||||
long long dist[N], ans;
|
||||
std::vector<std::pair<int, int>> g[N];
|
||||
bool vis[N];
|
||||
|
||||
void dijkstra() {
|
||||
std::fill_n(dist, N, INF);
|
||||
|
||||
std::priority_queue<
|
||||
std::pair<long long, int>,
|
||||
std::vector<std::pair<long long, int>>,
|
||||
std::greater<>>
|
||||
q;
|
||||
|
||||
q.emplace(0, 1);
|
||||
dist[1] = 0;
|
||||
|
||||
while (!q.empty()) {
|
||||
int u = q.top().second;
|
||||
q.pop();
|
||||
|
||||
if (vis[u]) continue;
|
||||
vis[u] = true;
|
||||
|
||||
for (auto e : g[u]) {
|
||||
int v = e.first,
|
||||
w = e.second;
|
||||
|
||||
if (dist[v] > dist[u] + w) {
|
||||
dist[v] = dist[u] + w;
|
||||
q.emplace(dist[v], v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> h[i];
|
||||
}
|
||||
|
||||
for (int i = 1, u, v; i <= m; i++) {
|
||||
cin >> u >> v;
|
||||
|
||||
g[u].emplace_back(v, std::max(h[v] - h[u], 0));
|
||||
g[v].emplace_back(u, std::max(h[u] - h[v], 0));
|
||||
}
|
||||
|
||||
dijkstra();
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans = std::max(ans, static_cast<long long>(h[1]) - h[i] - dist[i]);
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AtCoder/ABC237/E/data/after_contest_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/after_contest_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/after_contest_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/example_00.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/example_00.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/example_00.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/example_00.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/example_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/example_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/example_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/example_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_00.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_00.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_00.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_00.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/hand_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/hand_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_00.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_00.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_00.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_00.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_06.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_06.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_06.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_07.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_07.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_07.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_08.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_08.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_08.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_09.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_09.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_09.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_10.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_10.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_11.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_11.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_12.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_12.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_13.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_13.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_14.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/multi_14.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/multi_14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_00.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_00.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_00.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_00.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_06.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_06.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_06.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_07.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_07.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_07.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_08.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_08.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_08.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_09.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_09.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_09.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_10.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_10.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_11.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_11.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_12.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_12.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_13.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_13.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_14.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC237/E/data/random_14.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC237/E/data/random_14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user