Cod sursa(job #735722)
| Utilizator | Data | 17 aprilie 2012 10:17:23 | |
|---|---|---|---|
| Problema | Congr | Scor | 80 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<fstream>
#include<cstdlib>
#include<ctime>
using namespace std;
ifstream f("congr.in");
ofstream g("congr.out");
int p,i,j;
int a[600000],b[600000];
long long s=0;
int main ()
{
srand(time(0));
f>>p;
for (i=1;i<2*p;i++)
{
f>>a[i];
b[i]=i;
if(i<=p)
s+=a[i];
}
while (s%p)
{
i=1+rand()%p;
j=1+p+rand()%(p-1);
s=s+a[b[j]]-a[b[i]];
swap(b[i],b[j]);
}
for (i=1;i<=p;i++)
g<<b[i]<<' ';
g<<'\n';
return 0;
}
