Submission #881717

# Submission time Handle Problem Language Result Execution time Memory
881717 2023-12-01T18:53:54 Z alexdd Schools (IZhO13_school) C++17
20 / 100
1633 ms 4176 KB
#include<bits/stdc++.h>
using namespace std;
const int NRIT = 4e7;
int n,m,s;
pair<int,int> v[300005];
mt19937 rnd(921831);
int unde[300005];
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>m>>s;
    for(int i=0;i<n;i++)
    {
        cin>>v[i].first>>v[i].second;
        if(i<m)
            unde[i]=1;
        else if(i<m+s)
            unde[i]=2;
    }
    for(int pas=0;pas<NRIT;pas++)
    {
        int x = rnd()%n;
        int y = rnd()%n;
        if(unde[x]==unde[y])
            continue;
        if(unde[y]==0)
            swap(x,y);
        if(unde[x]==0)
        {
            if(unde[y]==1)
            {
                if(v[x].first - v[y].first > 0)
                    swap(unde[x],unde[y]);
            }
            else
            {
                if(v[x].second - v[y].second > 0)
                    swap(unde[x],unde[y]);
            }
        }
        else
        {
            if(unde[x]==2)
                swap(x,y);
            if(v[x].second - v[x].first + v[y].first - v[y].second > 0)
            {
                swap(unde[x],unde[y]);
            }
        }
    }
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        if(unde[i]==1)
            sum += v[i].first;
        else if(unde[i]==2)
            sum += v[i].second;
    }
    cout<<sum;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1343 ms 2484 KB Output is correct
2 Correct 1073 ms 2488 KB Output is correct
3 Correct 1400 ms 2484 KB Output is correct
4 Incorrect 1396 ms 2484 KB Output isn't correct
5 Incorrect 1473 ms 2492 KB Output isn't correct
6 Incorrect 1367 ms 2492 KB Output isn't correct
7 Incorrect 1370 ms 2524 KB Output isn't correct
8 Correct 982 ms 2644 KB Output is correct
9 Incorrect 1173 ms 2504 KB Output isn't correct
10 Incorrect 1208 ms 2512 KB Output isn't correct
11 Incorrect 1320 ms 2396 KB Output isn't correct
12 Incorrect 1258 ms 2512 KB Output isn't correct
13 Incorrect 1123 ms 2396 KB Output isn't correct
14 Incorrect 1504 ms 2900 KB Output isn't correct
15 Incorrect 1020 ms 2860 KB Output isn't correct
16 Incorrect 1136 ms 3016 KB Output isn't correct
17 Incorrect 1568 ms 3328 KB Output isn't correct
18 Incorrect 1633 ms 3560 KB Output isn't correct
19 Incorrect 1590 ms 3644 KB Output isn't correct
20 Incorrect 1628 ms 4176 KB Output isn't correct