Submission #921504

# Submission time Handle Problem Language Result Execution time Memory
921504 2024-02-04T03:24:54 Z PM1 Sure Bet (CEOI17_sure) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int mxn=1e5+5;
int n;
double a[mxn],b[mxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	double L=0,R=1e8;
	int t=200;
	while(t--){
		double mid=(L+R)/(ll)2,sum1=0,sum2=0;
		int p=n;
		for(int i=n;i>0;i--){
			while(p>0 && sum2<mid){
				sum2+=b[p]-1;
				p++;
				sum1--;
			}
			if(sum1>=mid)break;
			sum1+=a[i]-1;
			sum2--;
		}
		if(sum1>=mid && sum2>=mid)
			L=mid;
		else
			R=mid;
	}
	cout<<fixed<<setprecision(4);
	cout<<L<<endl;
	return 0;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:18:21: error: 'll' was not declared in this scope
   18 |   double mid=(L+R)/(ll)2,sum1=0,sum2=0;
      |                     ^~
sure.cpp:21:17: error: 'sum2' was not declared in this scope
   21 |    while(p>0 && sum2<mid){
      |                 ^~~~
sure.cpp:24:5: error: 'sum1' was not declared in this scope
   24 |     sum1--;
      |     ^~~~
sure.cpp:26:7: error: 'sum1' was not declared in this scope
   26 |    if(sum1>=mid)break;
      |       ^~~~
sure.cpp:27:4: error: 'sum1' was not declared in this scope
   27 |    sum1+=a[i]-1;
      |    ^~~~
sure.cpp:28:4: error: 'sum2' was not declared in this scope
   28 |    sum2--;
      |    ^~~~
sure.cpp:30:6: error: 'sum1' was not declared in this scope
   30 |   if(sum1>=mid && sum2>=mid)
      |      ^~~~
sure.cpp:30:19: error: 'sum2' was not declared in this scope
   30 |   if(sum1>=mid && sum2>=mid)
      |                   ^~~~