답안 #275958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
275958 2020-08-20T08:37:48 Z 임성재(#5103) Radio (Balkan15_RADIO) C++17
30 / 100
61 ms 7144 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;
ll x[100010], p[100010], s[100010];
vector<ll> t;
vector<ll> v1, v2;
ll ans;

int main() {
	fast;

	cin >> n >> k;

	ans = n - k;

	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]);
	}

	sort(all(t));

	int m = t[t.size()/2];

	for(int i=1; i<=n; i++) {
		v1.eb(max(0LL, m - x[i] - p[i]));
		v2.eb(max(0LL, x[i] - p[i] - m));
	}

	sort(all(v1));
	sort(all(v2));

	for(int i=0; i<k; i++) {
		ans += v1[i] + v2[i];
	}

	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 11 ms 1820 KB Output is correct
8 Correct 26 ms 3576 KB Output is correct
9 Correct 60 ms 6124 KB Output is correct
10 Correct 43 ms 7144 KB Output is correct
11 Correct 61 ms 7144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -