Submission #879393

# Submission time Handle Problem Language Result Execution time Memory
879393 2023-11-27T09:49:45 Z vjudge1 Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 464 KB
/*
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠛⠛⠛⠛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠞⢛⣛⠻⣷⡄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⢡⣾⣿⣿⣷⢹⡇⠋⠉⠀⢀⣀⣀⣀⠉⠙⢿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⢠⣴⣶⣶⣤⠀⠀⠀⠀⣿⣷⣜⠿⠿⠟⣡⠟⠁⢀⡠⠂⠉⠀⠀⠀⠉⠐⡄⠹⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠻⢷⡿⠟⠁⢀⣾⡄⠀⠛⠿⢿⠷⠶⠚⣋⠠⠒⠉⠣⡀⠀⠀⠀⠀⠀⠀⡇⠀⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠰⠅⠀⠄⠀⠀⠀⠀⠀⠊⠀⠈⠀⠀⣀⠠⠤⠒⠉⠀⠀⠀⠀⠀⠙⠄⠀⠀⠀⠀⠀⠃⢠⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠁⠀⠀⠀⠊⠉⠓⠒⠒⠒⠚⠋⠉⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⡀⠀⢀⠄⣠⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠢⡀⢠⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠰⠆⣀⠴⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠤⢀⠈⠺⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⣀⣀⠠⠄⠊⣁⠄⠀⠁⠀⠀⣻⣛⠛⢛⣉
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠉⠂⠀⠈⠙⢒⠒⠒⠒⠂⠀⠀⠀⠐⠀⠀⠒⠒⠊⢉⡀⠀⠀⠐⠈⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣸⣿⡀⠀⠀⠀⠀⠀⠀⠁⠢⣀⣀⣀⣀⣀⣀⣠⣤⢴⠊⠉⠉⠀⠀⠀⠀⠀⠀⢀⣀⣠⣴⠻⠿⠿⠿⠿⠿
⣿⣿⡿⠿⠿⢿⣿⡿⢟⣩⣶⣿⣿⣿⢷⣀⠀⠀⠀⠀⠀⠀⠰⣈⠻⣿⡿⠟⠋⠡⠇⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⡜⣿⣿⣶⣶⣶⣶
⢋⣴⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⠏⣼⣿⣿⣤⣤⠀⠀⠀⠀⠘⠀⠤⠤⠔⢂⠂⣀⣀⣀⣀⣀⣤⣾⣿⣿⣿⣿⣿⣿⣷⣌⠻⣿⣿⣿⣿
⠛⢿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⠟⣸⣿⣿⣿⣿⣿⣤⣴⣆⣀⣰⠀⠀⠀⠀⠱⡀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣙⠻⣿
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long long double
#define pb push_back
#define pf push_front
#define all(a) a.begin(),a.end()
#define IShowSpeed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=5e5+10;
const int mod=1e9+7;
vector<double>v1,v2;

int main()
{
    IShowSpeed
    int n,x1,y1;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        double x,y;
        cin>>x>>y;
        v1.pb(x);
        v2.pb(y);
    }
    sort(all(v1));
    sort(all(v2));
    reverse(all(v1));
    reverse(all(v2));
    for(int i=1;i<v1.size();i++) v1[i]+=v1[i-1];
    for(int i=1;i<v2.size();i++) v2[i]+=v2[i-1];
    double ans=0;
    int pos1=0,pos2=0;
    while(pos1<n || pos2<n)
    {
        if(pos2==n || (pos1<n && min(v1[pos1+1],v2[pos2])>=min(v1[pos1],v2[pos2+1]))) pos1++;
        else pos2++;
        ans=max(ans,min(v1[pos1],v2[pos2])-(pos1+pos2+2));
    }
    cout<<fixed<<setprecision(4)<<ans;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i=1;i<v1.size();i++) v1[i]+=v1[i-1];
      |                 ~^~~~~~~~~~
sure.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i=1;i<v2.size();i++) v2[i]+=v2[i-1];
      |                 ~^~~~~~~~~~
sure.cpp:33:11: warning: unused variable 'x1' [-Wunused-variable]
   33 |     int n,x1,y1;
      |           ^~
sure.cpp:33:14: warning: unused variable 'y1' [-Wunused-variable]
   33 |     int n,x1,y1;
      |              ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -