mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
parent
7d55593096
commit
5863ac7857
39
AtCoder/ABC250/G/G.cpp
Normal file
39
AtCoder/ABC250/G/G.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2e5 + 5;
|
||||
|
||||
int n, p[N];
|
||||
long long ans;
|
||||
std::priority_queue<int, std::vector<int>, std::greater<>> q;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> p[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!q.empty() && q.top() < p[i]) {
|
||||
ans += p[i] - q.top();
|
||||
q.pop();
|
||||
q.emplace(p[i]);
|
||||
}
|
||||
|
||||
q.emplace(p[i]);
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AtCoder/ABC250/G/data/sample_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/sample_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/sample_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/sample_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/sample_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/sample_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/sample_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_06.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_06.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_06.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_07.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_07.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_07.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_08.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_08.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_08.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_09.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_09.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_09.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_10.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_10.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_11.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_11.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_12.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_12.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_13.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_13.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_14.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_14.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_15.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_15.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_16.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_16.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_17.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_17.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_18.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_18.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_19.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_19.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_20.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_20.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_21.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_21.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_22.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_22.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_23.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_23.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_24.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_24.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_25.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_25.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_26.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_26.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_27.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_27.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_28.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_28.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_29.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_29.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_30.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_30.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_31.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_31.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_32.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_32.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_33.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_33.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_34.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_34.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_35.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_35.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_36.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_36.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_37.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_37.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_38.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_38.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_39.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_39.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_40.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_40.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_41.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_41.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_42.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_42.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_43.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_43.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_44.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_44.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_45.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_45.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_46.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_46.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC250/G/data/test_47.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC250/G/data/test_47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user