답안 #242519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242519 2020-06-28T01:55:43 Z LucaDantas Sure Bet (CEOI17_sure) C++17
0 / 100
5 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()

constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 1e5 + 10;
constexpr int mod = 1000000007;

int main() {
	int n; scanf("%d", &n);
	priority_queue<double> a, b;
	rep(i,0,n) {
		double x, y;
		scanf("%lf %lf", &x, &y);
		a.push(x); b.push(y);
	}
	
	double A = 0, B = 0, ans = -10000;

	rep(i,0,2*n) {
		if(a.empty() || B <= A) {
			double now = b.top();
			b.pop();
			A--;
			B += now - 1;
			ans = max(ans, min(A, B));
		}
		else if(b.empty() || A < B) {
			double now = a.top();
			a.pop();
			B--;
			A += now - 1;
			ans = max(ans, min(A, B));
		}
	}
	cout << fixed;
	cout << setprecision(4);
	cout << ans << '\n';
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
         ~~~~~^~~~~~~~~~
sure.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf", &x, &y);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -