# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
881716 | alexdd | 학교 설립 (IZhO13_school) | C++17 | 2085 ms | 3932 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|---|---|---|---|
Fetching results... |