답안 #275953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
275953 2020-08-20T08:34:29 Z 임성재(#5103) Radio (Balkan15_RADIO) C++17
30 / 100
64 ms 5356 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;
ll ans;

int main() {
	fast;

	cin >> n >> k;

	ll cnt = -n;
	ll 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]);
	}

	sort(all(t));

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

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

	cout << ans;
}

Compilation message

radio.cpp: In function 'int main()':
radio.cpp:28:5: warning: unused variable 'cnt' [-Wunused-variable]
   28 |  ll cnt = -n;
      |     ^~~
radio.cpp:29:5: warning: unused variable 'cur' [-Wunused-variable]
   29 |  ll cur = -inf;
      |     ^~~
radio.cpp:30:5: warning: unused variable 'sum' [-Wunused-variable]
   30 |  ll sum = 0;
      |     ^~~
# 결과 실행 시간 메모리 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 1 ms 384 KB Output is correct
5 Correct 2 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 1 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 10 ms 1920 KB Output is correct
8 Correct 22 ms 2928 KB Output is correct
9 Correct 45 ms 4728 KB Output is correct
10 Correct 46 ms 4968 KB Output is correct
11 Correct 64 ms 5356 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 -