Borderou de evaluare (job #1143607)

Utilizator VisuianMihaiMihai Visuian VisuianMihai Data 15 martie 2014 19:05:03
Problema Desen Status done
Runda Arhiva de probleme Compilator cpp | Vezi sursa
Scor 100

Raport evaluator

Compilare: user.cpp: In function ‘void apm(int)’: user.cpp:12:424: warning: unused variable ‘c’ [-Wunused-variable] ifstream fin("desen.in"); ofstream fout("desen.out"); int n, m, t[N], nrm; double sol; typedef pair <short, short> muchie; typedef pair <double, muchie> arbore; list <arbore> graf; list <bool> viz; vector <muchie> nod; inline double cost(int x, int y, int a, int b) { double dx = a-x, dy = b - y; return sqrt(dx*dx + dy*dy); } inline int tata(int x) { if(t[x] != x) t[x] = tata(t[x]); return t[x]; } void apm(int nn) { int c = -1; list <arbore> :: iterator it = graf.begin(); list <bool> :: iterator it2 = viz.begin(); for( ; nrm < nn; it++, it2++) { int x = tata((*it).aa), y = tata((*it).bb); if(x != y) { (*it2) = 1; t[x] = y; sol += (*it).first; nrm++; } } } void Erase() { list <arbore> :: iterator it = graf.begin(); list <bool> :: iterator it2 = viz.begin(); for(; it != graf.end(); ) { if(!(*it2)) { it = graf.erase(it); it2 = viz.erase(it2); } else { *it2 = 0; it++, it2++; } } } int main() { fin>>n; for(int i=0; i<n; i++) { short x, y; fin>>x>>y; nod.push_back(muchie(x, y)); Erase(); for(unsigned j=0; j<nod.size()-1; j++) { double c = cost(x, y, nod[j].first, nod[j].second); graf.push_back(arbore(c, muchie(i, j))); viz.push_back(0); } for(int k=0; k<=i; k++) t[k] = k; sol = nrm = 0; graf.sort(); apm(i); fout<<fixed<<sol<<setprecision(6)<<'\n'; } return 0; } ^
Test Timp executie Memorie folosita Mesaj Punctaj/test
10ms456kbOK!10
24ms464kbOK!10
34ms460kbOK!10
472ms508kbOK!10
5296ms548kbOK!10
6296ms548kbOK!10
7296ms548kbOK!10
8300ms548kbOK!10
9300ms548kbOK!10
10296ms548kbOK!10
Punctaj total100

Ceva nu functioneaza?