답안 #865345

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865345 2023-10-24T07:37:02 Z vjudge1 Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 2396 KB
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double ld;

#define all(x) x.begin(),x.end()
#define pb push_back
#define ent "\n"

const int maxn = (int)3e5 + 13;
const ll inf = (long long)1e18 + 20;
const int mod = (int)1e9 + 7;

int n;
pair<ld,ld>a[maxn];
ld pref[maxn];

void solve(){
	cin >> n;
	for(int i = 1 ; i <= n ; i ++){
		cin >> a[i].first >> a[i].second;
	}
	sort(a + 1,a + 1 + n);
	reverse(a + 1,a + 1 + n);
	for(int i = 1 ; i <= n ; i ++){
		pref[i] = pref[i - 1] + a[i].second;
	}
	ld ans = 0,mx = 0,kol = 0;
	for(int i = 1 ; i <= n ; i ++){
		ans = 0;
		for(int j = 1 ; j < i ; j ++){
			ans = 0;
			ld sum = 0;
			for(int c = j ; c <= i ; c ++){
				ans += a[c].first;
				mx = max(mx,min(ans,pref[i] - pref[c]) - (i - j + 1));
			}
		}
	}
	cout << fixed << mx;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t --){
		solve();
	}
	return 0;
}

Compilation message

sure.cpp: In function 'void solve()':
sure.cpp:59:7: warning: unused variable 'sum' [-Wunused-variable]
   59 |    ld sum = 0;
      |       ^~~
sure.cpp:54:20: warning: unused variable 'kol' [-Wunused-variable]
   54 |  ld ans = 0,mx = 0,kol = 0;
      |                    ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -