CSES - Putka Open 2015 – 1/6 - Results
Submission details
Task:Jakkara
Sender:
Submission time:2015-07-18 15:46:46 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.

Code

#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

#define pii pair<int, int>
#define pll pair<long long, long long>

#define defmod 1000000007
using namespace std;

ll a, b, c, d;

ll f(ll e){
	return abs(e-a)+abs(e-b)+abs(e-c)+abs(e-d);
}
int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);
	
	cin >> a >> b >> c >> d;
	ll l = 0, r = 1LL<<33;
	while(l < r){
		ll mid = (l+r)/2;
		if(f(mid)<f(mid+1))
			r = mid;
		else
			l = mid+1;
	}
	cout << "paras " << (l+r)/2 << endl;
	cout << f((l+r)/2) << endl;
	return 0;
}