답안 #362175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
362175 2021-02-02T00:28:07 Z ignaciocanta Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 31724 KB
#include <bits/stdc++.h>
 
using namespace std;
 
using tint = long long;
using ld = long double;
 
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
 
using pi = pair<tint,int>;
using pl = pair<tint,tint>;
using vi = vector<int>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vl = vector<tint>;
using vb = vector<bool>;

#define pb push_back
#define pf push_front
#define rsz resize
#define all(x) begin(x), end(x)
#define rall(x) x.rbegin(), x.rend() 
#define sz(x) (int)(x).size()
#define ins insert

#define f first
#define s second
#define mp make_pair
 
#define DBG(x) cerr << #x << " = " << x << endl;
 
const int MOD = 1e9+7;
const tint mod = 998244353;
const int MX = 515;
const tint INF = 1e18; 
const int inf = 2e9;
const ld PI = acos(ld(-1)); 
const ld eps = 1e-8;
 
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
 
template<class T> void remDup(vector<T> &v){ 
    sort(all(v)); v.erase(unique(all(v)),end(v));
}

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; 
} 
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; 
}
 
bool valid(int x, int y, int n, int m){
    return (0<=x && x<n && 0<=y && y<m);
}
 
int cdiv(int a, int b) { return a/b+((a^b)>0&&a%b); } //redondea p arriba
int fdiv(int a, int b) { return a/b-((a^b)<0&&a%b); } //redondea p abajo
 
void NACHO(string name = ""){
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
		freopen((name+".in").c_str(), "r", stdin);
		freopen((name+".out").c_str(), "w", stdout);
	}
}

int main(){
	NACHO();
	int n; tint l; cin >> n >> l;
	vpl a (n);
	F0R(i, n) cin >> a[i].f >> a[i].s;
	double low = 1, high = double(5e9);
	F0R(assa, 100){
		double mid = low+(high-low)/2;
		vector<pair<double, double>> ran (n);
		F0R(i, n){
			// mid*mid = p.y*p.y+x*x
			double dist = sqrt(mid*mid-a[i].s*a[i].s);
			ran[i] = mp(a[i].f-dist, a[i].f+dist);
		}
		double ri = 0;
		F0R(i, n){
			if(ran[i].f <= ri) ri = max(ri, ran[i].s);
		}
		if(ri >= l) high = mid;
		else low = mid;
	}
	cout << fixed << setprecision(4) << high << "\n";
}

Compilation message

mobile.cpp: In function 'void NACHO(std::string)':
mobile.cpp:69:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   69 |   freopen((name+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:70:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   70 |   freopen((name+".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 7 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 8 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 7 ms 492 KB Output is correct
5 Correct 6 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 2668 KB Output is correct
2 Correct 66 ms 2748 KB Output is correct
3 Correct 48 ms 2028 KB Output is correct
4 Correct 95 ms 2668 KB Output is correct
5 Correct 60 ms 1900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 89 ms 2796 KB Output is correct
2 Correct 80 ms 2588 KB Output is correct
3 Correct 99 ms 2932 KB Output is correct
4 Correct 95 ms 2836 KB Output is correct
5 Correct 106 ms 3104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 78 ms 3084 KB Output is correct
2 Correct 71 ms 2924 KB Output is correct
3 Correct 77 ms 3028 KB Output is correct
4 Correct 123 ms 3436 KB Output is correct
5 Correct 103 ms 3068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 3436 KB Output is correct
2 Correct 88 ms 3436 KB Output is correct
3 Correct 89 ms 3436 KB Output is correct
4 Correct 123 ms 3436 KB Output is correct
5 Correct 121 ms 3564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 3436 KB Output is correct
2 Correct 111 ms 3436 KB Output is correct
3 Correct 104 ms 3436 KB Output is correct
4 Correct 137 ms 3436 KB Output is correct
5 Correct 116 ms 3436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 538 ms 15980 KB Output is correct
2 Correct 544 ms 16108 KB Output is correct
3 Correct 511 ms 15980 KB Output is correct
4 Correct 749 ms 15980 KB Output is correct
5 Correct 717 ms 15980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 16064 KB Output is correct
2 Correct 970 ms 15980 KB Output is correct
3 Correct 524 ms 15980 KB Output is correct
4 Correct 785 ms 16032 KB Output is correct
5 Correct 702 ms 16108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 599 ms 19148 KB Output is correct
2 Correct 682 ms 19148 KB Output is correct
3 Correct 593 ms 19148 KB Output is correct
4 Correct 814 ms 19148 KB Output is correct
5 Correct 742 ms 19148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 597 ms 19180 KB Output is correct
2 Execution timed out 1065 ms 19164 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 654 ms 22320 KB Output is correct
2 Correct 710 ms 22320 KB Output is correct
3 Correct 702 ms 22320 KB Output is correct
4 Correct 948 ms 22320 KB Output is correct
5 Correct 877 ms 22448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 724 ms 22320 KB Output is correct
2 Execution timed out 1052 ms 22320 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 758 ms 25364 KB Output is correct
2 Correct 823 ms 25364 KB Output is correct
3 Correct 799 ms 25364 KB Output is correct
4 Execution timed out 1051 ms 25364 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 810 ms 25364 KB Output is correct
2 Execution timed out 1090 ms 25496 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 944 ms 31712 KB Output is correct
2 Execution timed out 1033 ms 31712 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1018 ms 31724 KB Time limit exceeded
2 Halted 0 ms 0 KB -