# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
275939 |
2020-08-20T08:28:20 Z |
임성재(#5103) |
Radio (Balkan15_RADIO) |
C++17 |
|
1 ms |
384 KB |
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
int n, k;
int x[100010], p[100010], s[100010];
vector<int> t;
int main() {
fast;
cin >> n >> k;
int cnt = -n;
int cur = -inf;
ll sum = 0;
for(int i=1; i<=n; i++) {
cin >> x[i] >> p[i] >> s[i];
t.eb(x[i] - p[i]);
t.eb(x[i] + p[i]);
sum += x[i] - p[i] - cur;
}
sort(all(t));
ll ans = sum;
for(auto i : t) {
sum += cnt * (i - cur);
ans = min(ans, sum);
cnt++;
cur = i;
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |