#include<bits/stdc++.h>
using namespace std;
const int NRIT = 4e7;
int n,m,s;
pair<int,pair<int,int>> v[300005];
int unde[300005];
mt19937 rnd(293123);
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n>>m>>s;
int a,b;
for(int i=1;i<=n;i++)
{
cin>>a>>b;
v[i] = {a-b,{a,b}};
}
//sort(v+1,v+1+n);
long long mxm=0;
int nrs = NRIT/n;
for(int pas2=0;pas2<nrs;pas2++)
{
sort(v+1,v+1+m+s);
long long sum=0;
for(int i=1;i<=s;i++)
sum += v[i].second.second;
for(int i=1;i<=m;i++)
sum += v[m+s-i+1].second.first;
mxm = max(mxm,sum);
random_shuffle(v+1,v+1+n);
}
cout<<mxm;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1022 ms |
2644 KB |
Output is correct |
2 |
Correct |
961 ms |
2496 KB |
Output is correct |
3 |
Correct |
891 ms |
2496 KB |
Output is correct |
4 |
Incorrect |
1754 ms |
2492 KB |
Output isn't correct |
5 |
Incorrect |
979 ms |
2488 KB |
Output isn't correct |
6 |
Incorrect |
1543 ms |
2496 KB |
Output isn't correct |
7 |
Incorrect |
993 ms |
2492 KB |
Output isn't correct |
8 |
Execution timed out |
2020 ms |
2392 KB |
Time limit exceeded |
9 |
Execution timed out |
2045 ms |
2392 KB |
Time limit exceeded |
10 |
Execution timed out |
2040 ms |
2396 KB |
Time limit exceeded |
11 |
Execution timed out |
2053 ms |
2408 KB |
Time limit exceeded |
12 |
Incorrect |
1899 ms |
2492 KB |
Output isn't correct |
13 |
Execution timed out |
2053 ms |
2396 KB |
Time limit exceeded |
14 |
Incorrect |
1411 ms |
2492 KB |
Output isn't correct |
15 |
Incorrect |
570 ms |
4544 KB |
Output isn't correct |
16 |
Execution timed out |
2090 ms |
4440 KB |
Time limit exceeded |
17 |
Execution timed out |
2033 ms |
4440 KB |
Time limit exceeded |
18 |
Execution timed out |
2064 ms |
4444 KB |
Time limit exceeded |
19 |
Execution timed out |
2054 ms |
4444 KB |
Time limit exceeded |
20 |
Execution timed out |
2050 ms |
4944 KB |
Time limit exceeded |