Cod sursa(job #806963)

Utilizator robertpoeRobert Poenaru robertpoe Data 3 noiembrie 2012 19:47:36
Problema Congr Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include<fstream>
#include<cstdlib>
#include<ctime>
#define dll long long
#define dim 666123
using namespace std;
ifstream f("congr.in");
ofstream g("congr.out");
int p,i,j;
int a[dim],b[dim];
dll 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;
}