답안 #879321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879321 2023-11-27T06:49:03 Z strelok1337 Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3056 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;
    cin>>n;
    while(n--)
    {
        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;
    for(int i=0;i<v1.size();i++)
    {
        for(int j=0;j<v1.size();j++)
        {
            double lol=i+j+2;
            if(v1[i]>=lol && v2[j]>=lol) ans=max(ans,min(v1[i]-lol,v2[j]-lol));
        }
    }
    printf("%.4lf",(double)ans);
}
/*
4
1.2
1.4
1.6
1.9

1.4
1.5
2
3.7

4
1.4 3.7
1.2 2
1.6 1.4
1.9 1.5
*/

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=1;i<v1.size();i++) v1[i]+=v1[i-1];
      |                 ~^~~~~~~~~~
sure.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int i=1;i<v2.size();i++) v2[i]+=v2[i-1];
      |                 ~^~~~~~~~~~
sure.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i=0;i<v1.size();i++)
      |                 ~^~~~~~~~~~
sure.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int j=0;j<v1.size();j++)
      |                     ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 3 ms 496 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 488 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 3 ms 496 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 488 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Execution timed out 2055 ms 3056 KB Time limit exceeded
18 Halted 0 ms 0 KB -