#include <bits/stdc++.h>
using namespace std;
int main() {
int n,toplamdeger = 0,maxDeger = 0,maxToplam = 0;
long long minDeger = 1000000000000000;
cin >> n;
vector<int> a(n), b(n);
for(int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
toplamdeger += b[i];
}
for(int i = 0; i < n; i++) {
if(a[i] > maxDeger) maxDeger = a[i];
if(a[i] < minDeger) minDeger = a[i];
int S;
S = toplamdeger - (maxDeger - minDeger);
if(S > maxToplam) maxToplam = S;
}
cout << maxToplam;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |