Submission #39866749


Source Code Expand

Copy
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fir first
#define sec second
#define sz size
#define mp make_pair
#define ll long long
#define pb push_back
#define en "\n"
#define ld long double
vector<ld> a, b, d, e;
ll get(ld x)
{
vector<pair<ld, ll> > c;
for (int i = 0; i < d.sz(); i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fir first
#define sec second
#define sz size
#define mp make_pair
#define ll long long
#define pb push_back
#define en "\n"
#define ld long double
vector<ld> a, b, d, e;
ll get(ld x)
{
    vector<pair<ld, ll> > c;
    for (int i = 0; i < d.sz(); i++)
        c.pb(mp((x-(d[i] / (d[i]+e[i])))*(e[i]+d[i]), i));
    sort(c.begin(), c.end());
    reverse(c.begin(), c.end());
    ll res = 0;
    for (int i = 0; i < a.sz(); i++)
    {
        ll l = 0, r = c.sz()-1;
        while (l < r)
        {
            int mid = (l+r) / 2;
            mid++;
            if ((a[i]+d[c[mid].sec]) / (a[i]+d[c[mid].sec]+b[i]+e[c[mid].sec]) < x)
                l = mid;
            else
                r = mid-1;
        }
        if ((a[i]+d[c[l].sec]) / (a[i]+d[c[l].sec]+b[i]+e[c[l].sec]) < x)
            res += l+1;
//        if (a[i] / b[i] < x)
//            res--;
    }
    return res;
}
int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(0);
    ll n, m, k;
    cin >> n >> m >> k;
    k = (n*m+1)-k;
    a.resize(n);
    b.resize(n);
    d.resize(m);
    e.resize(m);
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    for (int i = 0; i < m; i++)
        cin >> d[i] >> e[i];
    ld l = 0, r = 3e5;
    cout << fixed << setprecision(20);
    while (double(clock()) / double(CLOCKS_PER_SEC) < 3.75)
    {
        ld mid = (l+r) / 2;
        if (get(mid) >= k)
            r = mid;
        else
            l = mid;
    }
    l *= 100;
    cout << l << en;
}

Submission Info

Submission Time
Task F - Sugar Water 2
User Abbess
Language C++ (GCC 9.2.1)
Score 500
Code Size 1962 Byte
Status AC
Exec Time 3775 ms
Memory 10264 KB

Compile Error

./Main.cpp: In function ‘long long int get(long double)’:
./Main.cpp:21:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long double>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   21 |     for (int i = 0; i < d.sz(); i++)
      |                     ~~^~~~~~~~
./Main.cpp:26:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long double>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   26 |     for (int i = 0; i < a.sz(); i++)
      |                     ~~^~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 33
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_biased_00.txt, 02_biased_01.txt, 02_biased_02.txt, 02_biased_03.txt, 02_biased_04.txt, 02_biased_05.txt, 02_biased_06.txt, 02_biased_07.txt, 02_biased_08.txt, 02_biased_09.txt, 03_border_00.txt, 03_border_01.txt, 03_border_02.txt, 03_border_03.txt, 03_border_04.txt, 03_border_05.txt, 03_border_06.txt, 03_border_07.txt, 03_border_08.txt, 03_border_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 3759 ms 3668 KB
00_sample_01.txt AC 3756 ms 3704 KB
00_sample_02.txt AC 3759 ms 3812 KB
01_random_00.txt AC 3759 ms 10264 KB
01_random_01.txt AC 3775 ms 10108 KB
01_random_02.txt AC 3767 ms 10124 KB
01_random_03.txt AC 3772 ms 10108 KB
01_random_04.txt AC 3769 ms 10124 KB
01_random_05.txt AC 3756 ms 10136 KB
01_random_06.txt AC 3763 ms 7936 KB
01_random_07.txt AC 3760 ms 5752 KB
01_random_08.txt AC 3755 ms 3940 KB
01_random_09.txt AC 3761 ms 6560 KB
02_biased_00.txt AC 3758 ms 10260 KB
02_biased_01.txt AC 3761 ms 10036 KB
02_biased_02.txt AC 3766 ms 10084 KB
02_biased_03.txt AC 3765 ms 10120 KB
02_biased_04.txt AC 3757 ms 10200 KB
02_biased_05.txt AC 3760 ms 10128 KB
02_biased_06.txt AC 3761 ms 10196 KB
02_biased_07.txt AC 3762 ms 10140 KB
02_biased_08.txt AC 3761 ms 10132 KB
02_biased_09.txt AC 3763 ms 10032 KB
03_border_00.txt AC 3763 ms 10108 KB
03_border_01.txt AC 3758 ms 8636 KB
03_border_02.txt AC 3760 ms 4840 KB
03_border_03.txt AC 3755 ms 3704 KB
03_border_04.txt AC 3760 ms 10032 KB
03_border_05.txt AC 3761 ms 8512 KB
03_border_06.txt AC 3760 ms 4692 KB
03_border_07.txt AC 3756 ms 3676 KB
03_border_08.txt AC 3755 ms 3700 KB
03_border_09.txt AC 3759 ms 3672 KB


2025-03-05 (Wed)
18:12:02 +00:00