Pagini recente » Cod sursa (job #1240938) | Cod sursa (job #1756145) | Cod sursa (job #2314141) | Cod sursa (job #1900949) | Cod sursa (job #2407898)
#include<bits/stdc++.h>
using namespace std;
const int maxN=600005;
pair<int,int> v[maxN];
int p;
long long sum;
int pos=0;
const int dim=(1e5);
char buff[dim+5];
inline void read(int &nr)
{
nr=0;
while(!isdigit(buff[pos]))
{
pos++;
if(pos==dim)
{
pos=0;
fread(buff,1,dim,stdin);
}
}
while(isdigit(buff[pos]))
{
nr=nr*10+buff[pos]-'0';
pos++;
if(pos==dim)
{
pos=0;
fread(buff,1,dim,stdin);
}
}
}
int main()
{
freopen("congr.in","r",stdin);
freopen("congr.out","w",stdout);
fread(buff,1,dim,stdin);
read(p);
srand(time(0));
for(int i=1;i<2*p;i++)
{
// scanf("%d",&v[i].first);
read(v[i].first);
v[i].second=i;
}
random_shuffle(v+1,v+2*p);
for(int i=1;i<=p;i++)
sum+=1LL*v[i].first;
while(sum%p)
{
int pos1=1+(rand()%p);
int pos2=(p+1)+(rand()%(p-1));
sum-=1LL*v[pos1].first;
sum+=1LL*v[pos2].first;
swap(v[pos1],v[pos2]);
}
for(int i=1;i<=p;i++)
printf("%d ",v[i].second);
printf("\n");
return 0;
}