0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-16 20:05:26 +00:00

P2345 [USACO04OPEN] MooFest G

https://www.luogu.com.cn/record/77636791
This commit is contained in:
Baoshuo Ren 2022-06-19 19:03:04 +08:00
parent 1e7407922a
commit 096df42bd6
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

32
Luogu/P2345/P2345.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5e4 + 5;
int n;
long long ans;
std::pair<int, int> p[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> p[i].first >> p[i].second;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j < i; j++) {
ans += 1ll * std::max(p[i].first, p[j].first) * std::abs(p[i].second - p[j].second);
}
}
cout << ans << endl;
return 0;
}