Pagini recente » Cod sursa (job #1095873) | Cod sursa (job #2581513) | Cod sursa (job #848309) | Cod sursa (job #2121638) | Cod sursa (job #929072)
Cod sursa(job #929072)
#include <fstream>
#include <cstdlib>
#include <ctime>
#define DN 600005
using namespace std;
int v[DN],ind[DN];
int main()
{
srand(time(NULL));
int p;
long long s=0;
ifstream f("congr.in");
ofstream g("congr.out");
f>>p;
for(int i=1;i<=2*p-1;++i )
{
f>>v[i];
ind[i]=i;
if(i<=p)
s+=v[i];
}
while(s%p)
{
int a=rand()%p+1;
int b=rand()%(p-1)+p+1;
s+=(v[b]-v[a]);
swap(v[a],v[b]);
swap(ind[a],ind[b]);
}
for(int i=1;i<=p;++i)
g<<ind[i]<<" ";
return 0;
}