Submission #881716

# Submission time Handle Problem Language Result Execution time Memory
881716 2023-12-01T18:53:21 Z alexdd Schools (IZhO13_school) C++17
15 / 100
2000 ms 3932 KB
#include<bits/stdc++.h>
using namespace std;
const int NRIT = 6e7;
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 Execution timed out 2009 ms 2484 KB Time limit exceeded
2 Correct 1606 ms 2488 KB Output is correct
3 Correct 1991 ms 2488 KB Output is correct
4 Execution timed out 2023 ms 2392 KB Time limit exceeded
5 Execution timed out 2085 ms 2392 KB Time limit exceeded
6 Execution timed out 2025 ms 2492 KB Time limit exceeded
7 Execution timed out 2037 ms 2392 KB Time limit exceeded
8 Correct 1483 ms 2508 KB Output is correct
9 Incorrect 1756 ms 2508 KB Output isn't correct
10 Incorrect 1809 ms 2512 KB Output isn't correct
11 Execution timed out 2007 ms 2508 KB Time limit exceeded
12 Incorrect 1875 ms 2512 KB Output isn't correct
13 Incorrect 1681 ms 2644 KB Output isn't correct
14 Execution timed out 2053 ms 2648 KB Time limit exceeded
15 Incorrect 1515 ms 2860 KB Output isn't correct
16 Incorrect 1691 ms 3020 KB Output isn't correct
17 Execution timed out 2048 ms 3164 KB Time limit exceeded
18 Execution timed out 2029 ms 3416 KB Time limit exceeded
19 Execution timed out 2028 ms 3416 KB Time limit exceeded
20 Execution timed out 2058 ms 3932 KB Time limit exceeded