mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 16:18:49 +00:00
3062. [Usaco2013 Feb]Taxi
https://hydro.ac/d/bzoj/record/6322c07fbdf9bc31d160737e
This commit is contained in:
parent
32ca556536
commit
6da142d5f8
38
BZOJ/3062/3062.cpp
Normal file
38
BZOJ/3062/3062.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1e5 + 5;
|
||||||
|
|
||||||
|
int n, m, x[N], y[N];
|
||||||
|
long long ans;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n >> m;
|
||||||
|
|
||||||
|
x[0] = m;
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> x[i] >> y[i];
|
||||||
|
|
||||||
|
ans += std::abs(x[i] - y[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(x, x + 1 + n);
|
||||||
|
std::sort(y, y + 1 + n);
|
||||||
|
|
||||||
|
for (int i = 0; i <= n; i++) {
|
||||||
|
ans += std::abs(x[i] - y[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
BZOJ/3062/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3062/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3062/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user