Cod sursa(job #1239373)
| Utilizator | Data | 8 octombrie 2014 23:07:22 | |
|---|---|---|---|
| Problema | Congr | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
// 80 pct.
#include<fstream>
#include<ctime>
using namespace std;
ifstream f("congr.in"); ofstream g("congr.out");
int p,i,j,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'; g.close(); return 0;
}
